TraceBuilder 2.4.0
authorMatti Laitinen <matti.t.laitinen@nokia.com>
Wed, 23 Jun 2010 14:35:40 +0300
changeset 10 ed1c9f64298a
parent 9 14dc2103a631
child 11 5b9d4d8641ce
TraceBuilder 2.4.0
trace/tracebuilder/com.nokia.carbide.extensions.tracebuilder/build.properties
trace/tracebuilder/com.nokia.carbide.extensions.tracebuilder/feature.xml
trace/tracebuilder/com.nokia.carbide.extensions.tracebuilder/license.htm
trace/tracebuilder/com.nokia.tracebuilder.eclipse/.classpath
trace/tracebuilder/com.nokia.tracebuilder.eclipse/.settings/org.eclipse.jdt.core.prefs
trace/tracebuilder/com.nokia.tracebuilder.eclipse/META-INF/MANIFEST.MF
trace/tracebuilder/com.nokia.tracebuilder.eclipse/about.html
trace/tracebuilder/com.nokia.tracebuilder.eclipse/build.properties
trace/tracebuilder/com.nokia.tracebuilder.eclipse/plugin.xml
trace/tracebuilder/com.nokia.tracebuilder.eclipse/src/com/nokia/tracebuilder/eclipse/Activator.java
trace/tracebuilder/com.nokia.tracebuilder.eclipse/src/com/nokia/tracebuilder/eclipse/EclipseConsole.java
trace/tracebuilder/com.nokia.tracebuilder.eclipse/src/com/nokia/tracebuilder/eclipse/JFaceDirtyStateListener.java
trace/tracebuilder/com.nokia.tracebuilder.eclipse/src/com/nokia/tracebuilder/eclipse/JFaceDocumentFactory.java
trace/tracebuilder/com.nokia.tracebuilder.eclipse/src/com/nokia/tracebuilder/eclipse/JFaceDocumentWrapper.java
trace/tracebuilder/com.nokia.tracebuilder.eclipse/src/com/nokia/tracebuilder/eclipse/JFaceLocationUpdater.java
trace/tracebuilder/com.nokia.tracebuilder.eclipse/src/com/nokia/tracebuilder/eclipse/JFaceLocationWrapper.java
trace/tracebuilder/com.nokia.tracebuilder.eclipse/src/com/nokia/tracebuilder/eclipse/JFaceSelectionListener.java
trace/tracebuilder/com.nokia.tracebuilder.eclipse/src/com/nokia/tracebuilder/eclipse/JFaceSourceChangeListener.java
trace/tracebuilder/com.nokia.tracebuilder.eclipse/src/com/nokia/tracebuilder/eclipse/Messages.java
trace/tracebuilder/com.nokia.tracebuilder.eclipse/src/com/nokia/tracebuilder/eclipse/PluginStartup.java
trace/tracebuilder/com.nokia.tracebuilder.eclipse/src/com/nokia/tracebuilder/eclipse/TraceProjectMonitor.java
trace/tracebuilder/com.nokia.tracebuilder.eclipse/src/com/nokia/tracebuilder/eclipse/WorkbenchEditorMonitor.java
trace/tracebuilder/com.nokia.tracebuilder.eclipse/src/com/nokia/tracebuilder/eclipse/WorkbenchListener.java
trace/tracebuilder/com.nokia.tracebuilder.eclipse/src/com/nokia/tracebuilder/eclipse/WorkbenchListenerCallback.java
trace/tracebuilder/com.nokia.tracebuilder.eclipse/src/com/nokia/tracebuilder/eclipse/WorkbenchUtils.java
trace/tracebuilder/com.nokia.tracebuilder.eclipse/src/com/nokia/tracebuilder/eclipse/messages.properties
trace/tracebuilder/com.nokia.tracebuilder.eventhandler/.classpath
trace/tracebuilder/com.nokia.tracebuilder.eventhandler/.settings/org.eclipse.core.resources.prefs
trace/tracebuilder/com.nokia.tracebuilder.eventhandler/.settings/org.eclipse.jdt.core.prefs
trace/tracebuilder/com.nokia.tracebuilder.eventhandler/META-INF/MANIFEST.MF
trace/tracebuilder/com.nokia.tracebuilder.eventhandler/about.html
trace/tracebuilder/com.nokia.tracebuilder.eventhandler/build.properties
trace/tracebuilder/com.nokia.tracebuilder.eventhandler/plugin.properties
trace/tracebuilder/com.nokia.tracebuilder.eventhandler/plugin.xml
trace/tracebuilder/com.nokia.tracebuilder.eventhandler/src/com/nokia/tracebuilder/eventhandler/Activator.java
trace/tracebuilder/com.nokia.tracebuilder.eventhandler/src/com/nokia/tracebuilder/eventhandler/EventAdder.java
trace/tracebuilder/com.nokia.tracebuilder.eventhandler/src/com/nokia/tracebuilder/eventhandler/EventHandlerStartup.java
trace/tracebuilder/com.nokia.tracebuilder.eventhandler/src/com/nokia/tracebuilder/eventhandler/EventListEntryInvalidTraceLocation.java
trace/tracebuilder/com.nokia.tracebuilder.eventhandler/src/com/nokia/tracebuilder/eventhandler/EventListEntryLocationCountError.java
trace/tracebuilder/com.nokia.tracebuilder.eventhandler/src/com/nokia/tracebuilder/eventhandler/EventListEntrySourceLocation.java
trace/tracebuilder/com.nokia.tracebuilder.eventhandler/src/com/nokia/tracebuilder/eventhandler/EventListEntryTraceLocation.java
trace/tracebuilder/com.nokia.tracebuilder.eventhandler/src/com/nokia/tracebuilder/eventhandler/EventListEntryTraceObject.java
trace/tracebuilder/com.nokia.tracebuilder.eventhandler/src/com/nokia/tracebuilder/eventhandler/EventListLocationListListener.java
trace/tracebuilder/com.nokia.tracebuilder.eventhandler/src/com/nokia/tracebuilder/eventhandler/EventListLocationValidityListener.java
trace/tracebuilder/com.nokia.tracebuilder.eventhandler/src/com/nokia/tracebuilder/eventhandler/EventListSelectionListener.java
trace/tracebuilder/com.nokia.tracebuilder.eventhandler/src/com/nokia/tracebuilder/eventhandler/InvalidLocationEntryAdder.java
trace/tracebuilder/com.nokia.tracebuilder.eventhandler/src/com/nokia/tracebuilder/eventhandler/Messages.java
trace/tracebuilder/com.nokia.tracebuilder.eventhandler/src/com/nokia/tracebuilder/eventhandler/TraceBuilderEventHandler.java
trace/tracebuilder/com.nokia.tracebuilder.eventhandler/src/com/nokia/tracebuilder/eventhandler/messages.properties
trace/tracebuilder/com.nokia.tracebuilder.eventhandler/src/com/nokia/tracebuilder/eventhandler/package.html
trace/tracebuilder/com.nokia.tracebuilder.help/.classpath
trace/tracebuilder/com.nokia.tracebuilder.help/.settings/org.eclipse.jdt.core.prefs
trace/tracebuilder/com.nokia.tracebuilder.help/META-INF/MANIFEST.MF
trace/tracebuilder/com.nokia.tracebuilder.help/about.html
trace/tracebuilder/com.nokia.tracebuilder.help/book.css
trace/tracebuilder/com.nokia.tracebuilder.help/build.properties
trace/tracebuilder/com.nokia.tracebuilder.help/html/concepts/concepts.htm
trace/tracebuilder/com.nokia.tracebuilder.help/html/concepts/dictionaryfile.htm
trace/tracebuilder/com.nokia.tracebuilder.help/html/concepts/trace_format.htm
trace/tracebuilder/com.nokia.tracebuilder.help/html/concepts/tracecompiler.htm
trace/tracebuilder/com.nokia.tracebuilder.help/html/concepts/tracing.htm
trace/tracebuilder/com.nokia.tracebuilder.help/html/contexts.xml
trace/tracebuilder/com.nokia.tracebuilder.help/html/gettingstarted/basic_steps.htm
trace/tracebuilder/com.nokia.tracebuilder.help/html/gettingstarted/gs_index.htm
trace/tracebuilder/com.nokia.tracebuilder.help/html/gettingstarted/overview.htm
trace/tracebuilder/com.nokia.tracebuilder.help/html/images/about_cpp.png
trace/tracebuilder/com.nokia.tracebuilder.help/html/images/background_carbide.jpg
trace/tracebuilder/com.nokia.tracebuilder.help/html/images/brandmark_cpp.gif
trace/tracebuilder/com.nokia.tracebuilder.help/html/images/gold_header.png
trace/tracebuilder/com.nokia.tracebuilder.help/html/images/green_fade_left_68_165_28.png
trace/tracebuilder/com.nokia.tracebuilder.help/html/index.xml
trace/tracebuilder/com.nokia.tracebuilder.help/html/legal.htm
trace/tracebuilder/com.nokia.tracebuilder.help/html/reference/images/Thumbs.db
trace/tracebuilder/com.nokia.tracebuilder.help/html/reference/images/iconaddenum.gif
trace/tracebuilder/com.nokia.tracebuilder.help/html/reference/images/iconaddparameter.gif
trace/tracebuilder/com.nokia.tracebuilder.help/html/reference/images/iconaddtrace.gif
trace/tracebuilder/com.nokia.tracebuilder.help/html/reference/images/icondelete.gif
trace/tracebuilder/com.nokia.tracebuilder.help/html/reference/images/icondeletetraces.gif
trace/tracebuilder/com.nokia.tracebuilder.help/html/reference/images/iconinserttrace.gif
trace/tracebuilder/com.nokia.tracebuilder.help/html/reference/images/iconinstrumentcode.gif
trace/tracebuilder/com.nokia.tracebuilder.help/html/reference/images/iconparseenum.gif
trace/tracebuilder/com.nokia.tracebuilder.help/html/reference/images/icontraceproperties.gif
trace/tracebuilder/com.nokia.tracebuilder.help/html/reference/images/menubar.png
trace/tracebuilder/com.nokia.tracebuilder.help/html/reference/menubar.htm
trace/tracebuilder/com.nokia.tracebuilder.help/html/reference/nonsourcefiles.htm
trace/tracebuilder/com.nokia.tracebuilder.help/html/reference/references.htm
trace/tracebuilder/com.nokia.tracebuilder.help/html/release_notes.htm
trace/tracebuilder/com.nokia.tracebuilder.help/html/tasks/addingparameters.htm
trace/tracebuilder/com.nokia.tracebuilder.help/html/tasks/addingtraces.htm
trace/tracebuilder/com.nokia.tracebuilder.help/html/tasks/converting.htm
trace/tracebuilder/com.nokia.tracebuilder.help/html/tasks/deletingtraces.htm
trace/tracebuilder/com.nokia.tracebuilder.help/html/tasks/enumerations.htm
trace/tracebuilder/com.nokia.tracebuilder.help/html/tasks/images/add_parameter.png
trace/tracebuilder/com.nokia.tracebuilder.help/html/tasks/images/add_trace.png
trace/tracebuilder/com.nokia.tracebuilder.help/html/tasks/images/converttrace.png
trace/tracebuilder/com.nokia.tracebuilder.help/html/tasks/images/enumeration.png
trace/tracebuilder/com.nokia.tracebuilder.help/html/tasks/images/enumerationparsed.png
trace/tracebuilder/com.nokia.tracebuilder.help/html/tasks/images/ost_code.png
trace/tracebuilder/com.nokia.tracebuilder.help/html/tasks/images/ost_code_2.png
trace/tracebuilder/com.nokia.tracebuilder.help/html/tasks/instrumenting.htm
trace/tracebuilder/com.nokia.tracebuilder.help/html/tasks/preferences.htm
trace/tracebuilder/com.nokia.tracebuilder.help/html/tasks/setprojectandcompile.htm
trace/tracebuilder/com.nokia.tracebuilder.help/html/tasks/tasks.htm
trace/tracebuilder/com.nokia.tracebuilder.help/html/tocConcepts.xml
trace/tracebuilder/com.nokia.tracebuilder.help/html/tocGettingStarted.xml
trace/tracebuilder/com.nokia.tracebuilder.help/html/tocReference.xml
trace/tracebuilder/com.nokia.tracebuilder.help/html/tocTasks.xml
trace/tracebuilder/com.nokia.tracebuilder.help/html/tool.htm
trace/tracebuilder/com.nokia.tracebuilder.help/html/toolTOC.xml
trace/tracebuilder/com.nokia.tracebuilder.help/plugin.xml
trace/tracebuilder/com.nokia.tracebuilder.view/.classpath
trace/tracebuilder/com.nokia.tracebuilder.view/.settings/org.eclipse.core.resources.prefs
trace/tracebuilder/com.nokia.tracebuilder.view/.settings/org.eclipse.jdt.core.prefs
trace/tracebuilder/com.nokia.tracebuilder.view/META-INF/MANIFEST.MF
trace/tracebuilder/com.nokia.tracebuilder.view/about.html
trace/tracebuilder/com.nokia.tracebuilder.view/build.properties
trace/tracebuilder/com.nokia.tracebuilder.view/icons/actions/add_constant.gif
trace/tracebuilder/com.nokia.tracebuilder.view/icons/actions/add_enum.gif
trace/tracebuilder/com.nokia.tracebuilder.view/icons/actions/add_parameter.gif
trace/tracebuilder/com.nokia.tracebuilder.view/icons/actions/add_trace.gif
trace/tracebuilder/com.nokia.tracebuilder.view/icons/actions/convert_trace.gif
trace/tracebuilder/com.nokia.tracebuilder.view/icons/actions/delete.gif
trace/tracebuilder/com.nokia.tracebuilder.view/icons/actions/delete_traces.gif
trace/tracebuilder/com.nokia.tracebuilder.view/icons/actions/edit_properties.gif
trace/tracebuilder/com.nokia.tracebuilder.view/icons/actions/editor_link.gif
trace/tracebuilder/com.nokia.tracebuilder.view/icons/actions/export_project.gif
trace/tracebuilder/com.nokia.tracebuilder.view/icons/actions/help.gif
trace/tracebuilder/com.nokia.tracebuilder.view/icons/actions/import_project.gif
trace/tracebuilder/com.nokia.tracebuilder.view/icons/actions/insert_trace.gif
trace/tracebuilder/com.nokia.tracebuilder.view/icons/actions/instrumenter.gif
trace/tracebuilder/com.nokia.tracebuilder.view/icons/actions/open_source.gif
trace/tracebuilder/com.nokia.tracebuilder.view/icons/actions/parse_enum.gif
trace/tracebuilder/com.nokia.tracebuilder.view/icons/actions/remove_trace.gif
trace/tracebuilder/com.nokia.tracebuilder.view/icons/actions/remove_unrelated.gif
trace/tracebuilder/com.nokia.tracebuilder.view/icons/actions/save_project.gif
trace/tracebuilder/com.nokia.tracebuilder.view/icons/view/default.gif
trace/tracebuilder/com.nokia.tracebuilder.view/icons/view/group.gif
trace/tracebuilder/com.nokia.tracebuilder.view/icons/view/navigator.gif
trace/tracebuilder/com.nokia.tracebuilder.view/icons/view/parameter.gif
trace/tracebuilder/com.nokia.tracebuilder.view/icons/view/property.gif
trace/tracebuilder/com.nokia.tracebuilder.view/icons/view/trace.gif
trace/tracebuilder/com.nokia.tracebuilder.view/icons/view/tracebuilder.gif
trace/tracebuilder/com.nokia.tracebuilder.view/icons/view/unrelated_location.gif
trace/tracebuilder/com.nokia.tracebuilder.view/icons/view/unrelated_locations_list.gif
trace/tracebuilder/com.nokia.tracebuilder.view/plugin.properties
trace/tracebuilder/com.nokia.tracebuilder.view/plugin.xml
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/ActionFactory.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/ActionIDs.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/AddConstantAction.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/AddConstantGlobalAction.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/AddParameterAction.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/AddParameterGlobalAction.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/AddTraceAction.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/AddTraceFromEditor.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/AddTraceGlobalAction.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/ConvertTraceAction.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/ConvertTraceGlobalAction.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/DeleteAction.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/DeleteGlobalAction.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/DeleteTracesAction.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/DeleteTracesGlobalAction.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/EditPropertiesAction.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/EditPropertiesGlobalAction.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/FocusGlobalAction.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/InstrumentAction.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/InstrumentGlobalAction.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/Messages.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/OpenSourceAction.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/ParseEnumAction.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/ParseEnumGlobalAction.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/RemoveSourceAction.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/RemoveUnrelatedAction.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/ToolbarShortcutAction.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/TraceBuilderAction.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/TraceBuilderEditorAction.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/TraceBuilderGlobalAction.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/TraceViewActionProvider.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/TraceViewActions.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/messages.properties
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/package.html
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/preferences/ConfigurationImpl.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/preferences/GeneralPreferencePage.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/preferences/Messages.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/preferences/PreferenceInitializer.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/preferences/TraceBuilderConfigurationDefaults.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/preferences/messages.properties
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/preferences/package.html
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/CheckListCheckStateListener.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/CheckListSelectionDialog.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/CheckListSelectionDialogContentProvider.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/CheckListSelectionDialogLabelProvider.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/ConstantTableEntryWrapper.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/ConstantTableListWrapper.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/ConstantTableWrapper.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/LastKnownLocationListWrapper.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/LastKnownLocationWrapper.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/ListNavigator.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/ListNavigatorActionProvider.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/ListWrapper.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/MessageDialogRunnable.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/Messages.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/ObjectWrapper.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/PropertyDialog.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/PropertyDialogComposite.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/PropertyDialogProperties.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/PropertyDialogUI.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/PropertyDialogUIChangeCallback.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/PropertyDialogUIID.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/PropertyDialogUIName.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/PropertyDialogUITarget.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/PropertyDialogUITemplate.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/PropertyDialogUIType.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/PropertyDialogUIValue.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/PropertyWrapper.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TemplateComboSelectionListener.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceContentProvider.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceGroupListWrapper.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceGroupWrapper.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceLabelProvider.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceListWrapper.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceLocationListWrapper.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceLocationListsWrapper.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceLocationWrapper.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceModelWrapper.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceNameSorter.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceObjectListWrapper.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceObjectWrapper.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceParameterListWrapper.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceParameterWrapper.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceView.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceViewDialogs.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceViewExtensionWrapper.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceViewHelp.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceViewHelpListener.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceViewMessages.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceViewPlugin.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceViewSelectionListener.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceViewTreeListener.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceViewUpdater.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceViewUpdaterRunnable.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceWrapper.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/WrapperBase.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/WrapperUpdater.java
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/messages.properties
trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/package.html
trace/tracebuilder/com.nokia.tracebuilder/.classpath
trace/tracebuilder/com.nokia.tracebuilder/.settings/org.eclipse.core.resources.prefs
trace/tracebuilder/com.nokia.tracebuilder/.settings/org.eclipse.jdt.core.prefs
trace/tracebuilder/com.nokia.tracebuilder/META-INF/MANIFEST.MF
trace/tracebuilder/com.nokia.tracebuilder/about.html
trace/tracebuilder/com.nokia.tracebuilder/about.ini
trace/tracebuilder/com.nokia.tracebuilder/about.mappings
trace/tracebuilder/com.nokia.tracebuilder/about.properties
trace/tracebuilder/com.nokia.tracebuilder/build.properties
trace/tracebuilder/com.nokia.tracebuilder/plugin.properties
trace/tracebuilder/com.nokia.tracebuilder/plugin.xml
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/TracebuilderPlugin.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/ActionsAdapter.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/CheckListDialogEntry.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/ConfigurationDelegate.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/DialogsAdapter.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/LastKnownLocation.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/LastKnownLocationList.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/LastKnownLocationListListener.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/LocationListBase.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/LocationMapModelListener.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/LocationProperties.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/Messages.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/PropertyDialogAdapter.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/SoftwareComponent.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/SourceContextManager.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/SourceContextManagerImpl.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceBuilder.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceBuilderActions.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceBuilderConfiguration.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceBuilderConfigurationListener.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceBuilderDialogs.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceBuilderEngine.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceBuilderErrorCodes.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceBuilderErrorMessages.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceBuilderEvents.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceBuilderGlobals.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceBuilderHelp.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceBuilderInterface.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceBuilderView.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceGroupPropertyDialogTemplate.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceLocation.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceLocationConverter.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceLocationList.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceLocationListListener.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceLocationListener.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceLocationMap.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceLocationProperties.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceObjectPropertyDialog.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceObjectPropertyDialogConfiguration.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceObjectPropertyDialogDynamicFlag.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceObjectPropertyDialogEnabler.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceObjectPropertyDialogFlag.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceObjectPropertyDialogTemplate.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceObjectPropertyDialogVerifier.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceParameterPropertyDialogDynamicFlag.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceParameterPropertyDialogTemplate.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceProjectMonitorInterface.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TracePropertyDialogTemplate.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceViewExtension.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceViewNameExtension.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/ViewAdapter.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/event/EventEngine.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/event/EventManagerProcessingListener.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/event/package.html
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/messages.properties
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/package.html
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/plugin/PluginEngine.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/plugin/PluginTracePropertyVerifier.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/plugin/TraceAPIPluginManager.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/plugin/package.html
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/project/Messages.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/project/ProjectEngine.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/project/TraceBuilderProject.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/project/messages.properties
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/project/package.html
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/ContextBasedTemplate.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/CreateConstantCallback.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/CreateConstantTableCallback.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/CreateGroupCallback.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/CreateParameterCallback.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/CreateTraceCallback.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/DeleteConstantCallback.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/DeleteConstantTableCallback.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/DeleteGroupCallback.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/DeleteMultipleTracesCallback.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/DeleteObjectCallback.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/DeleteParameterCallback.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/DeleteTraceCallback.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/DeleteTraceFromSourceCallback.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/InstrumentationEngine.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/InstrumentedTraceRule.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/Messages.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/PropertyDialogCallback.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/PropertyDialogConfigurationNames.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/PropertyDialogEnabler.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/PropertyDialogEngine.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/PropertyDialogEngineCallback.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/PropertyDialogVerifier.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/RunInstrumenterCallback.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/SelectComponentCallback.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/UpdateConstantCallback.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/UpdateConstantTableCallback.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/UpdateGroupCallback.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/UpdateTraceCallback.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/messages.properties
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/package.html
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertyfile/ComponentElementParser.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertyfile/DocumentElementWrapper.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertyfile/EnumElementParser.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertyfile/FileElementParser.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertyfile/GroupElementParser.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertyfile/Messages.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertyfile/ObjectElementParser.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertyfile/PropertyElementParser.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertyfile/PropertyFileConstants.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertyfile/PropertyFileElementParser.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertyfile/PropertyFileEngine.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertyfile/PropertyFileParser.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertyfile/PropertyFileUtils.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertyfile/TraceElementParser.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertyfile/TraceObjectPropertyImpl.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertyfile/TraceObjectPropertyListImpl.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertyfile/TracePropertyFile.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertyfile/ValueElementParser.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertyfile/messages.properties
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/AddFunctionParametersFlag.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/AddMatchingTraceFlag.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/AddReturnParameterFlag.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/AddThisPtrFlag.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/ArrayParameterFlag.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/ArrayParameterRuleImpl.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/AutoAddFunctionParametersRule.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/AutoAddMatchingTraceRule.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/AutoAddParameterRuleBase.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/AutoAddReturnParameterRule.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/AutoAddThisPtrRule.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/AutomaticTraceTextRule.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/ClassNameWrapper.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/ComplexHeaderRule.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/ComplexHeaderRuleImpl.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/ContextTemplateBase.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/CopyAndRemoveExtensionRule.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/CopyExtensionRule.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/DialogDynamicFlagBase.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/DialogFlagBase.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/EndOfFunctionLocationRule.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/EntryExitInstrumenterTemplate.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/EntryExitTraceTemplate.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/EntryTraceRule.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/ExitTracePropertyBuilder.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/ExitTraceRule.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/ExtensionBase.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/FillerParameterRuleImpl.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/FunctionReturnLocationRule.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/InstrumentedTraceRuleImpl.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/InstrumenterTemplateBase.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/Messages.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/ParameterTypeMappingRule.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/PerformanceEventRuleBase.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/PerformanceEventStartRule.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/PerformanceEventStopRule.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/PerformanceEventTemplate.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/PluginTraceFormatRuleDelegate.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/PropertyDialogConfiguration.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/ReadOnlyObjectRuleImpl.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/RuleBase.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/RuleUtils.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/RulesEngine.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/RulesEngineConfigurationListener.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/RulesEngineConstants.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/RulesEngineModelListener.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/RulesEnginePluginManager.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/RulesEngineResetListener.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/SourceParserRuleBase.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/StartOfFunctionLocationRule.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/StateTraceRule.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/StateTraceTemplate.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/ThisPointerParameterTemplate.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/TraceFormatRuleBase.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/TraceParameterFormattingRuleBase.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/messages.properties
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/osttrace/OstConstants.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/osttrace/OstTraceFormatRule.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/osttrace/OstTraceParserRule.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/osttrace/package.html
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/package.html
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/plugin/PluginTraceFormatRule.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/plugin/PluginTraceParserRule.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/plugin/package.html
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/printf/Messages.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/printf/PrintfExtensionParserRule.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/printf/PrintfTraceParserRule.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/printf/messages.properties
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/printf/package.html
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/source/IncludeStatementAdder.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/source/Messages.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/source/SourceEditorUpdateQueue.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/source/SourceEditorUpdater.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/source/SourceEngine.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/source/SourceEngineModelExtensionListener.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/source/SourceEngineModelListener.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/source/SourceFormatter.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/source/SourceListener.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/source/SourceLocationRule.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/source/SourceParserResult.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/source/SourceParserRule.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/source/SourceProperties.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/source/TraceFormattingRule.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/source/TraceLocationCreator.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/source/TraceLocationRemover.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/source/TraceLocationUpdateWriter.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/source/TraceLocationWriter.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/source/TraceParameterFormattingRule.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/source/messages.properties
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/source/package.html
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/utils/TraceMultiplierRule.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/utils/TraceUtils.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/utils/package.html
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/file/FileUtils.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/DuplicateConstantNameModifier.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/DuplicateConstantTableNameModifier.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/DuplicateGroupNameModifier.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/DuplicateParameterNameModifier.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/DuplicateTraceNameModifier.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/DuplicateValueModifier.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/Trace.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceBuilderErrorParameters.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceBuilderException.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceConstantTable.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceConstantTableEntry.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceGroup.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceModel.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceModelExtension.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceModelExtensionListener.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceModelExtensionUpdateListener.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceModelListener.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceModelPersistentExtension.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceModelResetListener.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceModelUpdatableExtension.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceObject.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceObjectFactory.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceObjectModifier.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceObjectProperty.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceObjectPropertyList.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceObjectPropertyVerifier.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceObjectRule.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceObjectRuleCreateObject.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceObjectRuleFactory.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceObjectRuleOnDelete.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceObjectRuleRemoveOnCreate.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceObjectUtils.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceParameter.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceProcessingListener.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/package.html
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/package.html
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/plugin/TraceAPIFormatter.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/plugin/TraceAPIParser.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/plugin/TraceAPIPlugin.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/plugin/TraceBuilderExport.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/plugin/TraceBuilderImport.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/plugin/TraceBuilderPlugin.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/plugin/TraceFormatConstants.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/plugin/TraceHeaderContribution.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/plugin/package.html
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/project/FormattingUtils.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/project/GroupNameHandlerBase.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/project/GroupNameHandlerOSTv1.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/project/GroupNameHandlerOSTv2.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/project/Messages.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/project/ProjectFileParser.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/project/ProjectUtils.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/project/PropertyNames.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/project/TraceLocationParser.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/project/TraceProjectAPI.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/project/TraceProjectAPIList.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/project/TraceProjectFile.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/project/messages.properties
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/project/package.html
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/rules/ArrayParameterRule.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/rules/FillerParameterRule.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/rules/HiddenTraceObjectRule.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/rules/ReadOnlyObjectRule.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/rules/SingletonParameterRule.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/rules/TraceParameterRestrictionRule.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/rules/package.html
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/ContextAreaParser.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/ContextSearchData.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/EnumSearchData.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/ExcludedAreaParser.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/ExcludedAreaSearchData.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/FormatMapping.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/FunctionReturnValueParser.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/FunctionReturnValueSearchData.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/OffsetLength.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/ParsedType.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/PositionArrayComparator.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/PreprocessorDefinitionParser.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceConstants.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceContext.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceDocumentFactory.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceDocumentInterface.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceDocumentMonitor.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceDocumentProcessor.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceEditor.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceErrorCodes.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceExcludedArea.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceInclude.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceIterator.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceLocation.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceLocationBase.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceLocationInterface.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceLocationListener.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceParameter.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceParameterTokenizer.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceParser.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceParserException.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourcePreprocessorDefinition.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourcePropertyProvider.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceReturn.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceSearch.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceSelector.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceStringSearch.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceUtils.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/StringValuePair.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SymbianConstants.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/TokenizerSearchData.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/TypeMapping.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/TypedefParser.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/package.html
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/utils/ConsoleBase.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/utils/ConsoleFactory.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/utils/DocumentAdapter.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/utils/DocumentFactory.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/utils/DocumentFactoryBase.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/utils/DocumentMonitorBase.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/utils/SimpleLocation.java
trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/utils/package.html
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.carbide.extensions.tracebuilder/build.properties	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,2 @@
+bin.includes = feature.xml,\
+               license.htm
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.carbide.extensions.tracebuilder/feature.xml	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+      id="com.nokia.carbide.extensions.tracebuilder"
+      label="Carbide.c++ Extensions - Trace Builder"
+      version="2.4.0"
+      provider-name="Nokia"
+      plugin="com.nokia.tracebuilder">
+
+   <description>
+      Trace Builder is used for adding traces to the source code.
+   </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 the License "Eclipse Public License v1.0" 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"/>
+   </url>
+
+   <requires>
+      <import plugin="org.eclipse.core.runtime"/>
+      <import plugin="com.nokia.trace.eventrouter"/>
+      <import plugin="org.eclipse.ui"/>
+      <import plugin="com.nokia.trace.dictionary"/>
+      <import plugin="org.eclipse.core.resources"/>
+      <import plugin="org.eclipse.ui.ide"/>
+      <import plugin="org.eclipse.ui.workbench.texteditor"/>
+      <import plugin="org.eclipse.ui.console"/>
+      <import plugin="org.eclipse.jface.text"/>
+      <import plugin="com.nokia.trace.eventview"/>
+      <import feature="com.nokia.carbide.extensions.traceviewer" version="2.6.0" match="greaterOrEqual"/>
+   </requires>
+
+   <plugin
+         id="com.nokia.tracebuilder"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+
+
+   <plugin
+         id="com.nokia.tracebuilder.eclipse"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+
+   <plugin
+         id="com.nokia.tracebuilder.eventhandler"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+
+   <plugin
+         id="com.nokia.tracebuilder.help"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+
+   <plugin
+         id="com.nokia.tracebuilder.view"
+         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/tracebuilder/com.nokia.carbide.extensions.tracebuilder/license.htm	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,14 @@
+<h2>Carbide.c++ Extensions - TraceBuilder 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 the License "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/tracebuilder/com.nokia.tracebuilder.eclipse/.classpath	Wed Jun 23 14:35:40 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/tracebuilder/com.nokia.tracebuilder.eclipse/.settings/org.eclipse.jdt.core.prefs	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,8 @@
+#Mon Oct 05 11:26:02 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/tracebuilder/com.nokia.tracebuilder.eclipse/META-INF/MANIFEST.MF	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,21 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: TraceBuilder Eclipse Dependencies
+Bundle-SymbolicName: com.nokia.tracebuilder.eclipse;singleton:=true
+Bundle-Version: 2.4.0
+Bundle-Activator: com.nokia.tracebuilder.eclipse.Activator
+Bundle-Vendor: Nokia
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.eclipse.ui,
+ org.eclipse.ui.ide,
+ org.eclipse.ui.workbench.texteditor,
+ org.eclipse.ui.console,
+ org.eclipse.jface.text,
+ com.nokia.tracebuilder,
+ com.nokia.carbide.cdt.builder,
+ com.nokia.carbide.cpp.sdk.core,
+ com.nokia.carbide.cpp.epoc.engine
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.eclipse/about.html	Wed Jun 23 14:35:40 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 9, 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 the License "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/tracebuilder/com.nokia.tracebuilder.eclipse/build.properties	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .,\
+               plugin.xml,\
+               about.html
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.eclipse/plugin.xml	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+   <extension
+         point="org.eclipse.ui.startup">
+      <startup
+            class="com.nokia.tracebuilder.eclipse.PluginStartup">
+      </startup>
+   </extension>
+
+</plugin>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.eclipse/src/com/nokia/tracebuilder/eclipse/Activator.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,77 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 main plugin class
+*
+*/
+package com.nokia.tracebuilder.eclipse;
+
+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.tracebuilder.eclipse"; //$NON-NLS-1$
+
+	/**
+	 * The shared instance
+	 */
+	private static Activator plugin;
+
+	/**
+	 * The constructor
+	 */
+	public Activator() {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+	 */
+	@Override
+	public void start(BundleContext context) throws Exception {
+		super.start(context);
+		plugin = this;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+	 */
+	@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/tracebuilder/com.nokia.tracebuilder.eclipse/src/com/nokia/tracebuilder/eclipse/EclipseConsole.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Eclipse message console
+*
+*/
+package com.nokia.tracebuilder.eclipse;
+
+import java.io.OutputStream;
+
+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 com.nokia.tracebuilder.utils.ConsoleBase;
+
+/**
+ * Eclipse message console
+ * 
+ */
+public final class EclipseConsole extends ConsoleBase {
+
+	/**
+	 * Creates a console stream
+	 * 
+	 * @return the stream
+	 */
+	@Override
+	protected OutputStream createStream() {
+		IConsoleManager manager = ConsolePlugin.getDefault()
+				.getConsoleManager();
+		MessageConsole console = null;
+		IConsole[] consoles = manager.getConsoles();
+		for (IConsole c : consoles) {
+			if (c instanceof MessageConsole && getTitle().equals(c.getName())) {
+				console = (MessageConsole) c;
+				break;
+			}
+		}
+		if (console == null) {
+			console = new MessageConsole(getTitle(), null);
+			manager.addConsoles(new IConsole[] { console });
+		} else {
+			console.clearConsole();
+		}
+		manager.showConsoleView(console);
+		return console.newOutputStream();
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.eclipse/src/com/nokia/tracebuilder/eclipse/JFaceDirtyStateListener.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Dirty state change notification
+*
+*/
+package com.nokia.tracebuilder.eclipse;
+
+import org.eclipse.ui.IPropertyListener;
+import org.eclipse.ui.IWorkbenchPartConstants;
+
+/**
+ * Dirty state change notification
+ * 
+ */
+final class JFaceDirtyStateListener implements IPropertyListener {
+
+	/**
+	 * Workbench monitor
+	 */
+	private WorkbenchEditorMonitor monitor;
+
+	/**
+	 * Source to be monitored
+	 */
+	private JFaceDocumentWrapper source;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param monitor
+	 *            the workbench monitor
+	 * @param source
+	 *            source to be monitored
+	 */
+	JFaceDirtyStateListener(WorkbenchEditorMonitor monitor,
+			JFaceDocumentWrapper source) {
+		this.monitor = monitor;
+		this.source = source;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ui.IPropertyListener#propertyChanged(java.lang.Object,
+	 *      int)
+	 */
+	public void propertyChanged(Object obj, int propId) {
+		if (propId == IWorkbenchPartConstants.PROP_DIRTY) {
+			if (!source.getTextEditor().isDirty()) {
+				monitor.sourceSaved(source);
+			}
+		}
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.eclipse/src/com/nokia/tracebuilder/eclipse/JFaceDocumentFactory.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Factory implementation for JFace
+*
+*/
+package com.nokia.tracebuilder.eclipse;
+
+import org.eclipse.jface.text.Document;
+
+import com.nokia.tracebuilder.source.SourceDocumentInterface;
+import com.nokia.tracebuilder.source.SourceLocationBase;
+import com.nokia.tracebuilder.source.SourceLocationInterface;
+import com.nokia.tracebuilder.utils.DocumentFactoryBase;
+
+/**
+ * Factory implementation for JFace
+ * 
+ */
+public final class JFaceDocumentFactory extends DocumentFactoryBase {
+
+	/**
+	 * Constructor for reflection
+	 */
+	JFaceDocumentFactory() {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.utils.DocumentFactoryAdapter#
+	 *      createDocument(java.lang.String)
+	 */
+	@Override
+	public SourceDocumentInterface createDocument(String sourceData) {
+		// When created via factory, the document is not associated with
+		// document monitor
+		return new JFaceDocumentWrapper(new Document(sourceData));
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.utils.DocumentFactoryAdapter#
+	 *      createLocation(com.nokia.tracebuilder.source.SourceLocationBase,
+	 *      int, int)
+	 */
+	@Override
+	public SourceLocationInterface createLocation(SourceLocationBase base,
+			int offset, int length) {
+		return new JFaceLocationWrapper(base, offset, length);
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.eclipse/src/com/nokia/tracebuilder/eclipse/JFaceDocumentWrapper.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,410 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Wrapper for JFace IDocument
+*
+*/
+package com.nokia.tracebuilder.eclipse;
+
+import java.io.File;
+
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.BadPositionCategoryException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.texteditor.ITextEditor;
+
+import com.nokia.tracebuilder.engine.TraceBuilderConfiguration;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceLocation;
+import com.nokia.tracebuilder.source.SourceDocumentInterface;
+import com.nokia.tracebuilder.source.SourceErrorCodes;
+import com.nokia.tracebuilder.source.SourceLocationBase;
+import com.nokia.tracebuilder.source.SourceLocationInterface;
+import com.nokia.tracebuilder.source.SourceParserException;
+import com.nokia.tracebuilder.source.SourcePropertyProvider;
+import com.nokia.tracebuilder.source.SourceSelector;
+
+/**
+ * Wrapper for JFace IDocument and Eclipse ITextEditor
+ * 
+ */
+final class JFaceDocumentWrapper implements SourceDocumentInterface,
+		SourceSelector, SourcePropertyProvider {
+
+	/**
+	 * Document position category
+	 */
+	public static final String TRACEBUILDER_POSITION_CATEGORY = "TraceBuilder.positions"; //$NON-NLS-1$
+
+	/**
+	 * Document
+	 */
+	private IDocument document;
+
+	/**
+	 * Text editor for the document, may be null
+	 */
+	private ITextEditor textEditor;
+
+	/**
+	 * Selection listener for the editor
+	 */
+	private JFaceSelectionListener selectionListener;
+
+	/**
+	 * Change listener for the editor
+	 */
+	private JFaceSourceChangeListener changeListener;
+
+	/**
+	 * Save listener
+	 */
+	private JFaceDirtyStateListener saveListener;
+
+	/**
+	 * Location updater
+	 */
+	private JFaceLocationUpdater locationUpdater;
+
+	/**
+	 * Owner of this source
+	 */
+	private Object owner;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param document
+	 *            the document
+	 */
+	JFaceDocumentWrapper(IDocument document) {
+		this.document = document;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceDocumentInterface#get(int, int)
+	 */
+	public String get(int start, int length) throws SourceParserException {
+		try {
+			return document.get(start, length);
+		} catch (BadLocationException e) {
+			throw new SourceParserException(SourceErrorCodes.BAD_LOCATION);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceDocumentInterface#getChar(int)
+	 */
+	public char getChar(int offset) throws SourceParserException {
+		try {
+			return document.getChar(offset);
+		} catch (BadLocationException e) {
+			throw new SourceParserException(SourceErrorCodes.BAD_LOCATION);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceDocumentInterface#getLength()
+	 */
+	public int getLength() {
+		return document.getLength();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceDocumentInterface#getLineOfOffset(int)
+	 */
+	public int getLineOfOffset(int offset) throws SourceParserException {
+		try {
+			return document.getLineOfOffset(offset);
+		} catch (BadLocationException e) {
+			throw new SourceParserException(SourceErrorCodes.BAD_LOCATION);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceDocumentInterface#replace(int,
+	 *      int, java.lang.String)
+	 */
+	public void replace(int offset, int length, String newText)
+			throws SourceParserException {
+		try {
+			document.replace(offset, length, newText);
+		} catch (BadLocationException e) {
+			throw new SourceParserException(SourceErrorCodes.BAD_LOCATION);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceDocumentInterface#getPropertyProvider()
+	 */
+	public SourcePropertyProvider getPropertyProvider() {
+		return this;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceDocumentInterface#getSourceSelector()
+	 */
+	public SourceSelector getSourceSelector() {
+		return this;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceSelector#setSelection(int, int)
+	 */
+	public void setSelection(int offset, int length) {
+		if (textEditor != null) {
+			textEditor.getEditorSite().getPage().bringToTop(textEditor);
+			textEditor.selectAndReveal(offset, length);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourcePropertyProvider#getFileName()
+	 */
+	public String getFileName() {
+		String retval = null;
+		if (textEditor != null) {
+			IEditorInput input = textEditor.getEditorInput();
+			String path = WorkbenchUtils.getEditorInputPath(input);
+			if (path != null) {
+				retval = new File(path).getName();
+			}
+		}
+		return retval;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourcePropertyProvider#getFilePath()
+	 */
+	public String getFilePath() {
+		String retval = null;
+		if (textEditor != null) {
+			IEditorInput input = textEditor.getEditorInput();
+			String path = WorkbenchUtils.getEditorInputPath(input);
+			if (path != null) {
+				retval = new File(path).getParent();
+			}
+		}
+		if (retval != null && !retval.endsWith(File.separator)) {
+			retval += File.separator;
+		}
+		return retval;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceDocumentInterface#
+	 *      addLocation(com.nokia.tracebuilder.source.SourceLocationInterface)
+	 */
+	public void addLocation(SourceLocationInterface location) {
+		String category = getLocationCategory(((JFaceLocationWrapper) location)
+				.getLocation());
+		try {
+			if (category == null) {
+				document.addPosition((JFaceLocationWrapper) location);
+			} else {
+				document.addPosition(category, (JFaceLocationWrapper) location);
+			}
+		} catch (Exception e) {
+			if (TraceBuilderConfiguration.ASSERTIONS_ENABLED) {
+				TraceBuilderGlobals.getEvents().postCriticalAssertionFailed(
+						"Failed to add location", e); //$NON-NLS-1$
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceDocumentInterface#
+	 *      removeLocation(com.nokia.tracebuilder.source.SourceLocationInterface)
+	 */
+	public void removeLocation(SourceLocationInterface location) {
+		String category = getLocationCategory(((JFaceLocationWrapper) location)
+				.getLocation());
+		if (category == null) {
+			document.removePosition((JFaceLocationWrapper) location);
+		} else {
+			try {
+				document.removePosition(category,
+						(JFaceLocationWrapper) location);
+			} catch (Exception e) {
+				if (TraceBuilderConfiguration.ASSERTIONS_ENABLED) {
+					TraceBuilderGlobals.getEvents()
+							.postCriticalAssertionFailed(
+									"Failed to remove location", e); //$NON-NLS-1$
+				}
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceDocumentInterface#getOwner()
+	 */
+	public Object getOwner() {
+		return owner;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceDocumentInterface#setOwner(java.lang.Object)
+	 */
+	public void setOwner(Object owner) {
+		this.owner = owner;
+	}
+
+	/**
+	 * Called by the workbench editor monitor to initialize listeners
+	 * 
+	 * @param monitor
+	 *            the workbench monitor
+	 */
+	void sourceOpened(WorkbenchEditorMonitor monitor) {
+		if (monitor != null) {
+			locationUpdater = new JFaceLocationUpdater(
+					TRACEBUILDER_POSITION_CATEGORY);
+			document.addPositionCategory(TRACEBUILDER_POSITION_CATEGORY);
+			document.addPositionUpdater(locationUpdater);
+			if (changeListener == null) {
+				changeListener = new JFaceSourceChangeListener(monitor, this);
+				document.addDocumentListener(changeListener);
+			}
+			if (textEditor != null && selectionListener == null) {
+				selectionListener = new JFaceSelectionListener(monitor, this);
+				textEditor.getSite().getPage().addPostSelectionListener(
+						selectionListener);
+				saveListener = new JFaceDirtyStateListener(monitor, this);
+				textEditor.addPropertyListener(saveListener);
+			}
+		}
+	}
+
+	/**
+	 * Performs cleanup. Called by WorkbenchEditorMonitor when source is removed
+	 */
+	void sourceClosed() {
+		if (textEditor != null) {
+			if (selectionListener != null) {
+				textEditor.getSite().getPage().removePostSelectionListener(
+						selectionListener);
+			}
+			if (saveListener != null) {
+				textEditor.removePropertyListener(saveListener);
+			}
+		}
+		if (changeListener != null) {
+			document.removeDocumentListener(changeListener);
+		}
+		document.removePositionUpdater(locationUpdater);
+		try {
+			document.removePositionCategory(TRACEBUILDER_POSITION_CATEGORY);
+		} catch (BadPositionCategoryException e) {
+			if (TraceBuilderConfiguration.ASSERTIONS_ENABLED) {
+				TraceBuilderGlobals.getEvents().postAssertionFailed(
+						"Failed to remove position updater", e); //$NON-NLS-1$
+			}
+		}
+	}
+
+	/**
+	 * Gets the document
+	 * 
+	 * @return the document
+	 */
+	IDocument getDocument() {
+		return document;
+	}
+
+	/**
+	 * Sets the document
+	 * 
+	 * @param document
+	 *            the new document
+	 */
+	void setDocument(IDocument document) {
+		this.document = document;
+	}
+
+	/**
+	 * Gets the text editor
+	 * 
+	 * @return the text editor
+	 */
+	ITextEditor getTextEditor() {
+		return textEditor;
+	}
+
+	/**
+	 * Sets the text editor
+	 * 
+	 * @param textEditor
+	 *            the new text editor
+	 */
+	void setTextEditor(ITextEditor textEditor) {
+		this.textEditor = textEditor;
+	}
+
+	/**
+	 * Gets the selection listener
+	 * 
+	 * @return the selection listener
+	 */
+	JFaceSelectionListener getSelectionListener() {
+		return selectionListener;
+	}
+
+	/**
+	 * Gets a category for location
+	 * 
+	 * @param location
+	 *            the location
+	 * @return the category
+	 */
+	private String getLocationCategory(SourceLocationBase location) {
+		String retval;
+		if (location instanceof TraceLocation) {
+			retval = TRACEBUILDER_POSITION_CATEGORY;
+		} else {
+			retval = null;
+		}
+		return retval;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.eclipse/src/com/nokia/tracebuilder/eclipse/JFaceLocationUpdater.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,96 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Keeps the TraceLocation objects up-to-date when source document changes
+*
+*/
+package com.nokia.tracebuilder.eclipse;
+
+import org.eclipse.jface.text.DefaultPositionUpdater;
+
+import com.nokia.tracebuilder.engine.TraceLocation;
+
+/**
+ * Keeps the TraceLocation objects up-to-date when source document changes.
+ * 
+ */
+final class JFaceLocationUpdater extends DefaultPositionUpdater {
+
+	/**
+	 * Default constructor
+	 * 
+	 * @param category
+	 *            the position category
+	 */
+	JFaceLocationUpdater(String category) {
+		super(category);
+	}
+
+	/**
+	 * Called when data is removed from the document. If the trace is modified,
+	 * the length of the position is reduced. If the document is modified prior
+	 * the trace, the offset of the position is changed.
+	 * 
+	 * @see org.eclipse.jface.text.DefaultPositionUpdater#adaptToRemove()
+	 */
+	@Override
+	protected void adaptToRemove() {
+		super.adaptToRemove();
+		if (fOriginalPosition.length > fPosition.length) {
+			// If the length changes, the content needs to be re-examined
+			// when updating the view
+			((TraceLocation) ((JFaceLocationWrapper) fPosition).getLocation())
+					.setContentChanged(true);
+		}
+	}
+
+	/**
+	 * Called when data is added to the document. If the trace is modified, the
+	 * length of the position is adjusted. If the document is modified prior the
+	 * trace, the offset of the position is changed.
+	 * 
+	 * @see org.eclipse.jface.text.DefaultPositionUpdater#adaptToInsert()
+	 */
+	@Override
+	protected void adaptToInsert() {
+		super.adaptToInsert();
+		if (fOriginalPosition.length < fPosition.length) {
+			// If the length changes, the content needs to be re-examined
+			// when updating the view
+			((TraceLocation) ((JFaceLocationWrapper) fPosition).getLocation())
+					.setContentChanged(true);
+		}
+	}
+
+	/**
+	 * Sets the changed flag if the position is changed.
+	 * 
+	 * @see org.eclipse.jface.text.DefaultPositionUpdater#adaptToReplace()
+	 */
+	@Override
+	protected void adaptToReplace() {
+		if (fPosition.offset == fOffset && fPosition.length == fLength
+				&& fPosition.length > 0) {
+			// DefaultPositionUpdater does not call adaptToInsert /
+			// adaptToRemove if the entire position is replaced. In that case,
+			// the content needs to be re-examined
+			super.adaptToReplace();
+			((TraceLocation) ((JFaceLocationWrapper) fPosition).getLocation())
+					.setContentChanged(true);
+		} else {
+			super.adaptToReplace();
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.eclipse/src/com/nokia/tracebuilder/eclipse/JFaceLocationWrapper.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Wrapper for SourceLocationBase within JFace Position
+*
+*/
+package com.nokia.tracebuilder.eclipse;
+
+import org.eclipse.jface.text.Position;
+
+import com.nokia.tracebuilder.source.SourceLocationBase;
+import com.nokia.tracebuilder.source.SourceLocationInterface;
+
+/**
+ * Wrapper for JFace Position
+ * 
+ */
+final class JFaceLocationWrapper extends Position implements
+		SourceLocationInterface {
+
+	/**
+	 * Location
+	 */
+	private SourceLocationBase location;
+
+	/**
+	 * Contructor
+	 * 
+	 * @param location
+	 *            the location to be wrapped
+	 * @param offset
+	 *            the location offset
+	 * @param length
+	 *            the location length
+	 */
+	JFaceLocationWrapper(SourceLocationBase location, int offset, int length) {
+		super(offset, length);
+		this.location = location;
+	}
+
+	/**
+	 * Gets the wrapped location
+	 * 
+	 * @return the location
+	 */
+	public SourceLocationBase getLocation() {
+		return location;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.eclipse/src/com/nokia/tracebuilder/eclipse/JFaceSelectionListener.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,87 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Editor selection event listener
+*
+*/
+package com.nokia.tracebuilder.eclipse;
+
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.ISelectionListener;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * Editor selection event listener
+ * 
+ */
+final class JFaceSelectionListener implements ISelectionListener {
+
+	/**
+	 * Workbench monitor
+	 */
+	private WorkbenchEditorMonitor monitor;
+
+	/**
+	 * Source to be monitored
+	 */
+	private JFaceDocumentWrapper source;
+
+	/**
+	 * Flag for disabling next event
+	 */
+	private boolean disableNextSelectionEvent;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param monitor
+	 *            the monitor for callbacks
+	 * @param source
+	 *            the source which is observed
+	 */
+	JFaceSelectionListener(WorkbenchEditorMonitor monitor,
+			JFaceDocumentWrapper source) {
+		this.monitor = monitor;
+		this.source = source;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart,
+	 *      org.eclipse.jface.viewers.ISelection)
+	 */
+	public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+		if (!disableNextSelectionEvent) {
+			if (part == source.getTextEditor()
+					&& selection instanceof ITextSelection) {
+				ITextSelection textSelection = (ITextSelection) selection;
+				monitor.selectionChanged(source, textSelection.getOffset(),
+						textSelection.getLength());
+			}
+		} else {
+			disableNextSelectionEvent = false;
+		}
+	}
+
+	/**
+	 * Disables the next selection event
+	 */
+	void disableNextSelectionEvent() {
+		disableNextSelectionEvent = true;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.eclipse/src/com/nokia/tracebuilder/eclipse/JFaceSourceChangeListener.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Listener interface for source file changes
+*
+*/
+package com.nokia.tracebuilder.eclipse;
+
+import org.eclipse.jface.text.DocumentEvent;
+import org.eclipse.jface.text.IDocumentListener;
+
+import com.nokia.tracebuilder.engine.TraceBuilderConfiguration;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+
+/**
+ * Listener interface for source file changes
+ * 
+ */
+final class JFaceSourceChangeListener implements IDocumentListener {
+
+	/**
+	 * Workbench monitor
+	 */
+	private WorkbenchEditorMonitor monitor;
+
+	/**
+	 * Source to be monitored
+	 */
+	private JFaceDocumentWrapper source;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param monitor
+	 *            the workbench monitor
+	 * @param source
+	 *            the observed source
+	 */
+	JFaceSourceChangeListener(WorkbenchEditorMonitor monitor,
+			JFaceDocumentWrapper source) {
+		this.monitor = monitor;
+		this.source = source;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.text.IDocumentListener#
+	 *      documentAboutToBeChanged(org.eclipse.jface.text.DocumentEvent)
+	 */
+	public void documentAboutToBeChanged(DocumentEvent event) {
+		try {
+			monitor.sourceAboutToBeChanged(source, event.getOffset(), event
+					.getLength(), event.getText());
+		} catch (Exception e) {
+			if (TraceBuilderConfiguration.ASSERTIONS_ENABLED) {
+				TraceBuilderGlobals.getEvents().postCriticalAssertionFailed(
+						"Document change preprocessor failure", e); //$NON-NLS-1$
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.text.IDocumentListener#
+	 *      documentChanged(org.eclipse.jface.text.DocumentEvent)
+	 */
+	public void documentChanged(DocumentEvent event) {
+		try {
+			monitor.sourceChanged(source, event.getOffset(), event.getLength(),
+					event.getText());
+		} catch (Exception e) {
+			if (TraceBuilderConfiguration.ASSERTIONS_ENABLED) {
+				TraceBuilderGlobals.getEvents().postCriticalAssertionFailed(
+						"Document change processor failure", e); //$NON-NLS-1$
+			}
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.eclipse/src/com/nokia/tracebuilder/eclipse/Messages.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 TraceBuilder Eclipse dependency package
+*
+*/
+package com.nokia.tracebuilder.eclipse;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * Localized strings for TraceBuilder Eclipse dependency package
+ * 
+ */
+class Messages {
+
+	/**
+	 * Bundle name
+	 */
+	private static final String BUNDLE_NAME = "com.nokia.tracebuilder.eclipse.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/tracebuilder/com.nokia.tracebuilder.eclipse/src/com/nokia/tracebuilder/eclipse/PluginStartup.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,70 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 plugin startup class
+*
+*/
+package com.nokia.tracebuilder.eclipse;
+
+import org.eclipse.ui.IStartup;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.utils.ConsoleFactory;
+import com.nokia.tracebuilder.utils.DocumentFactory;
+
+/**
+ * The plugin startup class
+ * 
+ */
+public class PluginStartup implements IStartup {
+
+	/**
+	 * Trace project monitor
+	 */
+	private TraceProjectMonitor projectMonitor;
+
+	/**
+	 * Runnable which initializes the project opener
+	 */
+	private final class ProjectOpenerInitRunnable implements Runnable {
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see java.lang.Runnable#run()
+		 */
+		public void run() {
+			if (TraceBuilderGlobals.isViewRegistered()) {
+				projectMonitor.startMonitor();
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ui.IStartup#earlyStartup()
+	 */
+	public void earlyStartup() {
+		projectMonitor = new TraceProjectMonitor();
+		TraceBuilderGlobals.setProjectMonitor(projectMonitor);
+		DocumentFactory.registerDocumentFramework(new WorkbenchEditorMonitor(
+				projectMonitor), JFaceDocumentFactory.class);
+		ConsoleFactory.registerConsole(EclipseConsole.class);
+		PlatformUI.getWorkbench().getDisplay().asyncExec(
+				new ProjectOpenerInitRunnable());
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.eclipse/src/com/nokia/tracebuilder/eclipse/TraceProjectMonitor.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,1893 @@
+/*
+ * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ * Workbench monitor which opens / closes the trace project
+ *
+ */
+package com.nokia.tracebuilder.eclipse;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.DataInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Vector;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspace;
+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.text.Document;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.ui.IEditorReference;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.osgi.framework.Version;
+
+import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin;
+import com.nokia.carbide.cdt.builder.DefaultMMPViewConfiguration;
+import com.nokia.carbide.cdt.builder.EMMPPathContext;
+import com.nokia.carbide.cdt.builder.EpocEngineHelper;
+import com.nokia.carbide.cdt.builder.ICarbideBuildManager;
+import com.nokia.carbide.cdt.builder.InvalidDriveInMMPPathException;
+import com.nokia.carbide.cdt.builder.MMPViewPathHelper;
+import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration;
+import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo;
+import com.nokia.carbide.cpp.epoc.engine.EpocEnginePlugin;
+import com.nokia.carbide.cpp.epoc.engine.MMPDataRunnableAdapter;
+import com.nokia.carbide.cpp.epoc.engine.MMPViewRunnableAdapter;
+import com.nokia.carbide.cpp.epoc.engine.model.mmp.EMMPStatement;
+import com.nokia.carbide.cpp.epoc.engine.model.mmp.IMMPData;
+import com.nokia.carbide.cpp.epoc.engine.model.mmp.IMMPView;
+import com.nokia.carbide.cpp.epoc.engine.preprocessor.AcceptedNodesViewFilter;
+import com.nokia.tracebuilder.engine.TraceBuilderConfiguration;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceBuilderView;
+import com.nokia.tracebuilder.engine.TraceLocationConverter;
+import com.nokia.tracebuilder.engine.TraceLocationMap;
+import com.nokia.tracebuilder.engine.TraceProjectMonitorInterface;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.FileErrorParameters;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.TraceBuilderErrorCode;
+import com.nokia.tracebuilder.engine.project.ProjectEngine;
+import com.nokia.tracebuilder.engine.source.SourceProperties;
+import com.nokia.tracebuilder.file.FileUtils;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.project.GroupNameHandlerBase;
+import com.nokia.tracebuilder.project.GroupNameHandlerOSTv1;
+import com.nokia.tracebuilder.project.GroupNameHandlerOSTv2;
+import com.nokia.tracebuilder.source.SourceConstants;
+import com.nokia.tracebuilder.source.SourceDocumentInterface;
+import com.nokia.tracebuilder.utils.DocumentFactory;
+import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin;
+import com.nokia.carbide.cpp.sdk.core.ISDKManager;
+
+/**
+ * Workbench monitor which opens / closes the trace project
+ * 
+ */
+class TraceProjectMonitor implements WorkbenchListenerCallback,
+		TraceProjectMonitorInterface {
+
+	/**
+	 * OST_INSTRUMENTATION_API_VERSION text
+	 */
+	private static final String OST_INSTRUMENTATION_API_VERSION_TEXT = "OST_INSTRUMENTATION_API_VERSION"; //$NON-NLS-1$
+
+	/**
+	 * Regular expression for OST_INSTRUMENTATION_API_VERSION macro check
+	 */
+	private static final String OST_INSTRUMENTATION_API_VERSION_REGEX = "#define\\s+OST_INSTRUMENTATION_API_VERSION.*"; //$NON-NLS-1$
+
+	/**
+	 * OSTv1 version text
+	 */
+	private static final String OST_VERSION_1_X_X = "1.x.x"; //$NON-NLS-1$
+
+	/**
+	 * OSTv2 version text
+	 */
+	private static final String OST_VERSION_2_X_X = "2.x.x"; //$NON-NLS-1$
+
+	/**
+	 * OpenSystemTrace.h file name
+	 */
+	private static final String OPEN_SYSTEM_TRACE_H = "opensystemtrace.h"; //$NON-NLS-1$
+
+	/**
+	 * epoc32\include\include path as string
+	 */
+	private static final String EPOC32_INCLUDE_INTERNAL = "epoc32" + File.separator + "include" + File.separator + "internal"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+	/**
+	 * epoc32\include\platform path as string
+	 */
+	private static final String EPOC32_INCLUDE_PLATFORM = "epoc32" + File.separator + "include" + File.separator + "platform"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+	/**
+	 * PLATFORM_PATHS.HRH
+	 */
+	private static final String PLATFORM_PATHS_HRH = "PLATFORM_PATHS.HRH"; //$NON-NLS-1$
+
+	/**
+	 * #INCLUDE
+	 */
+	private static final String INCLUDE = "#INCLUDE"; //$NON-NLS-1$
+
+	/**
+	 * Multiline comment start
+	 */
+	private static final String MULTILINE_COMMENT_START = "/*"; //$NON-NLS-1$
+
+	/**
+	 * Comment
+	 */
+	private static final String COMMENT = "//"; //$NON-NLS-1$	
+
+	/**
+	 * Multiline comment end
+	 */
+	private static final String MULTILINE_COMMENT_END = "*/"; //$NON-NLS-1$
+
+	/**
+	 * ncp sw folder name
+	 */
+	private static final String NCP_SW_FOLDER_NAME = "ncp_sw"; //$NON-NLS-1$
+
+	/**
+	 * os folder name
+	 */
+	private static final String OS_FOLDER_NAME = "os"; //$NON-NLS-1$
+
+	/**
+	 * mw folder name
+	 */
+	private static final String MW_FOLDER_NAME = "mw"; //$NON-NLS-1$
+
+	/**
+	 * sf folder name
+	 */
+	private static final String SF_FOLDER_NAME = "sf"; //$NON-NLS-1$
+
+	/**
+	 * platform_paths.hrh include
+	 */
+	private static final String INCLUDE_PLATFORM_PATHS_HRH = "#include \"platform_paths.hrh\""; //$NON-NLS-1$
+
+	/**
+	 * OS layer system include macro
+	 */
+	private static final String OS_LAYER_SYSTEMINCLUDE_MACRO = "OS_LAYER_SYSTEMINCLUDE"; //$NON-NLS-1$
+
+	/**
+	 * MW layer system include macro
+	 */
+	private static final String MW_LAYER_SYSTEMINCLUDE_MACRO = "MW_LAYER_SYSTEMINCLUDE"; //$NON-NLS-1$
+
+	/**
+	 * APP layer system include macro
+	 */
+	private static final String APP_LAYER_SYSTEMINCLUDE_MACRO = "APP_LAYER_SYSTEMINCLUDE"; //$NON-NLS-1$
+
+	/**
+	 * Group directory
+	 */
+	private static final String GROUP_DIRECTORY = "group"; //$NON-NLS-1$	
+
+	/**
+	 * Traces directory
+	 */
+	public static final String TRACES_DIRECTORY = "traces"; //$NON-NLS-1$
+
+	/**
+	 * MmpFiles directory
+	 */
+	private static final String MMPFILES_DIRECTORY = "mmpfiles"; //$NON-NLS-1$
+
+	/**
+	 * Underscore character
+	 */
+	public static final String UNDERSCORE = "_"; //$NON-NLS-1$
+
+	/**
+	 * The workbench listener
+	 */
+	private WorkbenchListener listener;
+
+	/**
+	 * Project path that is currently open
+	 */
+	private String openProjectPath;
+
+	/**
+	 * Project object that is currently open
+	 */
+	private IProject openProjectObject;
+
+	/**
+	 * Trace project include added to MMP files
+	 */
+	private boolean mmpFileModified;
+
+	/**
+	 * Name of the "traces_<component name>" folder
+	 */
+	private String tracesComponentNameFolder;
+
+	/**
+	 * Name of the "traces_<target_name>_<target_type>" folder
+	 */
+	private String tracesTargetNameTargetTypeFolder;
+
+	/**
+	 * Name of the "traces\<target_name>_<target_ext>" folder
+	 */
+	private String tracesDirTargetNameTargetExtFolder;
+
+	/**
+	 * Trace folder name used in SBSv2
+	 */
+	private String sbsv2TraceFolderName;
+
+	/**
+	 * Select software component flag
+	 */
+	private boolean selectSoftwareComponent = true;
+
+	/**
+	 * Select software component check needed flag
+	 */
+	private boolean selectSoftwareComponentCheckNeeded = false;
+
+	/**
+	 * Trace folder changed flag
+	 */
+	private boolean traceFolderChanged = false;
+
+	/**
+	 * Previous file included more than once flag
+	 */
+	private boolean previousFileIncludedMoreThanOnce = false;
+
+	/**
+	 * Editor opened flag
+	 */
+	private boolean editorOpened = false;
+
+	/**
+	 * File object that is currently visible
+	 */
+	IFile openFileObject = null;
+
+	/**
+	 * Trace folder name of the project that is currently visible
+	 */
+	String openProjectTraceFolderName = null;
+
+	/**
+	 * OSTv1 start text
+	 */
+	private static final String OSTV1_START_TEXT = "1."; //$NON-NLS-1$	
+
+	/**
+	 * OSTv2 start text
+	 */
+	private static final String OSTV2_START_TEXT = "2."; //$NON-NLS-1$		
+
+	/**
+	 * Constructor
+	 */
+	TraceProjectMonitor() {
+		listener = new WorkbenchListener(this);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.tracebuilder.eclipse.TraceProjectMonitorInterface#startMonitor
+	 * ()
+	 */
+	public void startMonitor() {
+		listener.startListener();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.tracebuilder.eclipse.TraceProjectMonitorInterface#stopMonitor()
+	 */
+	public void stopMonitor() {
+		listener.stopListener();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.eclipse.WorkbenchListenerCallback#
+	 * editorActivated(org.eclipse.ui.texteditor.ITextEditor,
+	 * org.eclipse.core.resources.IFile)
+	 */
+	public void editorActivated(ITextEditor editor, IFile file) {
+		TraceBuilderView view = TraceBuilderGlobals.getView();
+		view.refresh();
+		if (editorOpened) {
+			view.expandTraceGroupsBranch();
+			editorOpened = false;
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.eclipse.WorkbenchListenerCallback#
+	 * editorClosed(org.eclipse.ui.texteditor.ITextEditor,
+	 * org.eclipse.core.resources.IFile)
+	 */
+	public void editorClosed(ITextEditor editor, IFile file) {
+		if (!WorkbenchUtils.isEditorsOpen()) {
+			if (openProjectPath != null) {
+				TraceBuilderGlobals.getTraceBuilder().closeProject();
+				openProjectPath = null;
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.eclipse.WorkbenchListenerCallback#
+	 * editorOpened(org.eclipse.ui.texteditor.ITextEditor,
+	 * org.eclipse.core.resources.IFile)
+	 */
+	public void editorOpened(ITextEditor editor, IFile file) {
+		openFileObject = file;
+		updateProject(file);
+		editorOpened = true;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.eclipse.WorkbenchListenerCallback#
+	 * editorHidden(org.eclipse.ui.texteditor.ITextEditor,
+	 * org.eclipse.core.resources.IFile)
+	 */
+	public void editorHidden(ITextEditor editor, IFile file) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.eclipse.WorkbenchListenerCallback#
+	 * editorVisible(org.eclipse.ui.texteditor.ITextEditor,
+	 * org.eclipse.core.resources.IFile)
+	 */
+	public void editorVisible(ITextEditor editor, IFile file) {
+		if (!file.equals(openFileObject)) {
+			updateProject(file);
+			openFileObject = file;
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.eclipse.WorkbenchListenerCallback#
+	 * editorReplaced(org.eclipse.ui.texteditor.ITextEditor,
+	 * org.eclipse.core.resources.IFile)
+	 */
+	public void editorReplaced(ITextEditor editor, IFile file) {
+		updateProject(file);
+	}
+
+	/**
+	 * Opens the trace project related to given file
+	 * 
+	 * @param file
+	 *            the file
+	 */
+	private void updateProject(IFile file) {
+		IProject project = file.getProject();
+
+		// Check that project is Carbide project
+		boolean isCarbideProject = CarbideBuilderPlugin.getBuildManager()
+				.isCarbideProject(project);
+		if (isCarbideProject) {
+
+			String projectPath = getProjectPath(file);
+
+			// If trace folder name or project changes, existing project
+			// needs to be closed
+			if (traceFolderChanged == true
+					|| (openProjectPath != null && projectPath != null && !projectPath
+							.equals(openProjectPath))) {
+				TraceBuilderGlobals.getTraceBuilder().closeProject();
+				openProjectPath = null;
+				openProjectObject = null;
+			}
+			if (projectPath != null && !projectPath.equals(openProjectPath)) {
+				try {
+					mmpFileModified = false;
+					openProjectPath = projectPath;
+					openProjectObject = file.getProject();
+					ProjectEngine.traceFolderName = openProjectTraceFolderName;
+					TraceBuilderGlobals.setProjectPath(projectPath);
+					initializeDefaultGroupNames();
+
+					// Get project name
+					String projectName = getProjectName(projectPath);
+
+					// Save Epoc root of this SDK
+					saveEpocRoot(openProjectObject);
+
+					// Open the project
+					TraceBuilderGlobals.getTraceBuilder().openProject(
+							projectName);
+
+					// Parse traces from other source files in same
+					// component
+					parseOtherTracesFromComponent(file, project);
+
+				} catch (TraceBuilderException e) {
+					openProjectPath = null;
+					openProjectObject = null;
+					// If a source file is not open, this error is not
+					// relevant
+					// The project will be opened when a source is opened
+					if (e.getErrorCode() != TraceBuilderErrorCode.SOURCE_NOT_OPEN) {
+						TraceBuilderGlobals.getEvents().postError(e);
+					}
+				}
+			}
+		} else {
+			TraceBuilderGlobals.getTraceBuilder().closeProject();
+			openProjectPath = null;
+			openProjectObject = null;
+		}
+	}
+
+	/**
+	 * Initialize default group names based on used OST version
+	 * 
+	 * @throws TraceBuilderException
+	 */
+	private void initializeDefaultGroupNames() throws TraceBuilderException {
+
+		// Initialize default group names
+
+		String ostVersion = null;
+		IPath epocroot = WorkbenchUtils
+				.getEpocRootForProject(openProjectObject);
+		String epocRootAsString = epocroot.toOSString();
+		File platformDir = new File(epocRootAsString + EPOC32_INCLUDE_PLATFORM);
+		File platformOpenSystemTraceFile = new File(platformDir,
+				OPEN_SYSTEM_TRACE_H);
+		if (platformOpenSystemTraceFile.exists()
+				&& platformOpenSystemTraceFile.isFile()) {
+			ostVersion = getOstVersion(platformOpenSystemTraceFile);
+
+			// If OST version is not defined in opensystemtrace.h file then
+			// default is 1.x.x
+			if (ostVersion == null) {
+				ostVersion = OST_VERSION_1_X_X;
+			}
+
+		} else {
+			File internalDir = new File(epocRootAsString
+					+ EPOC32_INCLUDE_INTERNAL);
+			File internalOpenSystemTraceFile = new File(internalDir,
+					OPEN_SYSTEM_TRACE_H);
+
+			// If opensystemtrace.h file exist only in internal folder then
+			// version is 1.x.x. In OSTv2 case opensystemtrace.h file should
+			// newer exist only in internal folder, so it is enough that we
+			// check version only from header in platform folder, because OSTv1
+			// version of header does not contain version information.
+			if (internalOpenSystemTraceFile.exists()
+					&& internalOpenSystemTraceFile.isFile()) {
+				ostVersion = OST_VERSION_1_X_X;
+			} else {
+
+				// If opensystemtrace.h file does not exist at all then default
+				// is 2.x.x
+				ostVersion = OST_VERSION_2_X_X;
+			}
+		}
+
+		// Check is OST version 1.x.x in use. If it is then use OSTv1 otherwise
+		// use OSTv2
+		GroupNameHandlerBase groupNameHandler = TraceBuilderGlobals
+				.getGroupNameHandler();
+		if (ostVersion.startsWith(OSTV1_START_TEXT)) {
+			if (!(groupNameHandler instanceof GroupNameHandlerOSTv1)) {
+				TraceBuilderGlobals
+						.setGroupNameHandler(new GroupNameHandlerOSTv1());
+			}
+		} else if (ostVersion.startsWith(OSTV2_START_TEXT)) {
+			if (!(groupNameHandler instanceof GroupNameHandlerOSTv2)) {
+				TraceBuilderGlobals
+						.setGroupNameHandler(new GroupNameHandlerOSTv2());
+			}
+		} else {
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.UNKNOWN_OST_VERSION);
+		}
+	}
+
+	/**
+	 * Get OST version from OpenSystemTrace.h file
+	 * 
+	 * @param platformOpenSystemTraceFile
+	 *            open system trace API file
+	 * @return OST version Used OST version (e.g. 2.0.0)
+	 * @throws TraceBuilderException
+	 */
+	private String getOstVersion(File platformOpenSystemTraceFile)
+			throws TraceBuilderException {
+		String ostVersion = null;
+		FileInputStream fstream;
+		try {
+			fstream = new FileInputStream(platformOpenSystemTraceFile
+					.toString());
+			DataInputStream in = new DataInputStream(fstream);
+
+			BufferedReader br = new BufferedReader(new InputStreamReader(in));
+			String strLine;
+
+			// Read opensystemtrace.h file line by line
+			try {
+				while ((strLine = br.readLine()) != null) {
+					boolean versionDefinitionFound = strLine
+							.matches(OST_INSTRUMENTATION_API_VERSION_REGEX);
+					if (versionDefinitionFound) {
+						int versionNumberStart = strLine
+								.indexOf(OST_INSTRUMENTATION_API_VERSION_TEXT)
+								+ OST_INSTRUMENTATION_API_VERSION_TEXT.length();
+						ostVersion = strLine.substring(versionNumberStart);
+						ostVersion = ostVersion.trim();
+						break;
+					}
+				}
+			} catch (IOException e) {
+				throw new TraceBuilderException(
+						TraceBuilderErrorCode.UNEXPECTED_EXCEPTION, e);
+			} finally {
+				try {
+					in.close();
+				} catch (IOException e1) {
+					throw new TraceBuilderException(
+							TraceBuilderErrorCode.UNEXPECTED_EXCEPTION, e1);
+				}
+			}
+		} catch (FileNotFoundException e2) {
+			FileErrorParameters params = new FileErrorParameters();
+			params.file = platformOpenSystemTraceFile.toString();
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.FILE_NOT_FOUND, params);
+		}
+
+		return ostVersion;
+	}
+
+	/**
+	 * Parse traces from other source files in same component
+	 * 
+	 * @param file
+	 *            the file
+	 * @param project
+	 *            the project
+	 */
+	private void parseOtherTracesFromComponent(IFile file, IProject project) {
+
+		if (file != null && project != null) {
+			ICarbideBuildConfiguration buildConfig = getBuildConfiguration(project);
+			if (buildConfig != null) {
+
+				// Get MMP files for given source file
+				for (final IPath mmpPath : EpocEngineHelper.getMMPsForSource(
+						openProjectObject, file.getLocation())) {
+					IPath fullMmpPath = new Path(openProjectPath);
+					fullMmpPath = fullMmpPath.append(mmpPath);
+
+					String componentId = getComponentIdFromMMPFile(mmpPath,
+							project);
+
+					// Component ID in MMP file must be same as current software
+					// component ID
+					if (TraceBuilderGlobals.getCurrentSoftwareComponentId() != null
+							&& TraceBuilderGlobals
+									.getCurrentSoftwareComponentId().equals(
+											componentId)) {
+
+						// Get source files for MMP file
+						for (final IPath sourcePath : EpocEngineHelper
+								.getSourceFilesForConfiguration(buildConfig,
+										fullMmpPath)) {
+							File source = new File(sourcePath.toOSString());
+
+							// Check that source file is not same as opened file
+							if (!file.getName().equalsIgnoreCase(
+									source.getName())
+									&& !isFileOpenedInEditor(source)) {
+								IWorkspace workspace = ResourcesPlugin
+										.getWorkspace();
+								IPath location = Path.fromOSString(source
+										.getAbsolutePath());
+								IFile isource = workspace.getRoot()
+										.getFileForLocation(location);
+
+								// Parse traces from source file
+								parseTracesFromFile(isource);
+							}
+						}
+					}
+				}
+			}
+		}
+	}
+
+	/**
+	 * Get build configuration
+	 * 
+	 * @param project
+	 *            the project
+	 * @return the build configuration
+	 */
+	private ICarbideBuildConfiguration getBuildConfiguration(IProject project) {
+		ICarbideBuildManager buildMgr = CarbideBuilderPlugin.getBuildManager();
+		ICarbideBuildConfiguration buildConfig = null;
+		if (buildMgr != null) {
+
+			// We do not need to check that is project Carbide
+			// project because we have done that earlier
+			ICarbideProjectInfo cpi = buildMgr.getProjectInfo(project);
+			if (cpi != null) {
+
+				// Get the default build configuration
+				buildConfig = cpi.getDefaultConfiguration();
+			}
+		}
+		return buildConfig;
+	}
+
+	/**
+	 * Parse traces from given file
+	 * 
+	 * @param file
+	 *            the file
+	 */
+	private void parseTracesFromFile(IFile file) {
+
+		if (file != null) {
+
+			// Get file content to string variable
+			String sourceData = getFileContentAsString(file);
+
+			if (sourceData != null) {
+
+				// Create new document from source data
+				IDocument document = new Document(sourceData);
+				document
+						.addPositionCategory(JFaceDocumentWrapper.TRACEBUILDER_POSITION_CATEGORY);
+				JFaceLocationUpdater locationUpdater = new JFaceLocationUpdater(
+						JFaceDocumentWrapper.TRACEBUILDER_POSITION_CATEGORY);
+				document.addPositionUpdater(locationUpdater);
+				SourceDocumentInterface sourceDocumentInterface = new JFaceDocumentWrapper(
+						document);
+
+				// Create new source properties
+				SourceProperties properties = new SourceProperties(
+						TraceBuilderGlobals.getTraceModel(), DocumentFactory
+								.getDocumentMonitor().getFactory(),
+						sourceDocumentInterface);
+
+				// Parse trace locations from source properties
+				properties.updateTraces(0, sourceData.length());
+
+				TraceLocationMap locationMap = TraceBuilderGlobals
+						.getLocationMap();
+
+				// When we add source to location map it will go to unrelated
+				// list
+				locationMap.addSource(properties);
+
+				// Parse traces from source so those will be added to the model
+				TraceLocationConverter lc = TraceBuilderGlobals
+						.getLocationConverter();
+				lc.parseTracesFromSource(properties);
+
+				String path = file.getLocation().removeLastSegments(1)
+						.toOSString()
+						+ "\\"; //$NON-NLS-1$
+				String fileName = file.getName();
+
+				// When we remove source from location map it will go to last
+				// known locations list
+				locationMap.removeSource(properties, path, fileName);
+			}
+		}
+	}
+
+	/**
+	 * Get file content as string
+	 * 
+	 * @param file
+	 *            the file
+	 * @return file content as string
+	 */
+	private String getFileContentAsString(IFile file) {
+		String fileContentAsString = null;
+		boolean continueExecution = true;
+
+		InputStream is = null;
+		try {
+			is = file.getContents();
+		} catch (CoreException e1) {
+			continueExecution = false;
+		}
+
+		if (continueExecution) {
+			BufferedReader reader = new BufferedReader(
+					new InputStreamReader(is));
+			StringBuilder sb = new StringBuilder();
+
+			String line = null;
+			try {
+
+				// Read file content line by line to string builder
+				while ((line = reader.readLine()) != null) {
+					sb.append(line + SourceConstants.LINE_FEED);
+				}
+			} catch (IOException e) {
+				continueExecution = false;
+			} finally {
+				try {
+					is.close();
+				} catch (IOException e) {
+					continueExecution = false;
+				}
+			}
+
+			// If everything went OK, get content from string builder to string
+			// variable
+			if (continueExecution) {
+				fileContentAsString = sb.toString();
+			}
+		}
+
+		return fileContentAsString;
+	}
+
+	/**
+	 * Check is file opened in editor
+	 * 
+	 * @param source
+	 *            .getAbsolutePath() the file
+	 * @return true if file is opened in editor, otherwise false
+	 */
+	private boolean isFileOpenedInEditor(File source) {
+		boolean fileAlredyOpened = false;
+		IWorkbenchWindow[] windows = PlatformUI.getWorkbench()
+				.getWorkbenchWindows();
+		for (IWorkbenchWindow window : windows) {
+			IWorkbenchPage[] pages = window.getPages();
+			for (IWorkbenchPage page : pages) {
+				IEditorReference[] refs = page.getEditorReferences();
+				IFile alreadyOpenedFile = null;
+				for (IEditorReference ref : refs) {
+					alreadyOpenedFile = WorkbenchUtils.getEditorFile(ref);
+					if (alreadyOpenedFile != null
+							&& alreadyOpenedFile.getLocation().toOSString()
+									.equals(source.getAbsolutePath())) {
+						fileAlredyOpened = true;
+						break;
+					}
+				}
+				if (fileAlredyOpened) {
+					break;
+				}
+			}
+			if (fileAlredyOpened) {
+				break;
+			}
+		}
+		return fileAlredyOpened;
+	}
+
+	/**
+	 * Gets project name from project path
+	 * 
+	 * @param projectPath
+	 *            the project path
+	 * @return project name
+	 */
+	private String getProjectName(String projectPath) {
+		String separator = System.getProperty("file.separator"); //$NON-NLS-1$
+		String projectName = projectPath.substring(projectPath
+				.lastIndexOf(separator) + 1);
+		return projectName;
+	}
+
+	/**
+	 * Gets project path from file
+	 * 
+	 * @param file
+	 *            the file
+	 * @return the project path
+	 */
+	private String getProjectPath(IFile file) {
+		String projectPath = null;
+
+		// Initial project path is the file's parent folder
+		IPath path = file.getLocation();
+		IProject project = file.getProject();
+
+		// Check if file is source file
+		if (isSourceFile(file)) {
+			projectPath = getProjectPathToSourceFile(project, path);
+
+			// It could be that source file is not included to MMP file and
+			// because that we did not find project path. So if source file
+			// project path is null, try to find project path to source file
+			// same way than non source file.
+			if (projectPath == null) {
+				projectPath = getProjetcPathToNonSourceFile(project, path);
+			}
+		} else {
+			projectPath = getProjetcPathToNonSourceFile(project, path);
+		}
+
+		return projectPath;
+	}
+
+	/**
+	 * Get project path to source file
+	 * 
+	 * @param project
+	 *            project
+	 * @param path
+	 *            path where to start find project path
+	 * @return the project path
+	 */
+	private String getProjectPathToSourceFile(IProject project, IPath path) {
+		String projectPath = null;
+		String mmpFilePath = null;
+		IPath currentSoftwareComponentMMPPath = null;
+		List<IPath> mmpPaths = EpocEngineHelper.getMMPsForSource(project, path);
+		if (mmpPaths.size() > 0) {
+
+			// Check that was source file included to more than one MMP file
+			if (mmpPaths.size() > 1) {
+
+				// User need to select software component to work with, if
+				// previous file was also included to more than one MMP file or
+				// if some of the previous files belonged to different
+				// component.
+				if (selectSoftwareComponent || previousFileIncludedMoreThanOnce) {
+
+					// Clear old software component list
+					TraceBuilderGlobals.clearSoftwareComponents();
+
+					// Add all software components to software component list
+					for (int i = 0; i < mmpPaths.size(); i++) {
+						IPath mmpPath = mmpPaths.get(i);
+						String mmpPathAsString = mmpPath.toString();
+						String componentId = getComponentIdFromMMPFile(mmpPath,
+								project);
+						String componentName = getComponentNameFromMMPFileName(mmpPathAsString);
+						TraceBuilderGlobals.addSoftwareComponent(componentId,
+								componentName, mmpPathAsString);
+					}
+
+					// Ask user to select software component to be used
+					try {
+						TraceBuilderGlobals.getTraceBuilder().selectComponent();
+					} catch (TraceBuilderException e) {
+						TraceBuilderGlobals.getEvents().postError(e);
+					}
+
+					selectSoftwareComponentCheckNeeded = true;
+				}
+
+				currentSoftwareComponentMMPPath = new Path(TraceBuilderGlobals
+						.getCurrentSoftwareComponentMMPPath());
+				String currentSoftwareComponentName = TraceBuilderGlobals
+						.getCurrentSoftwareComponentName();
+				setPossibleTraceFolderNames(project,
+						currentSoftwareComponentName,
+						currentSoftwareComponentMMPPath);
+
+				// Remove mmp file name from mmpPathAsString variable
+				IPath projectLocation = project.getLocation();
+				String mmpPathAsString = TraceBuilderGlobals
+						.getCurrentSoftwareComponentMMPPath();
+				int lastIndexOfForwardSlashChar = mmpPathAsString
+						.lastIndexOf(SourceConstants.FORWARD_SLASH_CHAR);
+
+				if (lastIndexOfForwardSlashChar != -1) {
+					mmpPathAsString = mmpPathAsString.substring(0,
+							lastIndexOfForwardSlashChar);
+				}
+
+				// Append mmpPathAsString to Project path to get real
+				// mmp file path
+				mmpFilePath = projectLocation.append(mmpPathAsString)
+						.toString();
+
+				previousFileIncludedMoreThanOnce = true;
+			} else {
+				currentSoftwareComponentMMPPath = mmpPaths.get(0);
+				String mmpPathAsString = currentSoftwareComponentMMPPath
+						.toString();
+
+				String componentId = getComponentIdFromMMPFile(
+						currentSoftwareComponentMMPPath, project);
+				String componentName = getComponentNameFromMMPFileName(mmpPathAsString);
+
+				if (selectSoftwareComponentCheckNeeded) {
+					if (TraceBuilderGlobals.getCurrentSoftwareComponentId() != null
+							&& TraceBuilderGlobals
+									.getCurrentSoftwareComponentId().equals(
+											componentId)) {
+						selectSoftwareComponent = false;
+					} else {
+						selectSoftwareComponent = true;
+						selectSoftwareComponentCheckNeeded = false;
+					}
+				}
+
+				// Clear old software component list
+				TraceBuilderGlobals.clearSoftwareComponents();
+
+				// Add software component to software component list
+				TraceBuilderGlobals.addSoftwareComponent(componentId,
+						componentName, mmpPathAsString);
+
+				// Because there is only one component current component index
+				// is 0
+				TraceBuilderGlobals.setCurrentSoftwareComponentIndex(0);
+
+				setPossibleTraceFolderNames(project, componentName,
+						currentSoftwareComponentMMPPath);
+
+				// Remove mmp file name from mmpPathAsString variable
+				IPath projectLocation = project.getLocation();
+				int lastIndexOfForwardSlashChar = mmpPathAsString
+						.lastIndexOf(SourceConstants.FORWARD_SLASH_CHAR);
+
+				if (lastIndexOfForwardSlashChar != -1) {
+					mmpPathAsString = mmpPathAsString.substring(0,
+							lastIndexOfForwardSlashChar);
+				}
+
+				// Append mmpPathAsString to Project path to get real
+				// mmp file path
+				mmpFilePath = projectLocation.append(mmpPathAsString)
+						.toString();
+
+				previousFileIncludedMoreThanOnce = false;
+			}
+			projectPath = findProjectRootAndSetTracesFolderName(
+					currentSoftwareComponentMMPPath, project, mmpFilePath);
+		}
+		return projectPath;
+	}
+
+	/**
+	 * Find project root and set traces folder name
+	 * 
+	 * @param mmpFilePath
+	 *            MPP file path
+	 * @return Project root
+	 */
+	private String findProjectRootAndSetTracesFolderName(IPath mmpPath,
+			IProject project, String mmpFilePath) {
+		String projectPath;
+		projectPath = findProjectRoot(mmpFilePath);
+
+		// Store previous trace folder name
+		String previousTraceFolderName = ProjectEngine.traceFolderName;
+		openProjectTraceFolderName = findTraceFolderName(mmpPath, project,
+				projectPath);
+
+		// Check has trace folder name changed
+		traceFolderChanged = false;
+		if (previousTraceFolderName != null
+				&& !previousTraceFolderName
+						.equalsIgnoreCase(openProjectTraceFolderName)) {
+			traceFolderChanged = true;
+		}
+		return projectPath;
+	}
+
+	/**
+	 * Set possible trace folder names
+	 * 
+	 * @param carbideProject
+	 *            Current Carbide.c++ project
+	 * @param componentName
+	 *            Current component name
+	 * @param relativeMMPPath
+	 *            Relative path to current MMP file
+	 */
+	private void setPossibleTraceFolderNames(IProject carbideProject,
+			String componentName, IPath relativeMMPPath) {
+		String targetName = null;
+		String targetExt = null;
+		tracesComponentNameFolder = TRACES_DIRECTORY + UNDERSCORE
+				+ componentName;
+
+		// Append relative MMP path to the project location to get location of
+		// the MMP file
+		IPath mmpPath = carbideProject.getLocation().append(relativeMMPPath);
+
+		ICarbideBuildManager buildMgr = CarbideBuilderPlugin.getBuildManager();
+		ICarbideProjectInfo cpi = buildMgr.getProjectInfo(carbideProject);
+
+		// Get the default build configuration
+		ICarbideBuildConfiguration defultConfig = cpi.getDefaultConfiguration();
+		IPath pathForExcutable = EpocEngineHelper.getHostPathForExecutable(
+				defultConfig, mmpPath);
+		if (pathForExcutable != null) {
+			String fileName = pathForExcutable.lastSegment();
+			int lastIndexOfDot = fileName.lastIndexOf("."); //$NON-NLS-1$
+			targetName = fileName.substring(0, lastIndexOfDot);
+			targetExt = fileName.substring(lastIndexOfDot + 1);
+		}
+
+		Object data = EpocEnginePlugin.runWithMMPData(mmpPath,
+				new DefaultMMPViewConfiguration(carbideProject, defultConfig,
+						new AcceptedNodesViewFilter()),
+				new MMPDataRunnableAdapter() {
+					public Object run(IMMPData mmpData) {
+						// The real return value, getting a single argument
+						// setting
+						return mmpData.getSingleArgumentSettings().get(
+								EMMPStatement.TARGETTYPE);
+					}
+				});
+
+		String targetType = (String) data;
+
+		if (targetName != null && targetType != null) {
+			tracesTargetNameTargetTypeFolder = TRACES_DIRECTORY + UNDERSCORE
+					+ targetName + UNDERSCORE + targetType;
+		} else {
+			tracesTargetNameTargetTypeFolder = null;
+		}
+
+		if (targetName != null && targetExt != null) {
+			tracesDirTargetNameTargetExtFolder = TRACES_DIRECTORY
+					+ File.separator + targetName + UNDERSCORE + targetExt;
+		} else {
+			tracesDirTargetNameTargetExtFolder = null;
+		}
+
+		setSBSv2TraceFolderName(carbideProject);
+	}
+
+	/**
+	 * Get component id from MMP file
+	 * 
+	 * @param mmpPath
+	 *            the mmp file path
+	 * @param project
+	 *            the project
+	 * @return the component id as string
+	 */
+	private String getComponentIdFromMMPFile(IPath mmpPath, IProject project) {
+		String uid = null;
+		if (mmpPath != null) {
+			ICarbideBuildConfiguration buildConfig = getBuildConfiguration(project);
+			if (buildConfig != null) {
+				Object data = EpocEnginePlugin.runWithMMPData(project
+						.getLocation().append(mmpPath),
+						new DefaultMMPViewConfiguration(buildConfig
+								.getCarbideProject().getProject(), buildConfig,
+								new AcceptedNodesViewFilter()),
+						new MMPDataRunnableAdapter() {
+							public Object run(IMMPData mmpData) {
+
+								// Try first get value of UID3
+								String uid = mmpData.getUid3();
+
+								// If value of UID3 is null then
+								// try get value of UID2
+								if (uid == null) {
+									uid = mmpData.getUid2();
+								}
+
+								// return value could be null if
+								// UID2 is not defined
+								return uid; // CodForChk_Dis_Exits
+							}
+						});
+				uid = (String) data;
+			}
+		}
+		return uid;
+	}
+
+	/**
+	 * Get trace folder name from MMP file
+	 * 
+	 * @param mmpPath
+	 *            the mmp file path
+	 * @param project
+	 *            the project
+	 * @return the trace folder name
+	 */
+	private String getTraceFolderFromMMPFile(IPath mmpPath, IProject project) {
+		String traceFolder = null;
+		if (mmpPath != null) {
+			ICarbideBuildConfiguration buildConfig = getBuildConfiguration(project);
+			if (buildConfig != null) {
+				Object data = EpocEnginePlugin.runWithMMPData(project
+						.getLocation().append(mmpPath),
+						new DefaultMMPViewConfiguration(buildConfig
+								.getCarbideProject().getProject(), buildConfig,
+								new AcceptedNodesViewFilter()),
+						new MMPDataRunnableAdapter() {
+							public Object run(IMMPData mmpData) {
+
+								String traceFolder = null;
+
+								// Get the list of user include
+								// paths
+								List<IPath> userIncludes = mmpData
+										.getUserIncludes();
+
+								// Go through existing userincludes
+								// to check if the path to add is
+								// already present
+								for (int i = 0; i < userIncludes.size(); i++) {
+									String userIncludeAsOSString = userIncludes
+											.get(i).toOSString();
+									if (userIncludeAsOSString
+											.equalsIgnoreCase(TRACES_DIRECTORY)
+											|| userIncludeAsOSString
+													.equalsIgnoreCase(tracesComponentNameFolder)
+											|| userIncludeAsOSString
+													.equalsIgnoreCase(tracesTargetNameTargetTypeFolder)
+											|| userIncludeAsOSString
+													.equalsIgnoreCase(tracesDirTargetNameTargetExtFolder)) {
+										traceFolder = userIncludeAsOSString;
+										break;
+									}
+								}
+								return traceFolder; // CodForChk_Dis_Exits
+							}
+						});
+				traceFolder = (String) data;
+			}
+		}
+		return traceFolder;
+	}
+
+	/**
+	 * Get component name from MMP file name
+	 * 
+	 * @param mmpPathAsString
+	 *            the mmp file path as string
+	 * @return the component name
+	 */
+	private String getComponentNameFromMMPFileName(String mmpPathAsString) {
+		String mmpFileName = null;
+		if (mmpPathAsString != null) {
+			int lastIndexOfForwardSlashChar = mmpPathAsString
+					.lastIndexOf(SourceConstants.FORWARD_SLASH_CHAR);
+			int lastIndexOfPeriod = mmpPathAsString.lastIndexOf(FileUtils.MMP);
+			mmpFileName = mmpPathAsString.substring(
+					lastIndexOfForwardSlashChar + 1, lastIndexOfPeriod);
+		}
+
+		return mmpFileName;
+	}
+
+	/**
+	 * Get project path to non source file
+	 * 
+	 * @param project
+	 *            project
+	 * @param path
+	 *            path where to start find project path
+	 * @return the project path
+	 */
+	private String getProjetcPathToNonSourceFile(IProject project, IPath path) {
+		String projectPath = null;
+
+		// We can not parse software components, because file is not source file
+		// and it is not listed in MMP files. So just clear software components
+		// list.
+		TraceBuilderGlobals.clearSoftwareComponents();
+
+		// Check that is file part of open project
+		if (project.equals(openProjectObject) && openProjectPath != null) {
+
+			// File part of open project, so use same project path
+			projectPath = openProjectPath;
+
+			// Because project path is same, also trace folder is same
+			traceFolderChanged = false;
+		} else {
+
+			// File not part of open project, so find project path
+			projectPath = findProjectRootAndSetTracesFolderName(path, project,
+					path.toOSString());
+		}
+		return projectPath;
+	}
+
+	/**
+	 * Find files project root
+	 * 
+	 * @param path
+	 *            path where to start find project root
+	 * @return the project root
+	 */
+	private String findProjectRoot(String path) {
+		boolean found = false;
+		String root = path;
+		File file = new File(root);
+		while (!found && file != null) {
+			if (isProjectRoot(file)) {
+				root = file.getPath();
+				found = true;
+			} else {
+				file = file.getParentFile();
+			}
+		}
+		return root;
+	}
+
+	/**
+	 * Find trace folder name
+	 * 
+	 * @param mmpFilePath
+	 *            MMP file path
+	 * @param projectRoot
+	 *            project root
+	 * @return the trace folder name
+	 */
+	private String findTraceFolderName(IPath mmpPath, IProject project,
+			String projectRoot) {
+		String traceFolderName = null;
+
+		traceFolderName = getTraceFolderFromMMPFile(mmpPath, project);
+
+		if (traceFolderName == null) {
+			traceFolderName = findTraceFolderNameFromFileSystem(projectRoot);
+		}
+		return traceFolderName;
+	}
+
+	/**
+	 * Find trace folder name from file system
+	 * 
+	 * @param projectRoot
+	 *            project root
+	 * @return the trace folder name
+	 */
+	private String findTraceFolderNameFromFileSystem(String projectRoot) {
+		String traceFolderName = null;
+		File file = new File(projectRoot);
+
+		File[] children = file.listFiles();
+
+		// Check that does subdirectory that name is one of the possible trace
+		// folder name exist in this directory. If it exist use that as traces
+		// directory name.
+		for (int i = 0; i < children.length; i++) {
+			File child = children[i];
+			String childName = child.getName();
+			if (child.isDirectory()) {
+				if (childName
+						.equalsIgnoreCase(tracesDirTargetNameTargetExtFolder)) {
+					traceFolderName = tracesDirTargetNameTargetExtFolder;
+					break;
+				} else if (childName
+						.equalsIgnoreCase(tracesTargetNameTargetTypeFolder)) {
+					traceFolderName = tracesTargetNameTargetTypeFolder;
+					break;
+				} else if (childName
+						.equalsIgnoreCase(tracesComponentNameFolder)) {
+					traceFolderName = tracesComponentNameFolder;
+					break;
+				} else if (childName.equalsIgnoreCase(TRACES_DIRECTORY)) {
+					traceFolderName = TRACES_DIRECTORY;
+					break;
+				}
+			}
+		}
+
+		// If trace folder name is "traces" we need to check that does it
+		// include folder "<target name>_<target ext>". If it includes then
+		// that folder need to be as traces folder name
+		if (traceFolderName != null && traceFolderName.equals(TRACES_DIRECTORY) && tracesDirTargetNameTargetExtFolder != null) {
+			file = new File(projectRoot + File.separator + TRACES_DIRECTORY);
+			children = file.listFiles();
+			int startIndex = tracesDirTargetNameTargetExtFolder
+					.lastIndexOf(File.separator);
+			String targetNameTargetExtFolder = tracesDirTargetNameTargetExtFolder
+					.substring(startIndex + 1);
+			for (int i = 0; i < children.length; i++) {
+				File child = children[i];
+				String childName = child.getName();
+				if (child.isDirectory()) {
+					if (childName.equalsIgnoreCase(targetNameTargetExtFolder)) {
+						traceFolderName = tracesDirTargetNameTargetExtFolder;
+						break;
+					}
+				}
+			}
+		}
+
+		// If trace folder is still null set default value based on used SBS
+		// version
+		if (traceFolderName == null) {
+			if (sbsv2TraceFolderName != null) {
+				traceFolderName = sbsv2TraceFolderName;
+			} else {
+				traceFolderName = tracesComponentNameFolder;
+			}
+		}
+		return traceFolderName;
+	}
+
+	/**
+	 * Set SBSv2 trace folder name
+	 * 
+	 * @param project
+	 *            Carbide project
+	 */
+	private void setSBSv2TraceFolderName(IProject project) {
+		ICarbideBuildManager buildMgr = CarbideBuilderPlugin.getBuildManager();
+
+		boolean isSBSv2Project = buildMgr.isCarbideSBSv2Project(project);
+
+		if (isSBSv2Project) {
+			ISDKManager sdkMgr = SDKCorePlugin.getSDKManager();
+			Version sbsv2Version = sdkMgr.getSBSv2Version(true);
+			int major = sbsv2Version.getMajor();
+			int minor = sbsv2Version.getMinor();
+			int micro = sbsv2Version.getMicro();
+
+			if ((major < 2) || (major == 2 && minor < 10)
+					|| (major == 2 && minor == 10 && micro == 0)) {
+				sbsv2TraceFolderName = tracesComponentNameFolder;
+			} else if (major == 2) {
+				if ((major == 2 && minor < 14)) {
+					sbsv2TraceFolderName = tracesTargetNameTargetTypeFolder;
+				} else {
+					sbsv2TraceFolderName = tracesDirTargetNameTargetExtFolder;
+				}
+			} else {
+				sbsv2TraceFolderName = tracesDirTargetNameTargetExtFolder;
+			}
+		} else {
+			sbsv2TraceFolderName = null;
+		}
+	}
+
+	/**
+	 * Checks if this folder is the project root
+	 * 
+	 * @param parentFolder
+	 *            parent folder
+	 * @return true if this folder is the project root
+	 */
+	private boolean isProjectRoot(File mmpFile) {
+		// Try to find traces, group or mmpfiles folder from this folder
+		boolean isProjectRoot = false;
+
+		FilenameFilter filter = new FilenameFilter() {
+			public boolean accept(File file, String name) {
+				boolean retval = false;
+
+				if (file.isDirectory()) {
+					if (name
+							.equalsIgnoreCase(tracesDirTargetNameTargetExtFolder)
+							|| name
+									.equalsIgnoreCase(tracesTargetNameTargetTypeFolder)
+							|| name.equalsIgnoreCase(tracesComponentNameFolder)
+							|| name.equalsIgnoreCase(TRACES_DIRECTORY)
+							|| name.equalsIgnoreCase(GROUP_DIRECTORY)
+							|| name.equalsIgnoreCase(MMPFILES_DIRECTORY)) {
+						retval = true;
+					}
+				}
+				return retval; // CodForChk_Dis_Exits
+			}
+		};
+
+		String[] children = mmpFile.list(filter);
+
+		if (children != null && children.length != 0) {
+			isProjectRoot = true;
+		}
+
+		return isProjectRoot; // CodForChk_Dis_Exits
+	}
+
+	/**
+	 * Saves Epoc root to Trace Builder Configuration
+	 * 
+	 * @param project
+	 *            the project
+	 */
+	private void saveEpocRoot(IProject project) {
+		IPath epocRoot = WorkbenchUtils.getEpocRootForProject(project);
+
+		if (epocRoot != null) {
+			TraceBuilderGlobals.getConfiguration().setText(
+					TraceBuilderConfiguration.ENVIRONMENT_ROOT,
+					epocRoot.toOSString());
+		} else {
+			TraceBuilderGlobals.getConfiguration().setText(
+					TraceBuilderConfiguration.ENVIRONMENT_ROOT, ""); //$NON-NLS-1$
+		}
+	}
+
+	/**
+	 * Checks that the given file belongs to active project
+	 * 
+	 * @param file
+	 *            the file
+	 * @return true if valid, false if not
+	 */
+	boolean isFileActive(IFile file) {
+		boolean isActive = false;
+		IProject project = file.getProject();
+		if (project.equals(openProjectObject) == true) {
+
+			// Check that project is Carbide project
+			boolean isCarbideProject = CarbideBuilderPlugin.getBuildManager()
+					.isCarbideProject(project);
+			if (isCarbideProject) {
+
+				// If file is source file then we need to check that trace
+				// folcer name is same than open project trace folder name
+				if (isSourceFile(file)) {
+					IPath path = file.getLocation();
+					List<IPath> mmpPaths = EpocEngineHelper.getMMPsForSource(
+							project, path);
+					if (mmpPaths.size() > 0) {
+						for (int i = 0; i < mmpPaths.size(); i++) {
+							IPath mmpPath = mmpPaths.get(i);
+							String mmpPathAsString = mmpPath.toString();
+							String componentName = getComponentNameFromMMPFileName(mmpPathAsString);
+							String currentComponentName = TraceBuilderGlobals
+									.getCurrentSoftwareComponentName();
+							if (componentName != null
+									&& componentName
+											.equalsIgnoreCase(currentComponentName)) {
+								isActive = true;
+								break;
+							}
+						}
+					}
+				} else {
+					isActive = true;
+				}
+			}
+		}
+		return isActive;
+	}
+
+	/**
+	 * Check that is file source file
+	 * 
+	 * @param file
+	 *            file that need to be check
+	 * @return true if file is source file, false if not
+	 */
+	private boolean isSourceFile(IFile file) {
+		boolean retVal = false;
+
+		String extension = file.getFileExtension();
+
+		if (extension != null
+				&& (extension.equalsIgnoreCase(FileUtils.CPP_EXTENSION) || extension
+						.equalsIgnoreCase(FileUtils.C_EXTENSION))) {
+			retVal = true;
+		}
+		return retVal;
+	}
+
+	/**
+	 * Source saved
+	 * 
+	 * @param source
+	 *            the source
+	 */
+	void sourceSaved(JFaceDocumentWrapper source) {
+		if (!mmpFileModified && openProjectObject != null
+				&& TraceBuilderGlobals.getTraceModel().hasTraces()) {
+			String fileName = source.getFileName();
+			String filepath = source.getFilePath();
+			Path path = new Path(filepath + fileName);
+
+			// Add traces folder include path to MMP file
+			addTracesFolderInclude(path);
+
+			// Add SYSTEMINCLUDE to MMP file if needed
+			addOpenSystemTraceSystemInclude();
+
+			mmpFileModified = true;
+		}
+	}
+
+	/**
+	 * Add layer SYSTEMINCLUDE macro to MMP file if needed
+	 * 
+	 */
+	private void addOpenSystemTraceSystemInclude() {
+
+		if (CarbideBuilderPlugin.getBuildManager().isCarbideProject(
+				openProjectObject)
+				&& openProjectObject.isAccessible()) {
+			ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager()
+					.getProjectInfo(openProjectObject);
+			if (cpi != null) {
+
+				// loop through all build configurations since the list of mmp's
+				// could be different depending on the build configuration
+				for (ICarbideBuildConfiguration config : cpi
+						.getBuildConfigurations()) {
+
+					// loop through each mmp file and add the include path if
+					// necessary
+					for (final IPath mmpPath : EpocEngineHelper
+							.getMMPFilesForBuildConfiguration(config)) {
+						final IPath epocroot = WorkbenchUtils
+								.getEpocRootForProject(openProjectObject);
+						String mmpFilePath = epocroot.toOSString()
+								+ mmpPath.toOSString();
+						try {
+							// Open the file mmp file
+							FileInputStream fistream = new FileInputStream(
+									mmpFilePath);
+
+							// Get the object of DataInputStream
+							DataInputStream in = new DataInputStream(fistream);
+							BufferedReader br = new BufferedReader(
+									new InputStreamReader(in));
+
+							// Read File Line By Line
+							String strLine;
+							int numberOfLastIncludeLine = 0;
+							boolean headerExist = false;
+							int headerEnd = -1;
+							int line = 0;
+							boolean platformPathsIncludeFound = false;
+							boolean layerSystemIncludeMacroFound = false;
+							Vector<String> mmpFileContent = new Vector<String>();
+							while ((strLine = br.readLine()) != null) {
+								mmpFileContent.add(strLine);
+								line++;
+								strLine = strLine.toUpperCase();
+
+								// Check does MMP file start with file header
+								if (line == 1) {
+									if (strLine
+											.indexOf(MULTILINE_COMMENT_START) != -1) {
+										headerExist = true;
+									} else if (strLine.indexOf(COMMENT) != -1) {
+										headerExist = true;
+										headerEnd = line;
+									}
+								}
+
+								// Get header end, if MMP file starts with file
+								// header that is made by using multiline
+								// comment
+								if (strLine.indexOf(MULTILINE_COMMENT_END) != -1
+										&& headerExist && headerEnd == -1) {
+									headerEnd = line;
+								}
+
+								// Get header end, if MMP file starts with file
+								// header that is made by using single
+								// comments
+								if (strLine.indexOf(COMMENT) != -1
+										&& headerExist && headerEnd == line - 1) {
+									headerEnd = line;
+								}
+
+								// Get line of last include statement
+								if (strLine.indexOf(INCLUDE) != -1) {
+									numberOfLastIncludeLine = line;
+								}
+
+								// Check does platform_patsh.hrh include already
+								// exist
+								if (strLine.indexOf(PLATFORM_PATHS_HRH) != -1) {
+									platformPathsIncludeFound = true;
+								}
+
+								// Check does layer system include macro already
+								// exist
+								if (strLine
+										.indexOf(APP_LAYER_SYSTEMINCLUDE_MACRO) != -1
+										|| strLine
+												.indexOf(MW_LAYER_SYSTEMINCLUDE_MACRO) != -1
+										|| strLine
+												.indexOf(OS_LAYER_SYSTEMINCLUDE_MACRO) != -1) {
+									layerSystemIncludeMacroFound = true;
+									break;
+								}
+							}
+
+							// If includes did not exist, but file header exist,
+							// then set number of last include line same as
+							// header end.
+							if (headerExist
+									&& numberOfLastIncludeLine < headerEnd) {
+								numberOfLastIncludeLine = headerEnd;
+							}
+
+							// Close the buffered reader
+							br.close();
+
+							// Close the input stream
+							in.close();
+
+							// Close file input stream
+							fistream.close();
+
+							if (!layerSystemIncludeMacroFound) {
+								String layerSystemIncludeMacro = geLayerSystemIncludeMacro(mmpPath
+										.toOSString());
+								FileOutputStream fostream = new FileOutputStream(
+										mmpFilePath);
+								BufferedWriter bw = new BufferedWriter(
+										new OutputStreamWriter(fostream));
+
+								for (line = 0; line < mmpFileContent.size(); line++) {
+									if (line == numberOfLastIncludeLine) {
+										if (!platformPathsIncludeFound) {
+											bw
+													.write(INCLUDE_PLATFORM_PATHS_HRH
+															+ SourceConstants.LINE_FEED);
+										}
+										bw.write(SourceConstants.LINE_FEED
+												+ layerSystemIncludeMacro
+												+ SourceConstants.LINE_FEED);
+									}
+									bw.write(mmpFileContent.get(line)
+											+ SourceConstants.LINE_FEED);
+								}
+
+								// Close the buffered writer
+								bw.close();
+
+								// Close file output stream
+								fostream.close();
+							}
+						} catch (Exception e) {// Catch exception if any
+							CarbideBuilderPlugin.log(e);
+						}
+					}
+				}
+			}
+		}
+	}
+
+	/**
+	 * Get correct layer system include macro
+	 * 
+	 * @param string
+	 *            MMP path as OS string
+	 * 
+	 * @return correct layer system include macro
+	 */
+	private String geLayerSystemIncludeMacro(String mmpPathAsOsString) {
+		String layerSystemIncludeMacro = APP_LAYER_SYSTEMINCLUDE_MACRO;
+		String firstDirectory = mmpPathAsOsString.substring(0,
+				mmpPathAsOsString.indexOf(SourceConstants.BACKSLASH));
+
+		if (firstDirectory.equalsIgnoreCase(SF_FOLDER_NAME)) {
+			String secondDirectory = mmpPathAsOsString.substring(firstDirectory
+					.length() + 1, mmpPathAsOsString.indexOf(
+					SourceConstants.BACKSLASH, firstDirectory.length() + 1));
+			if (secondDirectory.equalsIgnoreCase(MW_FOLDER_NAME)) {
+				layerSystemIncludeMacro = MW_LAYER_SYSTEMINCLUDE_MACRO;
+			} else if (secondDirectory.equalsIgnoreCase(OS_FOLDER_NAME)) {
+				layerSystemIncludeMacro = OS_LAYER_SYSTEMINCLUDE_MACRO;
+			}
+		} else if (firstDirectory.equalsIgnoreCase(NCP_SW_FOLDER_NAME)) {
+			layerSystemIncludeMacro = OS_LAYER_SYSTEMINCLUDE_MACRO;
+		}
+
+		return layerSystemIncludeMacro;
+	}
+
+	/**
+	 * Adds traces folder include to MMP files
+	 * 
+	 * @param path
+	 *            file path
+	 */
+	private void addTracesFolderInclude(Path filePath) {
+		IPath mainProjectPath = openProjectObject.getLocation();
+		IPath traceProjectPath = new Path(openProjectPath);
+
+		// Calculate and remove matching segments
+		int matchingSegs = mainProjectPath
+				.matchingFirstSegments(traceProjectPath);
+
+		IPath projectRelativePath = traceProjectPath
+				.removeFirstSegments(matchingSegs);
+
+		// Add Traces directory and remove device ID
+		projectRelativePath = projectRelativePath
+				.append(ProjectEngine.traceFolderName);
+		projectRelativePath = projectRelativePath.setDevice(null);
+
+		// Add include path to the project MMP files
+		addUserIncludeToMmpFiles(filePath, projectRelativePath);
+	}
+
+	/**
+	 * Get Carbide project info
+	 * 
+	 * @return Carbide project info
+	 */
+	private ICarbideProjectInfo getCarbideProjectInfo() {
+		ICarbideProjectInfo cpi = null;
+		if (CarbideBuilderPlugin.getBuildManager().isCarbideProject(
+				openProjectObject)
+				&& openProjectObject.isAccessible()) {
+			cpi = CarbideBuilderPlugin.getBuildManager().getProjectInfo(
+					openProjectObject);
+		}
+		return cpi;
+	}
+
+	/**
+	 * Add user include to MMP files, those uses specific source file
+	 * 
+	 * @param filePath
+	 *            file path of the saved source file
+	 * @param projectRelativeIncDirPath
+	 *            project relative path to the include directory
+	 */
+	private void addUserIncludeToMmpFiles(final IPath filePath,
+			final IPath projectRelativeIncDirPath) {
+		if (openProjectObject != null && projectRelativeIncDirPath != null) {
+
+			final IPath epocroot = WorkbenchUtils
+					.getEpocRootForProject(openProjectObject);
+
+			ICarbideProjectInfo cpi = getCarbideProjectInfo();
+
+			// Loop through all build configurations since the list of
+			// mmp's could be different depending on the build
+			// configuration
+			for (ICarbideBuildConfiguration config : cpi
+					.getBuildConfigurations()) {
+
+				// Get name of the MMP files where source file is used
+				final List<IPath> mmpPaths = EpocEngineHelper.getMMPsForSource(
+						openProjectObject, filePath);
+				ArrayList<String> sourceMmpFileNames = new ArrayList<String>();
+				for (int i = 0; i < mmpPaths.size(); i++) {
+					sourceMmpFileNames.add(mmpPaths.get(i).lastSegment());
+				}
+
+				// Go through build configuration's MMP files
+				for (final IPath mmpPath : EpocEngineHelper
+						.getMMPFilesForBuildConfiguration(config)) {
+
+					String mmpFileName = mmpPath.lastSegment();
+
+					if (sourceMmpFileNames.contains(mmpFileName)) {
+
+						EpocEnginePlugin.runWithMMPView(mmpPath,
+								new DefaultMMPViewConfiguration(config,
+										new AcceptedNodesViewFilter()),
+								new MMPViewRunnableAdapter() {
+
+									public Object run(IMMPView view) {
+										MMPViewPathHelper helper = new MMPViewPathHelper(
+												view, epocroot);
+										try {
+
+											// Convert the project relative path
+											// to an mmp view path
+											IPath incPath = helper
+													.convertProjectOrFullPathToMMP(
+															EMMPPathContext.USERINCLUDE, // CodForChk_Dis_LengthyLine
+															projectRelativeIncDirPath); // CodForChk_Dis_LengthyLine
+
+											// Get the list of user include
+											// paths and add it if it's not
+											// already there
+											List<IPath> userIncludes = view
+													.getUserIncludes();
+
+											String incPathAsOSString = incPath
+													.toOSString();
+
+											boolean includeExist = false;
+
+											// Go through existing userincludes
+											// to check if the path to add is
+											// already present
+											for (int i = 0; i < userIncludes
+													.size(); i++) {
+												String pathAsOSString = userIncludes
+														.get(i).toOSString();
+												pathAsOSString = pathAsOSString
+														.toLowerCase();
+												if (pathAsOSString
+														.equalsIgnoreCase(incPathAsOSString)) {
+													includeExist = true;
+													break;
+												}
+											}
+
+											if (!includeExist) {
+												userIncludes.add(incPath);
+												WorkbenchUtils
+														.postUserIncludeMsg(mmpPath);
+
+												// Now commit the changes and
+												// release the file
+												while (true) {
+													try {
+														view.commit();
+														break;
+													} catch (IllegalStateException e) {
+														CarbideBuilderPlugin
+																.log(e);
+														if (!view.merge()) {
+															view.revert();
+														}
+													}
+												}
+											}
+
+										} catch (InvalidDriveInMMPPathException e) {
+
+											// Shouldn't get here; we passed in
+											// a project-relative path
+											CarbideBuilderPlugin.log(e);
+										}
+
+										return null;
+									}
+								});
+					}
+				}
+			}
+		}
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.eclipse/src/com/nokia/tracebuilder/eclipse/WorkbenchEditorMonitor.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,405 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Workbench editor monitor
+*
+*/
+package com.nokia.tracebuilder.eclipse;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.texteditor.IDocumentProvider;
+import org.eclipse.ui.texteditor.ITextEditor;
+
+import com.nokia.tracebuilder.source.OffsetLength;
+import com.nokia.tracebuilder.source.SourceDocumentFactory;
+import com.nokia.tracebuilder.source.SourceDocumentInterface;
+import com.nokia.tracebuilder.source.SourceDocumentProcessor;
+import com.nokia.tracebuilder.utils.DocumentMonitorBase;
+
+/**
+ * Workbench editor monitor
+ * 
+ */
+public final class WorkbenchEditorMonitor extends DocumentMonitorBase implements
+		WorkbenchListenerCallback {
+
+	/**
+	 * JFace document factory
+	 */
+	private JFaceDocumentFactory documentFactory;
+
+	/**
+	 * Workbench listener
+	 */
+	private WorkbenchListener listener = new WorkbenchListener(this);
+
+	/**
+	 * Trace project monitor
+	 */
+	private TraceProjectMonitor projectMonitor;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param projectMonitor
+	 *            the project monitor
+	 */
+	WorkbenchEditorMonitor(TraceProjectMonitor projectMonitor) {
+		this.projectMonitor = projectMonitor;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.utils.DocumentMonitorBase#
+	 * startMonitor(com.nokia.tracebuilder.source.SourceDocumentProcessor)
+	 */
+	@Override
+	public void startMonitor(SourceDocumentProcessor processor) {
+		super.startMonitor(processor);
+		listener.startListener();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.utils.DocumentMonitorBase#stopMonitor()
+	 */
+	@Override
+	public void stopMonitor() {
+		listener.stopListener();
+		super.stopMonitor();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.utils.DocumentMonitorBase#getFactory()
+	 */
+	@Override
+	public SourceDocumentFactory getFactory() {
+		if (documentFactory == null) {
+			documentFactory = new JFaceDocumentFactory();
+		}
+		return documentFactory;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.utils.DocumentMonitorBase#
+	 * isSourceEditable(com.nokia.tracebuilder.source.SourceDocumentInterface)
+	 */
+	@Override
+	public boolean isSourceEditable(SourceDocumentInterface source) {
+		ITextEditor editor = ((JFaceDocumentWrapper) source).getTextEditor();
+		return editor != null && editor.isEditable();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.utils.DocumentMonitorBase#setFocus()
+	 */
+	@Override
+	public void setFocus() {
+		IEditorPart editor = PlatformUI.getWorkbench()
+				.getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+		if (editor != null) {
+			editor.setFocus();
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.utils.DocumentMonitorBase#getSelectedSource()
+	 */
+	@Override
+	public SourceDocumentInterface getSelectedSource() {
+		SourceDocumentInterface retval = null;
+		IEditorPart editor = PlatformUI.getWorkbench()
+				.getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+		if (editor instanceof ITextEditor) {
+			for (SourceDocumentInterface source : this) {
+				JFaceDocumentWrapper props = (JFaceDocumentWrapper) source;
+				if (props.getTextEditor() == editor) {
+					retval = props;
+					break;
+				}
+			}
+		}
+		return retval;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.utils.DocumentMonitorBase#
+	 * getSelection(com.nokia.tracebuilder.source.SourceDocumentInterface)
+	 */
+	@Override
+	public OffsetLength getSelection(SourceDocumentInterface document) {
+		ITextSelection selection = (ITextSelection) ((JFaceDocumentWrapper) document)
+				.getTextEditor().getSelectionProvider().getSelection();
+		OffsetLength retval;
+		if (selection != null) {
+			retval = new OffsetLength();
+			retval.offset = selection.getOffset();
+			retval.length = selection.getLength();
+		} else {
+			retval = null;
+		}
+		return retval;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.eclipse.WorkbenchListenerCallback#
+	 * editorOpened(org.eclipse.ui.texteditor.ITextEditor,
+	 * org.eclipse.core.resources.IFile)
+	 */
+	public void editorOpened(ITextEditor editor, IFile file) {
+		if (projectMonitor.isFileActive(file)) {
+			IDocumentProvider provider = editor.getDocumentProvider();
+			IEditorInput input = editor.getEditorInput();
+			IDocument document = provider.getDocument(input);
+			documentOpened(document, editor, input);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.eclipse.WorkbenchListenerCallback#
+	 * editorActivated(org.eclipse.ui.texteditor.ITextEditor,
+	 * org.eclipse.core.resources.IFile)
+	 */
+	public void editorActivated(ITextEditor editor, IFile file) {
+		IDocumentProvider provider = editor.getDocumentProvider();
+		IDocument document = provider.getDocument(editor.getEditorInput());
+		documentActivated(document);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.eclipse.WorkbenchListenerCallback#
+	 * editorReplaced(org.eclipse.ui.texteditor.ITextEditor,
+	 * org.eclipse.core.resources.IFile)
+	 */
+	public void editorReplaced(ITextEditor editor, IFile file) {
+		if (projectMonitor.isFileActive(file)) {
+			IDocumentProvider provider = editor.getDocumentProvider();
+			IEditorInput input = editor.getEditorInput();
+			IDocument document = provider.getDocument(editor.getEditorInput());
+			documentReplaced(input, document);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.eclipse.WorkbenchListenerCallback#
+	 * editorHidden(org.eclipse.ui.texteditor.ITextEditor,
+	 * org.eclipse.core.resources.IFile)
+	 */
+	public void editorHidden(ITextEditor editor, IFile file) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.eclipse.WorkbenchListenerCallback#
+	 * editorVisible(org.eclipse.ui.texteditor.ITextEditor,
+	 * org.eclipse.core.resources.IFile)
+	 */
+	public void editorVisible(ITextEditor editor, IFile file) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.eclipse.WorkbenchListenerCallback#
+	 * editorClosed(org.eclipse.ui.texteditor.ITextEditor,
+	 * org.eclipse.core.resources.IFile)
+	 */
+	public void editorClosed(ITextEditor editor, IFile file) {
+		if (editor != null) {
+			IDocumentProvider provider = editor.getDocumentProvider();
+			if (provider != null) {
+				IDocument document = provider.getDocument(editor
+						.getEditorInput());
+				if (document != null) {
+					documentClosed(document);
+				}
+			}
+		}
+	}
+
+	/**
+	 * Processes a document that has been opened. This locates the trace entries
+	 * from the document and creates corresponding TraceLocation objects. The
+	 * trace locations are updated by a position updater object when the
+	 * document changes.
+	 * 
+	 * @param document
+	 *            the document that was opened
+	 * @param editor
+	 *            the text editor associated to the document
+	 * @param input
+	 *            editor input for the document
+	 */
+	private void documentOpened(IDocument document, ITextEditor editor,
+			IEditorInput input) {
+		JFaceDocumentWrapper foundSource = null;
+		for (SourceDocumentInterface source : this) {
+			if (((JFaceDocumentWrapper) source).getTextEditor()
+					.getEditorInput().equals(input)) {
+				foundSource = (JFaceDocumentWrapper) source;
+				break;
+			}
+		}
+		if (foundSource == null) {
+			foundSource = new JFaceDocumentWrapper(document);
+			foundSource.setTextEditor(editor);
+			foundSource.sourceOpened(this);
+			addSource(foundSource);
+		}
+	}
+
+	/**
+	 * Document activated event
+	 * 
+	 * @param document
+	 *            the document
+	 */
+	private void documentActivated(IDocument document) {
+		for (SourceDocumentInterface source : this) {
+			if (((JFaceDocumentWrapper) source).getDocument() == document) {
+				((JFaceDocumentWrapper) source).getSelectionListener()
+						.disableNextSelectionEvent();
+				break;
+			}
+		}
+	}
+
+	/**
+	 * Document replaced event
+	 * 
+	 * @param input
+	 *            the editor input
+	 * @param document
+	 *            the new document
+	 */
+	private void documentReplaced(IEditorInput input, IDocument document) {
+		JFaceDocumentWrapper foundSource = null;
+		for (SourceDocumentInterface source : this) {
+			if (((JFaceDocumentWrapper) source).getTextEditor()
+					.getEditorInput().equals(input)) {
+				foundSource = (JFaceDocumentWrapper) source;
+				break;
+			}
+		}
+		if (foundSource != null) {
+			documentClosed(foundSource.getDocument());
+			documentOpened(document, foundSource.getTextEditor(), input);
+		}
+	}
+
+	/**
+	 * Processes a document close notification. This removes the source from the
+	 * sources list and calls sourceClosed
+	 * 
+	 * @param document
+	 *            the document that was closed
+	 */
+	private void documentClosed(IDocument document) {
+		for (SourceDocumentInterface source : this) {
+			if (((JFaceDocumentWrapper) source).getDocument() == document) {
+				removeSource(source);
+				((JFaceDocumentWrapper) source).sourceClosed();
+				break;
+			}
+		}
+	}
+
+	/**
+	 * Selection change notification
+	 * 
+	 * @param source
+	 *            the source
+	 * @param offset
+	 *            the offset
+	 * @param length
+	 *            the length
+	 */
+	void selectionChanged(JFaceDocumentWrapper source, int offset, int length) {
+		getProcessor().selectionChanged(source, offset, length);
+	}
+
+	/**
+	 * Notification before source is changed
+	 * 
+	 * @param source
+	 *            the source
+	 * @param offset
+	 *            the offset
+	 * @param length
+	 *            the length
+	 * @param newText
+	 *            the new text
+	 */
+	void sourceAboutToBeChanged(SourceDocumentInterface source, int offset,
+			int length, String newText) {
+		getProcessor().sourceAboutToBeChanged(source, offset, length, newText);
+	}
+
+	/**
+	 * Source change notification
+	 * 
+	 * @param source
+	 *            the source
+	 * @param offset
+	 *            the offset
+	 * @param length
+	 *            the length
+	 * @param newText
+	 *            the new text
+	 */
+	void sourceChanged(SourceDocumentInterface source, int offset, int length,
+			String newText) {
+		getProcessor().sourceChanged(source, offset, length, newText);
+	}
+
+	/**
+	 * Source save notification
+	 * 
+	 * @param source
+	 *            the source
+	 */
+	void sourceSaved(JFaceDocumentWrapper source) {
+		getProcessor().sourceSaved(source);
+
+		projectMonitor.sourceSaved(source);
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.eclipse/src/com/nokia/tracebuilder/eclipse/WorkbenchListener.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,283 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Workbench listener
+*
+*/
+package com.nokia.tracebuilder.eclipse;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorReference;
+import org.eclipse.ui.IPageListener;
+import org.eclipse.ui.IPartListener2;
+import org.eclipse.ui.IWindowListener;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPartReference;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.texteditor.ITextEditor;
+
+import com.nokia.tracebuilder.file.FileUtils;
+
+/**
+ * Workbench listener
+ * 
+ */
+final class WorkbenchListener implements IWindowListener, IPageListener,
+		IPartListener2 {
+
+	/**
+	 * List of open windows
+	 */
+	private ArrayList<IWorkbenchWindow> windowList = new ArrayList<IWorkbenchWindow>();
+
+	/**
+	 * Callback for editor notifications
+	 */
+	private WorkbenchListenerCallback callback;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param callback
+	 *            callback for editor notifications
+	 */
+	WorkbenchListener(WorkbenchListenerCallback callback) {
+		this.callback = callback;
+	}
+
+	/**
+	 * Starts this listener
+	 */
+	void startListener() {
+		PlatformUI.getWorkbench().addWindowListener(this);
+		IWorkbenchWindow[] windows = PlatformUI.getWorkbench()
+				.getWorkbenchWindows();
+		for (IWorkbenchWindow element : windows) {
+			windowOpened(element);
+		}
+	}
+
+	/**
+	 * Stops this listener
+	 */
+	void stopListener() {
+		Iterator<IWorkbenchWindow> itr;
+		do {
+			itr = windowList.iterator();
+			if (itr.hasNext()) {
+				windowClosed(itr.next());
+			}
+		} while (itr.hasNext());
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ui.IWindowListener#
+	 *      windowActivated(org.eclipse.ui.IWorkbenchWindow)
+	 */
+	public void windowActivated(IWorkbenchWindow window) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ui.IWindowListener#
+	 *      windowDeactivated(org.eclipse.ui.IWorkbenchWindow)
+	 */
+	public void windowDeactivated(IWorkbenchWindow window) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ui.IWindowListener#
+	 *      windowClosed(org.eclipse.ui.IWorkbenchWindow)
+	 */
+	public void windowClosed(IWorkbenchWindow window) {
+		window.removePageListener(this);
+		windowList.remove(window);
+		IWorkbenchPage[] pages = window.getPages();
+		for (IWorkbenchPage element : pages) {
+			pageClosed(element);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ui.IWindowListener#
+	 *      windowOpened(org.eclipse.ui.IWorkbenchWindow)
+	 */
+	public void windowOpened(IWorkbenchWindow window) {
+		boolean found = false;
+		for (int j = 0; j < windowList.size(); j++) {
+			if (windowList.get(j) == window) {
+				found = true;
+			}
+		}
+		if (!found) {
+			window.addPageListener(this);
+			IWorkbenchPage[] pages = window.getPages();
+			for (IWorkbenchPage element : pages) {
+				pageOpened(element);
+			}
+			windowList.add(window);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ui.IPageListener#pageActivated(org.eclipse.ui.IWorkbenchPage)
+	 */
+	public void pageActivated(IWorkbenchPage page) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ui.IPageListener#pageClosed(org.eclipse.ui.IWorkbenchPage)
+	 */
+	public void pageClosed(IWorkbenchPage page) {
+		page.removePartListener(this);
+		IEditorReference[] editors = page.getEditorReferences();
+		for (IEditorReference element : editors) {
+			partClosed(element);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ui.IPageListener#pageOpened(org.eclipse.ui.IWorkbenchPage)
+	 */
+	public void pageOpened(IWorkbenchPage page) {
+		page.addPartListener(this);
+		IEditorReference[] references = page.getEditorReferences();
+		for (IEditorReference element : references) {
+			partOpened(element);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ui.IPartListener2#partOpened(org.eclipse.ui.IWorkbenchPartReference)
+	 */
+	public void partOpened(IWorkbenchPartReference partRef) {
+		IFile file = WorkbenchUtils.getEditorFile(partRef);
+		if (file != null && FileUtils.isFileAllowed(file.getName())) {
+			callback.editorOpened((ITextEditor) ((IEditorReference) partRef)
+					.getEditor(false), file);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ui.IPartListener2#partClosed(org.eclipse.ui.IWorkbenchPartReference)
+	 */
+	public void partClosed(IWorkbenchPartReference partRef) {
+		if (partRef != null) {
+			IFile file = WorkbenchUtils.getEditorFile(partRef);
+
+			if (partRef instanceof IEditorReference) {
+				IEditorPart editorPart = ((IEditorReference) partRef)
+						.getEditor(false);
+				// Check that editorPart is instance of ITextEditor
+				if (editorPart instanceof ITextEditor) {
+					// Variable file might be null, but it does not matter. So
+					// null check is not needed.
+					callback.editorClosed((ITextEditor) editorPart, file);
+				}
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ui.IPartListener2#partActivated(org.eclipse.ui.IWorkbenchPartReference)
+	 */
+	public void partActivated(IWorkbenchPartReference partRef) {
+		IFile file = WorkbenchUtils.getEditorFile(partRef);
+		if (file != null && FileUtils.isFileAllowed(file.getName())) {
+			callback.editorActivated((ITextEditor) ((IEditorReference) partRef)
+					.getEditor(false), file);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ui.IPartListener2#partDeactivated(org.eclipse.ui.IWorkbenchPartReference)
+	 */
+	public void partDeactivated(IWorkbenchPartReference partRef) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ui.IPartListener2#partInputChanged(org.eclipse.ui.IWorkbenchPartReference)
+	 */
+	public void partInputChanged(IWorkbenchPartReference partRef) {
+		IFile file = WorkbenchUtils.getEditorFile(partRef);
+		if (file != null && FileUtils.isFileAllowed(file.getName())) {
+			callback.editorReplaced((ITextEditor) ((IEditorReference) partRef)
+					.getEditor(false), file);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ui.IPartListener2#partBroughtToTop(org.eclipse.ui.IWorkbenchPartReference)
+	 */
+	public void partBroughtToTop(IWorkbenchPartReference partRef) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ui.IPartListener2#partVisible(org.eclipse.ui.IWorkbenchPartReference)
+	 */
+	public void partVisible(IWorkbenchPartReference partRef) {
+		IFile file = WorkbenchUtils.getEditorFile(partRef);
+		if (file != null && FileUtils.isFileAllowed(file.getName())) {
+			callback.editorVisible((ITextEditor) ((IEditorReference) partRef)
+					.getEditor(false), file);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ui.IPartListener2#partHidden(org.eclipse.ui.IWorkbenchPartReference)
+	 */
+	public void partHidden(IWorkbenchPartReference partRef) {
+		IFile file = WorkbenchUtils.getEditorFile(partRef);
+		if (file != null && FileUtils.isFileAllowed(file.getName())) {
+			callback.editorHidden((ITextEditor) ((IEditorReference) partRef)
+					.getEditor(false), file);
+		}
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.eclipse/src/com/nokia/tracebuilder/eclipse/WorkbenchListenerCallback.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Callback for workbench listener
+*
+*/
+package com.nokia.tracebuilder.eclipse;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.ui.texteditor.ITextEditor;
+
+/**
+ * Callback for workbench listener
+ * 
+ */
+interface WorkbenchListenerCallback {
+
+	/**
+	 * Editor opened notification
+	 * 
+	 * @param editor
+	 *            the editor
+	 * @param file
+	 *            the editor resource
+	 */
+	void editorOpened(ITextEditor editor, IFile file);
+
+	/**
+	 * Editor activated notification
+	 * 
+	 * @param editor
+	 *            the editor
+	 * @param file
+	 *            the editor resource
+	 */
+	void editorActivated(ITextEditor editor, IFile file);
+
+	/**
+	 * Editor content replaced notification
+	 * 
+	 * @param editor
+	 *            the editor
+	 * @param file
+	 *            the new editor resource
+	 */
+	void editorReplaced(ITextEditor editor, IFile file);
+
+	/**
+	 * Editor closed notification
+	 * 
+	 * @param editor
+	 *            the editor
+	 * @param file
+	 *            the editor resource
+	 */
+	void editorClosed(ITextEditor editor, IFile file);
+
+	/**
+	 * Editor visible notification
+	 * 
+	 * @param editor
+	 *            the editor
+	 * @param file
+	 *            the editor resource
+	 */
+	void editorVisible(ITextEditor editor, IFile file);
+
+	/**
+	 * Editor hidden notification
+	 * 
+	 * @param editor
+	 *            the editor
+	 * @param file
+	 *            the editor resource
+	 */
+	void editorHidden(ITextEditor editor, IFile file);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.eclipse/src/com/nokia/tracebuilder/eclipse/WorkbenchUtils.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,220 @@
+/*
+ * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ * Utility functions for workbench monitoring
+ *
+ */
+package com.nokia.tracebuilder.eclipse;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.net.URI;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorReference;
+import org.eclipse.ui.IPathEditorInput;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPartReference;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.texteditor.IDocumentProvider;
+import org.eclipse.ui.texteditor.ITextEditor;
+
+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.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.file.FileUtils;
+
+/**
+ * Utility functions for workbench monitoring
+ * 
+ */
+final class WorkbenchUtils {
+
+	/**
+	 * Gets the path from given editor input
+	 * 
+	 * @param input
+	 *            the editor input
+	 * @return the path
+	 */
+	static String getEditorInputPath(IEditorInput input) {
+		String ret = null;
+		// Eclipse 3.2
+		if (input instanceof IPathEditorInput) {
+			IPathEditorInput pathInput = (IPathEditorInput) input;
+			if (pathInput.exists()) {
+				IPath path = ((IPathEditorInput) input).getPath();
+				if (path != null) {
+					ret = path.toOSString();
+				}
+			}
+		} else {
+			// Eclipse 3.3 might not be present
+			try {
+				Class<?> uriEditor = Class
+						.forName("org.eclipse.ui.IURIEditorInput"); //$NON-NLS-1$
+				if (uriEditor.isAssignableFrom(input.getClass())) {
+					Method m = uriEditor.getMethod("getURI"); //$NON-NLS-1$
+					URI uri = (URI) m.invoke(input);
+					if (uri != null) {
+						ret = uri.getPath();
+					}
+				}
+			} catch (ClassNotFoundException e) {
+			} catch (SecurityException e) {
+			} catch (NoSuchMethodException e) {
+			} catch (IllegalArgumentException e) {
+			} catch (IllegalAccessException e) {
+			} catch (InvocationTargetException e) {
+			}
+		}
+		return ret;
+	}
+
+	/**
+	 * Checks if there are any editors open
+	 * 
+	 * @return true if editors are open, false if not
+	 */
+	static boolean isEditorsOpen() {
+		boolean editorOpen = false;
+		IWorkbenchWindow[] windows = PlatformUI.getWorkbench()
+				.getWorkbenchWindows();
+		for (IWorkbenchWindow window : windows) {
+			IWorkbenchPage[] pages = window.getPages();
+			for (IWorkbenchPage page : pages) {
+				IEditorReference[] refs = page.getEditorReferences();
+				for (IEditorReference ref : refs) {
+					IFile file = WorkbenchUtils.getEditorFile(ref);
+					if (file != null && FileUtils.isFileAllowed(file.getName())) {
+						editorOpen = true;
+						break;
+					}
+				}
+				if (editorOpen) {
+					break;
+				}
+			}
+			if (editorOpen) {
+				break;
+			}
+		}
+		return editorOpen;
+	}
+
+	/**
+	 * Checks if the editor is valid and returns the file the editor is
+	 * associated to
+	 * 
+	 * @param partRef
+	 *            the editor reference
+	 * @return the editor file
+	 */
+	static IFile getEditorFile(IWorkbenchPartReference partRef) {
+		IFile editorFile = null;
+		if (partRef instanceof IEditorReference) {
+			IEditorPart editor = ((IEditorReference) partRef).getEditor(false);
+			if (editor instanceof ITextEditor) {
+				IDocumentProvider provider = ((ITextEditor) editor)
+						.getDocumentProvider();
+				if (provider != null) {
+					IEditorInput input = editor.getEditorInput();
+					if (input instanceof IPathEditorInput) {
+						IPath path = null;
+
+						IPathEditorInput pathEditorInput = (IPathEditorInput) input;
+						if (pathEditorInput.exists()) {
+							path = pathEditorInput.getPath();
+						}
+
+						if (path != null) {
+							IWorkspaceRoot root = ResourcesPlugin
+									.getWorkspace().getRoot();
+
+							IFile[] fileArr = root
+									.findFilesForLocationURI(FileUtils
+											.makeURI(path));
+							// There can be only one file with this path
+							if (fileArr != null && fileArr.length > 0) {
+								editorFile = fileArr[0];
+							}
+						}
+
+					}
+				}
+			}
+		}
+		return editorFile;
+	}
+
+	/**
+	 * 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.
+	 */
+	static 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;
+	}
+
+	/**
+	 * Posts user include added message
+	 * 
+	 * @param mmpPath
+	 *            MMP path
+	 */
+	protected static void postUserIncludeMsg(IPath mmpPath) {
+		String msg = Messages.getString("WorkbenchUtils.UserIncludeMsg"); //$NON-NLS-1$
+
+		// Post the message
+		TraceBuilderGlobals.getEvents().postInfoMessage(msg,
+				mmpPath.lastSegment());
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.eclipse/src/com/nokia/tracebuilder/eclipse/messages.properties	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,1 @@
+WorkbenchUtils.UserIncludeMsg=Userinclude to traces folder added to MMP file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.eventhandler/.classpath	Wed Jun 23 14:35:40 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/tracebuilder/com.nokia.tracebuilder.eventhandler/.settings/org.eclipse.core.resources.prefs	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,3 @@
+#Wed Feb 14 14:57:54 EET 2007
+eclipse.preferences.version=1
+encoding//src/com/nokia/tracebuilder/eventhandler/messages.properties=8859_1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.eventhandler/.settings/org.eclipse.jdt.core.prefs	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,8 @@
+#Mon Oct 05 11:26:27 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/tracebuilder/com.nokia.tracebuilder.eventhandler/META-INF/MANIFEST.MF	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,18 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: TraceBuilder Event Handler Plug-in
+Bundle-SymbolicName: com.nokia.tracebuilder.eventhandler;singleton:=true
+Bundle-Version: 2.4.0
+Bundle-Activator: com.nokia.tracebuilder.eventhandler.Activator
+Bundle-Vendor: Nokia
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.ui,
+ com.nokia.tracebuilder,
+ com.nokia.trace.eventview,
+ com.nokia.trace.eventrouter,
+ com.nokia.tracebuilder.view,
+ com.nokia.carbide.trk.support
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.eventhandler/about.html	Wed Jun 23 14:35:40 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 9, 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 the License "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/tracebuilder/com.nokia.tracebuilder.eventhandler/build.properties	Wed Jun 23 14:35:40 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/tracebuilder/com.nokia.tracebuilder.eventhandler/plugin.properties	Wed Jun 23 14:35:40 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 Trace Builder Event Handler
+# This file should be translated.
+traceEventView=Trace Events
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.eventhandler/plugin.xml	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+   <extension
+         point="org.eclipse.ui.startup">
+      <startup class="com.nokia.tracebuilder.eventhandler.EventHandlerStartup"/>
+   </extension>
+   
+
+</plugin>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.eventhandler/src/com/nokia/tracebuilder/eventhandler/Activator.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,85 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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.tracebuilder.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.tracebuilder.eventhandler"; //$NON-NLS-1$
+
+	/**
+	 * The shared instance
+	 */
+	private static Activator plugin;
+
+	/**
+	 * Event handler
+	 */
+	TraceBuilderEventHandler handler;
+
+	/**
+	 * 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 {
+		handler = new TraceBuilderEventHandler();
+		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;
+		if (handler != null) {
+			handler.shutdown();
+		}
+		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/tracebuilder/com.nokia.tracebuilder.eventhandler/src/com/nokia/tracebuilder/eventhandler/EventAdder.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,95 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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.tracebuilder.eventhandler;
+
+import com.nokia.trace.eventrouter.TraceEvent;
+import com.nokia.trace.eventview.EventListEntry;
+import com.nokia.trace.eventview.TraceEventList;
+import com.nokia.tracebuilder.engine.TraceLocation;
+import com.nokia.tracebuilder.model.TraceObject;
+import com.nokia.tracebuilder.source.SourceLocation;
+
+/**
+ * Asynchronously adds an event to the events list
+ * 
+ */
+final class EventAdder implements Runnable {
+
+	/**
+	 * Event to be added
+	 */
+	private TraceEvent event;
+
+	/**
+	 * The event list
+	 */
+	private TraceEventList eventList;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param eventList
+	 *            the event list
+	 * @param event
+	 *            the event to be added
+	 */
+	EventAdder(TraceEventList eventList, TraceEvent event) {
+		this.event = event;
+		this.eventList = eventList;
+		Object o = event.getSource();
+		// Adds a reference so the location does not get removed from the source
+		if (o instanceof SourceLocation) {
+			((SourceLocation) o).reference();
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Runnable#run()
+	 */
+	public void run() {
+		Object o = event.getSource();
+		EventListEntry entry = null;
+		if (o instanceof TraceLocation) {
+			// Location delete flag needs to be checked, since this is
+			// called asynchronously. The location might have been deleted
+			TraceLocation location = (TraceLocation) o;
+			if (!location.isDeleted()) {
+				entry = new EventListEntryTraceLocation(event.getType(), event
+						.getDescription(), eventList, location);
+			}
+		} else if (o instanceof TraceObject) {
+			TraceObject object = (TraceObject) o;
+			entry = new EventListEntryTraceObject(event.getType(), event
+					.getDescription(), object);
+		} else if (o instanceof SourceLocation) {
+			SourceLocation location = (SourceLocation) o;
+			if (!location.isDeleted()) {
+				entry = new EventListEntrySourceLocation(event.getType(), event
+						.getDescription(), eventList, location);
+			}
+		}
+		if (entry != null) {
+			entry.setCategory(event.getCategory());
+			eventList.addEntry(entry);
+		}
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.eventhandler/src/com/nokia/tracebuilder/eventhandler/EventHandlerStartup.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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.tracebuilder.eventhandler;
+
+import org.eclipse.ui.IStartup;
+
+/**
+ * Plugin startup class
+ * 
+ */
+public final class EventHandlerStartup implements IStartup {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ui.IStartup#earlyStartup()
+	 */
+	public void earlyStartup() {
+		// Nothing to be done
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.eventhandler/src/com/nokia/tracebuilder/eventhandler/EventListEntryInvalidTraceLocation.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,69 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* An error that location is not valid
+*
+*/
+package com.nokia.tracebuilder.eventhandler;
+
+import com.nokia.trace.eventview.TraceEventList;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorMessages;
+import com.nokia.tracebuilder.engine.TraceLocation;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.TraceBuilderErrorCode;
+
+/**
+ * An error that location is not valid
+ * 
+ */
+final class EventListEntryInvalidTraceLocation extends
+		EventListEntryTraceLocation {
+
+	/**
+	 * Constructor
+	 * @param errorType 
+	 *            the error type 				
+	 * @param eventList
+	 *            the event list
+	 * @param location
+	 *            the location
+	 */
+	EventListEntryInvalidTraceLocation(int errorType, TraceEventList eventList,
+			TraceLocation location) {
+		super(errorType, TraceBuilderErrorMessages.getErrorMessage(
+				location.getValidityCode(), location.getValidityParameters()),
+				eventList, location);
+		setCategory(Messages
+				.getString("InvalidLocationEntryAdder.InvalidLocationEventCategory")); //$NON-NLS-1$
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.eventhandler.EventListEntryTraceLocation#
+	 *      locationValid(boolean)
+	 */
+	@Override
+	public void locationValidityChanged(TraceLocation location) {
+		TraceBuilderErrorCode code = location.getValidityCode();
+		if (code == TraceBuilderErrorCode.OK) {
+			eventList.removeEntry(this);
+		} else {
+			setDescription(TraceBuilderErrorMessages
+			.getErrorMessage(code, location.getValidityParameters()));
+			
+		}
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.eventhandler/src/com/nokia/tracebuilder/eventhandler/EventListEntryLocationCountError.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* An error that trace does not have or has more than one location
+*
+*/
+package com.nokia.tracebuilder.eventhandler;
+
+import com.nokia.trace.eventrouter.TraceEvent;
+import com.nokia.trace.eventview.TraceEventList;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorMessages;
+import com.nokia.tracebuilder.engine.TraceLocationList;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.TraceBuilderErrorCode;
+import com.nokia.tracebuilder.model.Trace;
+
+/**
+ * An error that trace does not have or has more than one location
+ * 
+ */
+class EventListEntryLocationCountError extends EventListEntryTraceObject {
+
+	/**
+	 * The event list
+	 */
+	private TraceEventList eventList;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param eventList
+	 *            the event list
+	 * @param trace
+	 *            the trace
+	 */
+	EventListEntryLocationCountError(TraceEventList eventList, Trace trace) {
+		super(TraceEvent.ERROR, "", trace); //$NON-NLS-1$
+		String category = Messages
+				.getString("InvalidLocationEntryAdder.InvalidLocationEventCategory"); //$NON-NLS-1$
+		setCategory(category);
+		this.eventList = eventList;
+		update();
+	}
+
+	/**
+	 * Updates the description of this error
+	 */
+	void update() {
+		TraceLocationList list = getObject().getExtension(
+				TraceLocationList.class);
+		String msg;
+		if (list == null || list.getLocationCount() == 0) {
+			msg = TraceBuilderErrorMessages.getErrorMessage(
+					TraceBuilderErrorCode.TRACE_HAS_NO_LOCATIONS, null);
+		} else {
+			msg = TraceBuilderErrorMessages.getErrorMessage(
+					TraceBuilderErrorCode.TRACE_HAS_MULTIPLE_LOCATIONS, null);
+		}
+		setDescription(msg);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.eventhandler.EventListEntryTraceObject#objectDeleted()
+	 */
+	@Override
+	public void objectDeleted() {
+		eventList.removeEntry(this);
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.eventhandler/src/com/nokia/tracebuilder/eventhandler/EventListEntrySourceLocation.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,152 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 reference to TraceLocation
+*
+*/
+package com.nokia.tracebuilder.eventhandler;
+
+import com.nokia.trace.eventview.EventListEntryString;
+import com.nokia.trace.eventview.TraceEventList;
+import com.nokia.tracebuilder.source.SourceLocation;
+import com.nokia.tracebuilder.source.SourceLocationListener;
+
+/**
+ * Event list entry, which contains a reference to SourceLocation
+ * 
+ */
+class EventListEntrySourceLocation extends EventListEntryString implements
+		SourceLocationListener {
+
+	/**
+	 * The location of this entry
+	 */
+	protected SourceLocation location;
+
+	/**
+	 * Event list
+	 */
+	protected TraceEventList eventList;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param type
+	 *            event type
+	 * @param description
+	 *            event description
+	 * @param eventList
+	 *            the event list
+	 * @param location
+	 *            the event location
+	 */
+	public EventListEntrySourceLocation(int type, String description,
+			TraceEventList eventList, SourceLocation location) {
+		// getSourceName is overridden in this class -> Pass null to superclass
+		super(type, description, null);
+		this.eventList = eventList;
+		this.location = location;
+		location.addLocationListener(this);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.trace.eventview.EventListEntryString#setDescription(java.lang.String)
+	 */
+	@Override
+	protected void setDescription(String description) {
+		super.setDescription(description);
+		eventList.updateEntry(this);
+	}
+
+	/**
+	 * Gets the location
+	 * 
+	 * @return the location
+	 */
+	public SourceLocation getLocation() {
+		return location;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.trace.eventview.EventListEntryString#hasSource()
+	 */
+	@Override
+	protected boolean hasSource() {
+		return location != null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceLocationListener#
+	 *      locationDeleted(com.nokia.tracebuilder.source.SourceLocation)
+	 */
+	public void locationDeleted(SourceLocation location) {
+		eventList.removeEntry(this);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceLocationListener#
+	 *      locationChanged(com.nokia.tracebuilder.source.SourceLocation)
+	 */
+	public void locationChanged(SourceLocation location) {
+		eventList.updateEntry(this);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.trace.eventview.EventListEntry#reset()
+	 */
+	@Override
+	protected void reset() {
+		location.removeLocationListener(this);
+		// This will cause a locationDeleted event -> Listener is removed first
+		location.dereference();
+		super.reset();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.trace.eventview.EventListEntryString#getSource()
+	 */
+	@Override
+	protected Object getSource() {
+		return location;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.trace.eventview.EventListEntryString#getSourceName()
+	 */
+	@Override
+	protected String getSourceName() {
+		StringBuffer buffer = new StringBuffer();
+		buffer.append(location.getFileName());
+		buffer.append(Messages
+				.getString("EventListEntrySourceLocation.FileLineSeparator")); //$NON-NLS-1$
+		buffer.append(location.getLineNumber());
+		return buffer.toString();
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.eventhandler/src/com/nokia/tracebuilder/eventhandler/EventListEntryTraceLocation.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,103 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 reference to TraceLocation
+*
+*/
+package com.nokia.tracebuilder.eventhandler;
+
+import org.eclipse.jface.action.IMenuManager;
+
+import com.nokia.trace.eventview.TraceEventList;
+import com.nokia.tracebuilder.action.TraceViewActions;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceLocation;
+import com.nokia.tracebuilder.engine.TraceLocationListener;
+
+/**
+ * Event list entry, which contains a reference to TraceLocation
+ * 
+ */
+class EventListEntryTraceLocation extends EventListEntrySourceLocation
+		implements TraceLocationListener {
+
+	/**
+	 * Constructor
+	 * 
+	 * @param type
+	 *            event type
+	 * @param description
+	 *            event description
+	 * @param eventList
+	 *            the event list
+	 * @param location
+	 *            the event location
+	 */
+	public EventListEntryTraceLocation(int type, String description,
+			TraceEventList eventList, TraceLocation location) {
+		super(type, description, eventList, location);
+	}
+
+	/**
+	 * Gets the location
+	 * 
+	 * @return the location
+	 */
+	public TraceLocation getTraceLocation() {
+		return (TraceLocation) location;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.trace.eventview.EventListEntryString#hasSourceActions()
+	 */
+	@Override
+	protected boolean hasSourceActions() {
+		return hasSource();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.trace.eventview.EventListEntryString#
+	 *      addSourceActions(org.eclipse.jface.action.IMenuManager)
+	 */
+	@Override
+	protected void addSourceActions(IMenuManager manager) {
+		((TraceViewActions) TraceBuilderGlobals.getActions())
+				.fillContextMenu(manager);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceLocationListener#
+	 *      locationContentChanged(com.nokia.tracebuilder.engine.TraceLocation)
+	 */
+	public void locationContentChanged(TraceLocation location) {
+		eventList.updateEntry(this);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceLocationListener#
+	 *      locationValidityChanged(com.nokia.tracebuilder.engine.TraceLocation)
+	 */
+	public void locationValidityChanged(TraceLocation location) {
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.eventhandler/src/com/nokia/tracebuilder/eventhandler/EventListEntryTraceObject.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,186 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 reference to TraceObject
+*
+*/
+package com.nokia.tracebuilder.eventhandler;
+
+import org.eclipse.jface.action.IMenuManager;
+
+import com.nokia.trace.eventview.EventListEntryString;
+import com.nokia.tracebuilder.action.TraceViewActions;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.model.TraceObject;
+import com.nokia.tracebuilder.model.TraceObjectRuleOnDelete;
+
+/**
+ * Event list entry, which contains a reference to TraceObject. This implements
+ * OnDelete so the event gets removed from the list when the actual object is
+ * removed.
+ * 
+ */
+class EventListEntryTraceObject extends EventListEntryString implements
+		TraceObjectRuleOnDelete {
+
+	/**
+	 * Event object
+	 */
+	private TraceObject object;
+
+	/**
+	 * Object name
+	 */
+	private String objectName;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param type
+	 *            event type
+	 * @param description
+	 *            event description
+	 * @param object
+	 *            the event object
+	 */
+	EventListEntryTraceObject(int type, String description, TraceObject object) {
+		// getSourceName is overridden in this class -> Pass null to superclass
+		super(type, description, null);
+		this.object = object;
+		object.addExtension(this);
+	}
+
+	/**
+	 * Gets the object
+	 * 
+	 * @return the object
+	 */
+	TraceObject getObject() {
+		return object;
+	}
+
+	/**
+	 * Links the event to a new object. The existing object must be null and
+	 * have the same name as the new object
+	 * 
+	 * @param object
+	 *            the new object
+	 */
+	void setObject(TraceObject object) {
+		this.object = object;
+		object.addExtension(this);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.trace.eventview.EventListEntryString#hasSourceActions()
+	 */
+	@Override
+	protected boolean hasSourceActions() {
+		return object != null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.trace.eventview.EventListEntryString#hasSource()
+	 */
+	@Override
+	protected boolean hasSource() {
+		return object != null || objectName != null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.trace.eventview.EventListEntryString#getSource()
+	 */
+	@Override
+	protected Object getSource() {
+		return object != null ? object : objectName;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.trace.eventview.EventListEntryString#
+	 *      addSourceActions(org.eclipse.jface.action.IMenuManager)
+	 */
+	@Override
+	protected void addSourceActions(IMenuManager manager) {
+		if (object != null) {
+			((TraceViewActions) TraceBuilderGlobals.getActions())
+					.fillContextMenu(manager);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceObjectRuleOnDelete#objectDeleted()
+	 */
+	public void objectDeleted() {
+		// Removes the object reference
+		// -> Menu actions will no longer be available
+		if (object != null) {
+			objectName = object.getName();
+		}
+		object = null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelExtension#
+	 *      setOwner(com.nokia.tracebuilder.model.TraceObject)
+	 */
+	public void setOwner(TraceObject owner) {
+		// Already set in constructor
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelExtension#getOwner()
+	 */
+	public TraceObject getOwner() {
+		return object;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.trace.eventview.EventListEntry#reset()
+	 */
+	@Override
+	protected void reset() {
+		if (object != null) {
+			object.removeExtension(this);
+		}
+		super.reset();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.trace.eventview.EventListEntryString#getSourceName()
+	 */
+	@Override
+	protected String getSourceName() {
+		return object != null ? object.getName() : objectName;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.eventhandler/src/com/nokia/tracebuilder/eventhandler/EventListLocationListListener.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,127 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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.tracebuilder.eventhandler;
+
+import com.nokia.trace.eventview.TraceEventList;
+import com.nokia.tracebuilder.engine.LastKnownLocation;
+import com.nokia.tracebuilder.engine.LastKnownLocationListListener;
+import com.nokia.tracebuilder.engine.TraceLocation;
+import com.nokia.tracebuilder.engine.TraceLocationListListener;
+import com.nokia.tracebuilder.model.Trace;
+
+/**
+ * Location list listener for event view collects invalid locations to the event
+ * list
+ * 
+ */
+final class EventListLocationListListener implements TraceLocationListListener,
+		LastKnownLocationListListener {
+
+	/**
+	 * Event handler
+	 */
+	private TraceBuilderEventHandler eventHandler;
+
+	/**
+	 * Location validity listener
+	 */
+	private EventListLocationValidityListener validityListener;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param eventHandler
+	 *            the event handler
+	 * @param eventList
+	 *            the event list
+	 */
+	EventListLocationListListener(TraceBuilderEventHandler eventHandler,
+			TraceEventList eventList) {
+		this.eventHandler = eventHandler;
+		validityListener = new EventListLocationValidityListener(eventList);
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceLocationListListener#
+	 *      locationAdded(com.nokia.tracebuilder.engine.TraceLocation)
+	 */
+	public void locationAdded(TraceLocation location) {
+		// If a location is moved from list to another, it will already
+		// contain a validity listener
+		Object existing = location.getProperties().getEventViewReference();
+		if (existing == null) {
+			location.addLocationListener(validityListener);
+			location.getProperties().setEventViewReference(validityListener);
+		}
+		// If the trace contains a location warning extension, it is updated
+		Trace trace = location.getTrace();
+		if (trace != null) {
+			eventHandler.checkTraceValidity(trace);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceLocationListListener#
+	 *      locationRemoved(com.nokia.tracebuilder.engine.TraceLocation)
+	 */
+	public void locationRemoved(TraceLocation location) {
+		// The listener is not removed here, since this is also called when
+		// the location is moved from one location list to another.
+		// The listener removes itself from the location when the location
+		// is actually deleted
+		Trace trace = location.getTrace();
+		if (trace != null) {
+			eventHandler.checkTraceValidity(trace);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.LastKnownLocationListListener#
+	 *      locationAdded(com.nokia.tracebuilder.engine.LastKnownLocation)
+	 */
+	public void locationAdded(LastKnownLocation location) {
+		// Last known locations cannot be added without removing normal
+		// locations -> Trace cannot have a HasNoLocations entry here
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.LastKnownLocationListListener#
+	 *      locationRemoved(com.nokia.tracebuilder.engine.LastKnownLocation)
+	 */
+	public void locationRemoved(LastKnownLocation location) {
+		// The listener is not removed here, since this is also called when
+		// the location is moved from one location list to another.
+		// The listener removes itself from the location when the location
+		// is actually deleted
+		Trace trace = location.getTrace();
+		if (trace != null) {
+			eventHandler.checkTraceValidity(trace);
+		}
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.eventhandler/src/com/nokia/tracebuilder/eventhandler/EventListLocationValidityListener.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,110 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 validity listener
+*
+*/
+package com.nokia.tracebuilder.eventhandler;
+
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.trace.eventview.TraceEventList;
+import com.nokia.tracebuilder.engine.TraceLocation;
+import com.nokia.tracebuilder.engine.TraceLocationListener;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.TraceBuilderErrorCode;
+import com.nokia.tracebuilder.source.SourceLocation;
+
+/**
+ * Monitors the validity of a source location and creates an entry to the view
+ * when the location becomes invalid. The entry removes itself when the location
+ * becomes invalid.
+ * 
+ */
+final class EventListLocationValidityListener implements TraceLocationListener {
+
+	/**
+	 * TraceEventView ID
+	 */
+	private static final String TRACEVENTVIEW_ID = "com.nokia.trace.eventview.TraceEventView"; //$NON-NLS-1$
+	
+	/**
+	 * Event list
+	 */
+	private TraceEventList eventList;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param eventList
+	 *            the event list
+	 */
+	EventListLocationValidityListener(TraceEventList eventList) {
+		this.eventList = eventList;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceLocationListener#
+	 *      locationChanged(com.nokia.tracebuilder.source.SourceLocation)
+	 */
+	public void locationChanged(SourceLocation location) {
+		// Processed by the entry
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceLocationListener#
+	 *      locationDeleted(com.nokia.tracebuilder.source.SourceLocation)
+	 */
+	public void locationDeleted(SourceLocation location) {
+		// The entry removes itself from the view
+		location.removeLocationListener(this);
+		((TraceLocation) location).getProperties().setEventViewReference(null);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceLocationListener#locationContentChanged()
+	 */
+	public void locationContentChanged(TraceLocation location) {
+		// Processed by the entry
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceLocationListener#locationValidityChanged()
+	 */
+	public void locationValidityChanged(TraceLocation location) {
+		// The entry removes itself from the view when location becomes valid.
+		// This listener remains in the location and creates a new view
+		// entry if location becomes invalid again
+		if (location.getValidityCode() != TraceBuilderErrorCode.OK) {
+			if (!eventList.isViewerEnabled()) {
+				try {
+					PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(TRACEVENTVIEW_ID);
+				} catch (PartInitException e) {
+
+				}
+			}
+			eventList.asyncExec(new InvalidLocationEntryAdder(eventList,
+					location));
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.eventhandler/src/com/nokia/tracebuilder/eventhandler/EventListSelectionListener.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 listener for the event view
+*
+*/
+package com.nokia.tracebuilder.eventhandler;
+
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+
+import com.nokia.trace.eventview.EventListEntry;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceLocation;
+import com.nokia.tracebuilder.source.SourceLocation;
+
+/**
+ * Selection listener for the event view
+ * 
+ */
+final class EventListSelectionListener implements ISelectionChangedListener {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.viewers.ISelectionChangedListener#
+	 *      selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
+	 */
+	public void selectionChanged(SelectionChangedEvent event) {
+		IStructuredSelection selection = (IStructuredSelection) event
+				.getSelection();
+		if (!selection.isEmpty()) {
+			EventListEntry entry = (EventListEntry) selection.getFirstElement();
+			if (entry instanceof EventListEntryTraceObject) {
+				TraceBuilderGlobals.getTraceBuilder().traceObjectSelected(
+						((EventListEntryTraceObject) entry).getObject(), true, false);
+			} else if (entry instanceof EventListEntryTraceLocation) {
+				TraceLocation location = ((EventListEntryTraceLocation) entry)
+						.getTraceLocation();
+				if (!location.isDeleted()) {
+					TraceBuilderGlobals.getTraceBuilder().locationSelected(
+							location.getLocationList(), location, true);
+				}
+			} else if (entry instanceof EventListEntrySourceLocation) {
+				SourceLocation location = ((EventListEntrySourceLocation) entry)
+						.getLocation();
+				location.selectFromSource();
+			}
+		}
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.eventhandler/src/com/nokia/tracebuilder/eventhandler/InvalidLocationEntryAdder.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies 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 invalid location to the events list
+ *
+ */
+package com.nokia.tracebuilder.eventhandler;
+
+import java.util.Iterator;
+
+import com.nokia.trace.eventrouter.TraceEvent;
+import com.nokia.trace.eventview.EventListEntry;
+import com.nokia.trace.eventview.TraceEventList;
+import com.nokia.trace.eventview.TraceEventView;
+import com.nokia.tracebuilder.engine.TraceLocation;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.TraceBuilderErrorCode;
+
+/**
+ * Asynchronously adds an invalid location to the events list
+ * 
+ */
+final class InvalidLocationEntryAdder implements Runnable {
+
+	/**
+	 * Event list
+	 */
+	private TraceEventList eventList;
+
+	/**
+	 * The location to be added to the list
+	 */
+	private TraceLocation location;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param eventList
+	 *            the event list
+	 * @param location
+	 *            the location to be added
+	 */
+	InvalidLocationEntryAdder(TraceEventList eventList, TraceLocation location) {
+		this.eventList = eventList;
+		this.location = location;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Runnable#run()
+	 */
+	public void run() {
+		// The location might changed to valid while waiting for async operation
+		// to start
+		if (!location.isDeleted()
+				&& location.getValidityCode() != TraceBuilderErrorCode.OK) {
+			boolean existingFound = false;
+			Iterator<EventListEntry> itr = eventList.getEntries(location);
+			while (itr.hasNext()) {
+				EventListEntry e = itr.next();
+				if (e instanceof EventListEntryInvalidTraceLocation) {
+					existingFound = true;
+				}
+			}
+			if (!existingFound) {
+				// The entry is deleted when trace location is deleted
+				// or when it becomes valid
+				TraceBuilderErrorCode validityCode = location.getValidityCode();
+				int errorType = TraceEvent.ERROR;
+
+				// In case of "Trace needs to be converted to correct API"
+				// validity code change error type to info
+				if (validityCode
+						.equals(TraceBuilderErrorCode.TRACE_NEEDS_CONVERSION)) {
+					errorType = TraceEvent.INFO;
+				}
+				
+				// Add new event to TraceEventView
+				EventListEntryInvalidTraceLocation entry = new EventListEntryInvalidTraceLocation(
+						errorType, eventList, location);
+				eventList.addEntry(entry);
+				
+				// Inform TraceEventView that it's context has changed
+				if (TraceEventView.contentChangeListener != null) {
+					TraceEventView.contentChangeListener.contentChanged();
+				}
+				
+				// Adds a reference to the location. The location is
+				// dereferenced when removed from the list
+				location.reference();
+			}
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.eventhandler/src/com/nokia/tracebuilder/eventhandler/Messages.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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.tracebuilder.eventhandler;
+
+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.tracebuilder.eventhandler.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/tracebuilder/com.nokia.tracebuilder.eventhandler/src/com/nokia/tracebuilder/eventhandler/TraceBuilderEventHandler.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,385 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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.tracebuilder.eventhandler;
+
+import java.util.Iterator;
+
+import com.nokia.trace.eventrouter.TraceEvent;
+import com.nokia.trace.eventview.EventListEntry;
+import com.nokia.trace.eventview.EventListEntryString;
+import com.nokia.trace.eventview.TraceEventHandler;
+import com.nokia.trace.eventview.TraceEventList;
+import com.nokia.trace.eventview.TraceEventView;
+import com.nokia.tracebuilder.engine.LastKnownLocationList;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceLocationList;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceConstantTable;
+import com.nokia.tracebuilder.model.TraceConstantTableEntry;
+import com.nokia.tracebuilder.model.TraceGroup;
+import com.nokia.tracebuilder.model.TraceModel;
+import com.nokia.tracebuilder.model.TraceModelExtension;
+import com.nokia.tracebuilder.model.TraceModelExtensionListener;
+import com.nokia.tracebuilder.model.TraceModelListener;
+import com.nokia.tracebuilder.model.TraceModelResetListener;
+import com.nokia.tracebuilder.model.TraceObject;
+import com.nokia.tracebuilder.model.TraceParameter;
+import com.nokia.tracebuilder.rules.HiddenTraceObjectRule;
+import com.nokia.tracebuilder.source.SourceLocation;
+
+/**
+ * Content provider for the event view
+ * 
+ */
+public final class TraceBuilderEventHandler implements TraceModelListener,
+		TraceModelResetListener, TraceEventHandler, TraceModelExtensionListener {
+
+	/**
+	 * Event list from event view plug-in
+	 */
+	private TraceEventList eventList;
+
+	/**
+	 * Location list listener
+	 */
+	private EventListLocationListListener locationListListener;
+
+	/**
+	 * Selection listener for the event view
+	 */
+	private EventListSelectionListener selectionListener;
+
+	/**
+	 * Constructor
+	 */
+	TraceBuilderEventHandler() {
+		selectionListener = new EventListSelectionListener();
+		eventList = TraceEventView.getEventList();
+		// Adds listeners to model and event list
+		TraceBuilderGlobals.getTraceModel().addModelListener(this);
+		TraceBuilderGlobals.getTraceModel().addResetListener(this);
+		TraceBuilderGlobals.getTraceModel().addExtensionListener(this);
+		eventList.addEventHandler(this);
+		eventList.addSelectionListener(selectionListener);
+		locationListListener = new EventListLocationListListener(this,
+				eventList);
+		// The model may contain multiple location lists, one for each parser
+		Iterator<TraceLocationList> lists = TraceBuilderGlobals.getTraceModel()
+				.getExtensions(TraceLocationList.class);
+		while (lists.hasNext()) {
+			lists.next().addLocationListListener(locationListListener);
+		}
+	}
+
+	/**
+	 * Shutdown
+	 */
+	void shutdown() {
+		// Removes the listeners from model and event list
+		TraceBuilderGlobals.getTraceModel().getExtension(
+				TraceLocationList.class).removeLocationListListener(
+				locationListListener);
+		TraceBuilderGlobals.getTraceModel().removeModelListener(this);
+		TraceBuilderGlobals.getTraceModel().removeResetListener(this);
+		TraceBuilderGlobals.getTraceModel().removeExtensionListener(this);
+		eventList.removeEventHandler(this);
+		eventList.removeSelectionListener(selectionListener);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelListener#
+	 *      objectAdded(com.nokia.tracebuilder.model.TraceObject,
+	 *      com.nokia.tracebuilder.model.TraceObject)
+	 */
+	public void objectAdded(TraceObject owner, TraceObject object) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelListener#
+	 *      objectCreationComplete(com.nokia.tracebuilder.model.TraceObject)
+	 */
+	public void objectCreationComplete(TraceObject object) {
+		if (object.getModel().isValid()) {
+			HiddenTraceObjectRule hiddenRule = object
+					.getExtension(HiddenTraceObjectRule.class);
+			if (hiddenRule == null) {
+				String event = getAddEventTitle(object);
+				if (event != null) {
+					addObjectCreationEvent(object, event);
+				}
+			}
+		}
+	}
+
+	/**
+	 * Adds an object creation event
+	 * 
+	 * @param object
+	 *            the object
+	 * @param event
+	 *            the event title
+	 */
+	private void addObjectCreationEvent(TraceObject object, String event) {
+		// If the auto-converter is running, creation events are not
+		// logged. However, an existing trace might have been
+		// re-created due to save operation and thus the new trace
+		// is linked to that
+		if (!TraceBuilderGlobals.getSourceContextManager().isConverting()) {
+			EventListEntry entry = new EventListEntryTraceObject(
+					TraceEvent.INFO, event, object);
+			entry.setCategory(TraceBuilderGlobals.getEvents()
+					.getEventCategory());
+			eventList.addEntry(entry);
+		} else {
+			for (EventListEntry entry : eventList) {
+				if (entry instanceof EventListEntryTraceObject) {
+					EventListEntryTraceObject objEntry = (EventListEntryTraceObject) entry;
+					if (objEntry.getObject() == null) {
+						if (objEntry.getSourceName().equals(object.getName())) {
+							objEntry.setObject(object);
+							break;
+						}
+					}
+				}
+			}
+		}
+	}
+
+	/**
+	 * Gets the creation event title for given object
+	 * 
+	 * @param object
+	 *            the object
+	 * @return the event title
+	 */
+	private String getAddEventTitle(TraceObject object) {
+		String event = null;
+		if (object instanceof Trace) {
+			event = Messages
+					.getString("EventListContentProvider.TraceAddedEvent"); //$NON-NLS-1$
+		} else if (object instanceof TraceGroup) {
+			event = Messages
+					.getString("EventListContentProvider.GroupAddedEvent"); //$NON-NLS-1$
+		} else if (object instanceof TraceParameter) {
+			event = Messages
+					.getString("EventListContentProvider.ParameterAddedEvent"); //$NON-NLS-1$
+		} else if (object instanceof TraceConstantTable) {
+			event = Messages
+					.getString("EventListContentProvider.ConstantTableAddedEvent"); //$NON-NLS-1$
+		} else if (object instanceof TraceConstantTableEntry) {
+			event = Messages
+					.getString("EventListContentProvider.ConstantTableEntryAddedEvent"); //$NON-NLS-1$
+		}
+		return event;
+	}
+
+	/**
+	 * Gets the creation event title for given object
+	 * 
+	 * @param object
+	 *            the object
+	 * @return the event title
+	 */
+	private String getRemoveEventTitle(TraceObject object) {
+		String event = null;
+		if (object instanceof Trace) {
+			event = Messages
+					.getString("EventListContentProvider.TraceRemovedEvent"); //$NON-NLS-1$
+		} else if (object instanceof TraceGroup) {
+			event = Messages
+					.getString("EventListContentProvider.GroupRemovedEvent"); //$NON-NLS-1$
+		} else if (object instanceof TraceParameter) {
+			event = Messages
+					.getString("EventListContentProvider.ParameterRemovedEvent"); //$NON-NLS-1$
+		} else if (object instanceof TraceConstantTable) {
+			event = Messages
+					.getString("EventListContentProvider.ConstantTableRemovedEvent"); //$NON-NLS-1$
+		} else if (object instanceof TraceConstantTableEntry) {
+			event = Messages
+					.getString("EventListContentProvider.ConstantTableEntryRemovedEvent"); //$NON-NLS-1$
+		}
+		return event;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelListener#
+	 *      objectRemoved(com.nokia.tracebuilder.model.TraceObject,
+	 *      com.nokia.tracebuilder.model.TraceObject)
+	 */
+	public void objectRemoved(TraceObject owner, TraceObject object) {
+		// If the auto-converter is running, creation events are not logged
+		if (!TraceBuilderGlobals.getSourceContextManager().isConverting()) {
+			HiddenTraceObjectRule hiddenRule = object
+					.getExtension(HiddenTraceObjectRule.class);
+			if (hiddenRule == null) {
+				EventListEntry entry = new EventListEntryString(
+						TraceEvent.INFO, getRemoveEventTitle(object), object
+								.getName());
+				entry.setCategory(TraceBuilderGlobals.getEvents()
+						.getEventCategory());
+				eventList.addEntry(entry);
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelListener#
+	 *      propertyUpdated(com.nokia.tracebuilder.model.TraceObject, int)
+	 */
+	public void propertyUpdated(TraceObject object, int property) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelResetListener#modelReset()
+	 */
+	public void modelReset() {
+		eventList.removeAll(SourceLocation.class);
+		for (EventListEntry entry : eventList) {
+			if (entry instanceof EventListEntryTraceObject) {
+				((EventListEntryTraceObject) entry).objectDeleted();
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelResetListener#modelResetting()
+	 */
+	public void modelResetting() {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelResetListener#modelValid(boolean)
+	 */
+	public void modelValid(boolean valid) {
+		if (valid) {
+			Iterator<TraceGroup> groups = TraceBuilderGlobals.getTraceModel()
+					.getGroups();
+			while (groups.hasNext()) {
+				Iterator<Trace> traces = groups.next().getTraces();
+				while (traces.hasNext()) {
+					Trace trace = traces.next();
+					checkTraceValidity(trace);
+				}
+			}
+		}
+	}
+
+	/**
+	 * Checks that trace is referenced in source files
+	 * 
+	 * @param trace
+	 *            the trace
+	 */
+	void checkTraceValidity(Trace trace) {
+		TraceLocationList list = trace.getExtension(TraceLocationList.class);
+		LastKnownLocationList plist = trace
+				.getExtension(LastKnownLocationList.class);
+		int locCount = 0;
+		if (list != null) {
+			locCount = list.getLocationCount();
+		}
+		if (plist != null) {
+			locCount += plist.getLocationCount();
+		}
+		EventListEntryLocationCountError entry = trace
+				.getExtension(EventListEntryLocationCountError.class);
+		if (locCount == 0 || locCount > 1) {
+			if (entry == null) {
+				entry = new EventListEntryLocationCountError(eventList, trace);
+				eventList.addEntry(entry);
+			} else {
+				entry.update();
+			}
+		} else {
+			if (entry != null) {
+				eventList.removeEntry(entry);
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.trace.eventview.TraceEventHandler#
+	 *      handleEvent(com.nokia.trace.eventrouter.TraceEvent)
+	 */
+	public boolean handleEvent(TraceEvent event) {
+		boolean retval = false;
+		Object o = event.getSource();
+		if (o instanceof SourceLocation || o instanceof TraceObject) {
+			eventList.asyncExec(new EventAdder(eventList, event));
+			retval = true;
+		}
+		return retval;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelExtensionListener#
+	 *      extensionAdded(com.nokia.tracebuilder.model.TraceObject,
+	 *      com.nokia.tracebuilder.model.TraceModelExtension)
+	 */
+	public void extensionAdded(TraceObject object, TraceModelExtension extension) {
+		if (object instanceof Trace || object instanceof TraceModel) {
+			if (extension instanceof TraceLocationList) {
+				TraceLocationList list = (TraceLocationList) extension;
+				list.addLocationListListener(locationListListener);
+			} else if (extension instanceof LastKnownLocationList) {
+				LastKnownLocationList list = (LastKnownLocationList) extension;
+				list.addLocationListListener(locationListListener);
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelExtensionListener#
+	 *      extensionRemoved(com.nokia.tracebuilder.model.TraceObject,
+	 *      com.nokia.tracebuilder.model.TraceModelExtension)
+	 */
+	public void extensionRemoved(TraceObject object,
+			TraceModelExtension extension) {
+		if (object instanceof Trace || object instanceof TraceModel) {
+			if (extension instanceof TraceLocationList) {
+				TraceLocationList list = (TraceLocationList) extension;
+				list.removeLocationListListener(locationListListener);
+			} else if (extension instanceof LastKnownLocationList) {
+				LastKnownLocationList list = (LastKnownLocationList) extension;
+				list.removeLocationListListener(locationListListener);
+			}
+		}
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.eventhandler/src/com/nokia/tracebuilder/eventhandler/messages.properties	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,12 @@
+EventListContentProvider.TraceAddedEvent=Trace Added
+EventListContentProvider.GroupAddedEvent=Group Added
+EventListContentProvider.ParameterAddedEvent=Parameter Added
+EventListContentProvider.ConstantTableAddedEvent=Enum Added
+EventListContentProvider.ConstantTableEntryAddedEvent=Enum Value Added
+EventListEntrySourceLocation.FileLineSeparator=, line 
+InvalidLocationEntryAdder.InvalidLocationEventCategory=Locations
+EventListContentProvider.TraceRemovedEvent=Trace Removed
+EventListContentProvider.GroupRemovedEvent=Group Removed
+EventListContentProvider.ParameterRemovedEvent=Parameter Removed
+EventListContentProvider.ConstantTableRemovedEvent=Enum Removed
+EventListContentProvider.ConstantTableEntryRemovedEvent=Enum Value Removed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.eventhandler/src/com/nokia/tracebuilder/eventhandler/package.html	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,3 @@
+<html><body>
+Implements a view for list of events generated by TraceBuilder
+</body></html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.help/.classpath	Wed Jun 23 14:35:40 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/tracebuilder/com.nokia.tracebuilder.help/.settings/org.eclipse.jdt.core.prefs	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,8 @@
+#Mon Oct 05 11:26:47 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/tracebuilder/com.nokia.tracebuilder.help/META-INF/MANIFEST.MF	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,9 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: TraceBuilder Help Plug-in
+Bundle-SymbolicName: com.nokia.tracebuilder.help; singleton:=true
+Bundle-Version: 2.4.0
+Bundle-Vendor: Nokia
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.help/about.html	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,24 @@
+<!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 20, 2010</p>
+
+<h3>Copyright</h3>
+
+<p>Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights
+reserved.<br>
+License: <a
+href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.</p>
+
+<p></p>
+
+<p></p>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.help/book.css	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,183 @@
+/*	
+	Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. 
+	License: http://www.eclipse.org/legal/epl-v10.html
+*/
+
+/*	Add whitespace around entire display to avoid crowding edges of view 	*/
+/* 	20070523-Removed top margin size to close gap between location breadcrumbs and page title	*/
+html {
+	margin: 2px 10px 10px 10px;
+	}
+
+/* 	Set default font to serif style, 12-pt and plain	*/
+body, p, table {
+	font-family: Verdana, Helvetica, Arial, sans-serif;
+	font-size: 13px;
+	font-weight: normal;
+}
+
+/*	Use sans-serif fonts for all title styles	*/
+h1, h2, h3, h4, h5, h6, strong, em {
+	font-family: Verdana, Helvetica, Arial, sans-serif;
+	color: #000000;	
+	}
+
+h1	{ font-size:20px }
+h2	{ font-size:18px }
+h3	{ font-size:16px }
+h4	{ font-size:14px }
+h5	{ font-size:13px }
+h6	{ font-size:12px }
+
+/*	For headlines at the top of a view, add space	*/
+/*	20090224-changed green fade to gold header image	*/
+h1, h2, h3 {
+	background-image: url(html/images/gold_header.png);
+	background-repeat: no-repeat;
+	padding:10px 0px 10px 12px;	
+	}
+
+li	{
+	margin-bottom:8px;	
+	margin-top:8px;
+	}
+
+/*	Footer includes space and a gray line above the company logo	*/
+#footer {
+	padding-top:10px;
+	margin-top:20px;
+	border-top:1px solid #999;
+	font-family: Helvetica, sans-serif;
+	font-size: 11px;
+	color:#333;
+	}
+
+.listing	{
+	font-family: "Courier New", Courier, mono;
+	color: #000000;
+	background-color: #FFFFCC;
+	margin: 5px 0px;
+	}
+		
+.code, pre	{
+	font-family: "Courier New", Courier, mono;
+	font-size: 13px;
+	color: #000000;
+	}
+
+.step	{
+	/* background-color: #EEE; */
+	/* margin: 10px 0px; */
+	/* color: #111; */
+	/* border-bottom:2px solid #EEE; */
+	}
+	
+.substep	{
+	background-color: #EEE;
+	}
+	
+	
+/*	Figure/Listing/Table titles are centered and gray	*/
+p.table {
+	color: #999;
+	font-weight: bold;
+	padding-top: 5px;
+	}
+
+table	{
+	border: solid #999 1px;
+	table-layout: auto;
+	font-size: 13px;
+	}
+
+td, th	{
+	border: solid #999 1px;
+	padding: 5px;
+	vertical-align:top;
+	}
+	
+/*	20070522-replaced gray with green background to match gradiant color for title	*/
+th	{
+	background-color:#FFC550;	/* background-color:#acd79b;
+	background-color:#999;
+	color:#FFF; */
+	}
+
+div.ol.p	{
+	margin-left: 3em;
+	}
+
+/* Make all ordered/unordered list items appear in bold gray */
+div ol > li, div ul > li {
+	font-weight:bold;
+	color: #333;
+	}
+
+div ol > p, div ul > p, div li > p {
+	font-weight:normal;
+	}
+	
+/* Make all H4 and H5 items appear in bold gray against a light green background */
+div h5, div h4	{
+	padding:5px 0px 5px 12px;
+	background-color:#FDCB2F;
+	/* background-color: #EEE; */
+	font-weight:bold;
+	color: #000000;
+	}
+	
+	
+/*	Notes stand out using a light top & bottom borders with dark gray text	*/
+p.note {
+	/* color: #03C; */
+	/* background-color: #FFFF99; */
+	color: #333;
+	padding: 5px;
+	margin-left: 1em;
+	margin-right: 1em;
+	border-top: solid #BBB thin;
+	border-bottom: solid #BBB thin;
+	}
+
+	
+/*	Figure/Listing/Table titles are centered and gray	*/
+p.figure {
+	color: #333;
+	text-align: center;
+	font-weight: bold;
+	}
+
+/*	highly visible red background and white text for things that need fixing before release	*/
+/*  SHOULD NOT BE PRESENT IN RELEASED PRODUCTS */
+.fix	{
+	background-color: red;
+	font-weight: bold;
+	color: white;
+	}
+
+.question	{
+	font-style:italic;
+	font-weight:bold;
+	color: #555;
+	}
+	
+.titleSmall {
+	font-family: Helvetica, sans-serif;
+	font-size: 11px;
+	}
+
+	
+.plain {
+	font-family: Helvetica, sans-serif;
+	font-size: 12px;
+	font-style: normal;
+	line-height: normal;
+	font-weight: normal;
+	font-variant: normal;
+	color: #000000;
+	text-decoration: none;
+	}
+
+a:link 		{ color: #0033CC }
+a:visited	{ color: #555555 }
+a:hover 	{ color: #0033CC }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.help/build.properties	Wed Jun 23 14:35:40 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/tracebuilder/com.nokia.tracebuilder.help/html/concepts/concepts.htm	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,22 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 1.0 Transitional//EN" >
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>Concepts</title>
+<link rel="StyleSheet" href="../../book.css" type="text/css"/>
+</head>
+<body bgcolor="#FFFFFF">
+
+<h2>Concepts</h2>
+<p>The following concepts provide information on TraceBuilder 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="dictionaryfile.htm">Dictionary file</a></li>
+	<li><a href="tracecompiler.htm">Trace Compiler</a></li>
+</ul>
+
+<div id="footer">Copyright &copy; 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/tracebuilder/com.nokia.tracebuilder.help/html/concepts/dictionaryfile.htm	Wed Jun 23 14:35:40 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>Dictionary file</title>
+<link href="../../book.css" type="text/css" rel="stylesheet"></head>
+<body>
+
+<h2>Dictionary file</h2>
+<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>
+<p>In Carbide.c++, the dictionary files are loaded to the TraceViewer application. 
+Traces can then be activated and decoded. For more information, see TraceViewer's Online
+Help under <b>Help > Help Contents > Carbide Tools > TraceViewer</b>.</p>
+
+<h5>Related concepts</h5>
+<ul>
+	<li><a href="tracecompiler.htm">Trace Compiler</a></li>
+</ul>
+
+<div id="footer">Copyright &copy; 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/tracebuilder/com.nokia.tracebuilder.help/html/concepts/trace_format.htm	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,38 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
+<title>Open System Trace (OST)</title>
+<link href="../../book.css" type="text/css" rel="stylesheet"></head>
+<body>
+
+<h2>Open System Trace (OST)</h2>
+<p>The Open System Trace (OST) trace format for data transfer 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 the <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>
+
+<h5>Related concepts</h5>
+<ul>
+	<li><a href="tracecompiler.htm">Trace Compiler</a></li>
+</ul>
+
+<div id="footer">Copyright &copy; 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/tracebuilder/com.nokia.tracebuilder.help/html/concepts/tracecompiler.htm	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,44 @@
+<!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: <br></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></p>  
+<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>
+<p></p>
+
+<h5>Related concepts</h5>
+<ul>
+	<li><a href="trace_format.htm">Open System Trace (OST)</a></li>
+</ul>
+
+<div id="footer">Copyright &copy; 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/tracebuilder/com.nokia.tracebuilder.help/html/concepts/tracing.htm	Wed Jun 23 14:35:40 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>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><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">Open System Trace (OST)</a></li>
+</ul>
+
+<h5>Related tasks</h5>
+<ul>
+	<li><a href="../tasks/addingtraces.htm">Adding traces to the source code</a></li>
+	<li><a href="../tasks/addingparameters.htm">Adding parameters to existing traces</a></li>
+</ul>
+
+<div id="footer">Copyright &copy; 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/tracebuilder/com.nokia.tracebuilder.help/html/contexts.xml	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?NLS TYPE="org.eclipse.help.contexts"?>
+<contexts>
+
+<context id="TREE_VIEWER">
+ 	<description>Help on the Trace Builder</description>
+ 	<topic label="Menubar" href="html/reference/menubar.htm"/>
+	<topic label="Basic steps" href="html/gettingstarted/basic_steps.htm"/>
+ 	<topic label="Adding traces" href="html/tasks/addingtraces.htm"/>
+ 	<topic label="Adding parameters" href="html/tasks/addingparameters.htm"/>
+ 	<topic label="Adding Enumerations" href="html/tasks/enumerations.htm"/>
+ 	<topic label="Function Instrumenter" href="html/tasks/instrumenting.htm"/>
+ 	<topic label="Other tasks..." href="html/tasks/tasks.htm"/>
+ 	<topic label="Non-source files" href="html/reference/nonsourcefiles.htm" />
+</context>
+
+<context id="ADD_TRACE">
+ 	<description>You can add traces to source code</description>	   
+ 	<topic label="Adding traces" href="html/tasks/addingtraces.htm"/>
+</context>
+
+<context id="ADD_PARAMETER">
+ 	<description>You can add parameters to a existing trace</description>	   
+ 	<topic label="Adding parameters" href="html/tasks/addingparameters.htm"/>
+</context>
+
+<context id="ADD_ENUM">
+ 	<description>You can add Enumerations to your trace project</description>	   
+ 	<topic label="Adding Enumerations" href="html/tasks/enumerations.htm"/>
+</context>
+
+<context id="EDIT_PROPERTIES">
+ 	<description>You can edit properties of an trace object in this dialog</description>
+</context>
+
+<context id="DELETE_OBJECT">
+ 	<description>You can delete trace object from project</description>
+</context>
+
+<context id="DELETE_TRACES">
+ 	<description>You can delete multiple traces at once from this dialog</description>	   
+ 	<topic label="Deleting traces" href="html/tasks/deletingtraces.htm"/>
+</context>
+
+<context id="INSERT_TRACE">
+ 	<description>Inserts a copy of currently selected trace to a selected offset in the source code</description>
+</context>
+
+<context id="REMOVE_TRACE">
+ 	<description>Removes a trace from source</description>
+</context> 
+
+<context id="REMOVE_UNRELATED">
+ 	<description>Removes all unrelated traces from source</description>
+</context> 
+
+<context id="CONVERT_TRACE">
+ 	<description>Converts selected trace to OST trace</description>	   
+ 	<topic label="Converting traces to OST traces" href="html/tasks/converting.htm"/>
+</context> 
+
+<context id="INSTRUMENTER">
+ 	<description>Function instrumenter is used to instrument multiple traces at once</description>	   
+ 	<topic label="Function instrumenter" href="html/tasks/instrumenting.htm"/>
+</context> 
+
+<context id="PARSE_ENUM" title="Enumeration parser">
+	<description>Enumeration parser can be used to parse existing Enumeration from source</description>
+	<topic label="Enumeration parser" href="html/tasks/enumerations.htm"/>
+</context>
+
+<context id="GENERAL_PREFERENCES" title="General preferences">
+	<description>Trace Builder general preferences</description>
+	<topic label="General preferences" href="html/tasks/preferences.htm"/>
+</context>
+
+<context id="SELECT_COMPONENT">
+ 	<description>In this dialog you need to select component, that you are going to work with</description>	   
+</context>
+</contexts>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.help/html/gettingstarted/basic_steps.htm	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,42 @@
+<!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>TraceBuilder basic steps</title>
+<link href="../../book.css" type="text/css" rel="stylesheet"></head>
+<body>
+
+<h2>TraceBuilder basic steps</h2>
+<p>Open the TraceBuilder tool in either of the following ways: </p>
+<ul>
+	<li>From the <b>Carbide > TraceBuilder</b> menu. </li>
+	<li>From the  <b>Window > Show view > Other > Carbide extensions</b> menu.</li>
+</ul>
+<p>Using Open System Traces (OST) involves the following steps: </p>
+<ol>
+	<li>Open or create a Carbide.c++ project.</li>
+	<li><a href="../tasks/addingtraces.htm">Add traces to the source code</a> 
+		using the TraceBuilder menu.</li>
+	<li>After a trace has been added, you can:
+	<ul>
+		<li><a href="../tasks/addingparameters.htm">add parameters to existing traces</a></li>
+		<li><a href="../tasks/enumerations.htm">add enumerations</a></li>
+		<li><a href="../tasks/instrumenting.htm">instrument traces in the source code</a></li>
+	</ul>
+	</li>
+	<li><a href="../tasks/setprojectandcompile.htm">Set your project's include paths 
+		and compile</a> your component with OST traces. </li>
+</ol>
+<p><b>Note:</b> If you have existing <code>Printf</code> traces, <a href="../tasks/converting.htm">
+convert them to OST traces</a> in TraceBuilder. </p>
+
+<h5>Related concepts</h5>
+<ul>
+	<li><a href="../concepts/tracecompiler.htm">Trace Compiler</a></li>
+	<li><a href="../concepts/trace_format.htm">Open System Trace (OST)</a></li>
+</ul>
+
+<div id="footer">Copyright &copy; 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/tracebuilder/com.nokia.tracebuilder.help/html/gettingstarted/gs_index.htm	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,22 @@
+<!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 Trace Builder.</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; 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/tracebuilder/com.nokia.tracebuilder.help/html/gettingstarted/overview.htm	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,25 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
+<title>TraceBuilder overview</title>
+<link href="../../book.css" type="text/css" rel="stylesheet"></head>
+<body>
+
+<h2>TraceBuilder overview</h2>
+<p>TraceBuilder is a tool for adding traces in the Carbide.c++ Integrated 
+Development Environment (IDE).</p>
+<p>With the tool, you can easily add Open System Traces (OST) to your component. 
+The OST solution includes the following features: </p>
+<ul>
+	<li>Sending traces from the device to tool.</li>
+	<li>Activating traces from the 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>
+
+<div id="footer">Copyright &copy; 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/tracebuilder/com.nokia.tracebuilder.help/html/images/about_cpp.png has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.help/html/images/background_carbide.jpg has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.help/html/images/brandmark_cpp.gif has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.help/html/images/gold_header.png has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.help/html/images/green_fade_left_68_165_28.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.help/html/index.xml	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,46 @@
+<?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="tracing" >
+		<topic href="html/concepts/tracing.htm" />
+	</entry> 
+	
+	<entry keyword="dictionary file" >
+		<topic href="html/concepts/dictionaryfile.htm" />
+	</entry>
+
+	<entry keyword="adding traces" >
+		<topic href="html/tasks/addingtraces.htm" />
+	</entry> 
+
+	<entry keyword="adding parameters to traces" >
+		<topic href="html/tasks/addingparameters.htm" />
+	</entry> 
+
+	<entry keyword="converting binary traces to OST" >
+		<topic href="html/tasks/converting.htm" />
+	</entry> 
+
+</index>
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.help/html/legal.htm	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,60 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+  <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
+  <title>License Information</title>
+  <link href="../book.css" type="text/css" rel="stylesheet">
+</head>
+
+<body>
+<h3>License Information</h3>
+
+<h5>COPYRIGHTS</h5>
+
+<p>Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights
+reserved. This component and the accompanying materials are made available
+under the terms of "Eclipse Public License v1.0" which accompanies this
+distribution and is available at the URL <a
+href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.</p>
+
+<p>Initial Contributors:<br>
+Nokia Corporation - initial contribution</p>
+
+<h5>NOTICES</h5>
+
+<p>Part of the graphics of the program are from Eclipse 3.1 platform and CDT
+project in Eclipse community, which are made available under the terms of the
+Eclipse Public License v1.0.</p>
+
+<p>A copy of the EPL is provided at <a
+href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html
+</a></p>
+
+<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; 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/tracebuilder/com.nokia.tracebuilder.help/html/reference/images/Thumbs.db has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.help/html/reference/images/iconaddenum.gif has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.help/html/reference/images/iconaddparameter.gif has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.help/html/reference/images/iconaddtrace.gif has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.help/html/reference/images/icondelete.gif has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.help/html/reference/images/icondeletetraces.gif has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.help/html/reference/images/iconinserttrace.gif has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.help/html/reference/images/iconinstrumentcode.gif has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.help/html/reference/images/iconparseenum.gif has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.help/html/reference/images/icontraceproperties.gif has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.help/html/reference/images/menubar.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.help/html/reference/menubar.htm	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,67 @@
+<!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>Menubar</title>
+<link href="../../book.css" type="text/css" rel="stylesheet"></head>
+<body>
+
+<h2>Menubar</h2>
+<p>The TraceBuilder menubar contains the following options:</p>
+<p><img src="images\menubar.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\iconaddtrace.gif"></td>
+	<td><p>To add a new trace to the source code. The trace is added to the location
+		where the cursor is at the moment.</p></td>
+</tr>
+<tr>
+	<td><img src="images\iconaddparameter.gif"></td>
+	<td><p>To add a new parameter to the currently selected trace.</p></td>
+</tr>
+<tr>
+	<td><img src="images\iconaddenum.gif"></td>
+	<td><p>To add a new Enumeration or a value to an existing Enumeration.</p></td>
+</tr>
+<tr>
+	<td><img src="images\iconparseenum.gif"></td>
+	<td><p>To parse an Enumeration. The title row of the Enumeration must be selected
+		from the source code.</p></td>
+</tr>
+<tr>
+	<td><img src="images\icontraceproperties.gif"></td>
+	<td><p>To check trace properties from the currently selected trace.</p></td>
+</tr>
+<tr>
+	<td><img src="images\icondelete.gif"></td>
+	<td><p>To delete the currently selected trace.</p></td>
+</tr>
+<tr>
+	<td><img src="images\iconinstrumentcode.gif"></td>
+	<td><p>To instrument Open System Trace (OST) traces using an instrumentation
+		template. This option can be used, for example, to instrument the entry and
+		exit traces to functions.</p></td>
+</tr>
+<tr>
+	<td><img src="images\icondeletetraces.gif"></td>
+	<td><p>To delete multiple selected traces at once. This option can also be
+		used to delete a set of previously instrumented traces.</p></td>
+</tr>
+</tbody>
+</table>
+
+<div id="footer">Copyright &copy; 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/tracebuilder/com.nokia.tracebuilder.help/html/reference/nonsourcefiles.htm	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,52 @@
+<!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>Tips and tricks</title>
+  <link href="../../book.css" type="text/css" rel="stylesheet">
+</head>
+
+<body>
+<h2>TraceBuilder tips and tricks</h2>
+
+<h3>Handling non-source files</h3>
+
+<p>TraceCompiler parses Open System Traces (OST) from source files listed in a
+project's MMP file. However, if traces need to be parsed from header files or
+inline files (<i>.inl</i>), the files need to be explicitly specified in the
+<i>trace.properties</i> property file. </p>
+
+<p>TraceBuilder does not support the definition of non-source files but you can
+define them manually by adding the needed file elements to the
+<i>trace.properties</i> property file. </p>
+
+<p>For example:</p>
+
+<p><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;<br>
+&lt;trace_properties&gt;<br>
+<b>&lt;file&gt;../inc/MyFunctions.inl&lt;/file&gt;<br>
+&lt;file&gt;../inc/MyFunctions.h&lt;/file&gt;</b><br>
+&lt;/trace_properties&gt;</code><br>
+</p>
+
+<p>The path to the file is relative to the location of the property file. The
+header file where the traces will be generated follows the same naming rules as
+the source files. From the above example, traces from both
+<i>MyFunctions.inl</i> and <i>MyFunctions.h</i> (and also
+<i>MyFunctions.cpp</i> if it exists) would go to the <i>MyFunctionsTraces.h</i>
+file.</p>
+
+<p><b>NOTE!</b> Location of the property file <i>trace.properties</i> is the
+trace directory. It could be that the property file <i>trace.properties</i>
+does not exist if there are no enumeration type definitions or non-source file
+definitions. In that case, it needs to be created manually.</p>
+
+<h5>Related concepts</h5>
+<ul>
+  <li><a href="../concepts/trace_format.htm">Open System Trace (OST)</a></li>
+</ul>
+
+<div id="footer">Copyright &copy; 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/tracebuilder/com.nokia.tracebuilder.help/html/reference/references.htm	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,20 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 1.0 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>References</title>
+<link rel="StyleSheet" href="../../book.css" type="text/css"/>
+</head>
+<body>
+
+<h2>References</h2>
+<p>The following reference is available for this tool:</p>
+<ul> 
+	<li><a href="menubar.htm">Menubar</a></li>
+	<li><a href="nonsourcefiles.htm">Tips and tricks</a></li>    
+ </ul>
+ 
+<div id="footer">Copyright &copy; 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/tracebuilder/com.nokia.tracebuilder.help/html/release_notes.htm	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,181 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+  <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
+  <title>Release notes</title>
+  <link href="../book.css" type="text/css" rel="stylesheet">
+  <style type="text/css">
+<!-- .style2 {font-size: 12px} -->
+
+  </style>
+</head>
+
+<body bgcolor="#FFFFFF">
+<h2>Release notes</h2>
+
+<h4>TraceBuilder &ndash; Version 2.4.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>The TraceBuilder extension for Carbide.c++ IDE is a tool for adding Open
+System Traces (OST) to the source code.</p>
+
+<p>TraceBuilder consists of two tools: </p>
+<ul>
+  <li><b>TraceCompiler</b> that parses OST Application Programming Interface
+    (API) format from the source files and generates the corresponding decode
+    files. </li>
+  <li><b>TraceBuilder UI</b> that enables you to add and maintain OST
+  traces.</li>
+</ul>
+
+<p>TraceBuilder can be activated by selecting the <b>Carbide &gt;
+TraceBuilder</b> menu item, or via <b>Window &gt; Show View &gt; Other... &gt;
+Carbide Extensions &gt; TraceBuilder</b>.</p>
+
+<h3><a name="features"></a>Main features</h3>
+<ul>
+  <li>UI for adding traces to source code. </li>
+  <li>UI for adding parameters to traces. </li>
+  <li>Function instrumenter. </li>
+</ul>
+
+<h3><a name="newfeatures"></a>What's new</h3>
+<ul>
+  <li>Change: TraceBuilder is now released under EPL license.</li>
+  <li>Fix: Bug fixes.</li>
+</ul>
+
+<h3><a name="installation"></a>Installation notes</h3>
+<ul>
+  <li>N/A</li>
+</ul>
+
+<h3><a name="requirements"></a>System requirements</h3>
+
+<p><b>Requirements:</b></p>
+<ul>
+  <li>Carbide.c++ 2.0.4 or newer</li>
+  <li>Java Runtime Environment JRE1.5</li>
+  <li>com.nokia.trace.eventview 1.1.0 or newer</li>
+</ul>
+
+<h3><a name="compissues"></a>Compatibility issues</h3>
+<ul>
+  <li>N/A</li>
+</ul>
+
+<h3><a name="issues"></a>Known issues</h3>
+<ul>
+  <li>TraceBuilder does not support the definition of non-source files on the
+    user interface but you can define them manually by adding the needed file
+    elements to the <i>trace.properties</i> property file. For more
+    information, see the <a href="reference/nonsourcefiles.htm">Reference &gt;
+    Tips and tricks</a> section in this help. </li>
+</ul>
+
+<h3>Version history</h3>
+
+<h5>Version 2.3.0 &ndash; 10th January 2010</h5>
+<ul>
+  <li>Change: TraceBuilder supports new name formats for <em>traces</em>
+  folder.</li>
+  <li>Fix: Bug fixes.</li>
+</ul>
+
+<h5>Version 2.2.0 &ndash; 10th January 2010</h5>
+<ul>
+  <li>Change: TraceBuilder supports OSTv1 and OSTv2.</li>
+  <li>Fix: Bug fixes.</li>
+</ul>
+
+<h5>Version 2.1.0 &ndash; 19th November 2009</h5>
+<ul>
+  <li>Change: Trace Builder show all the Trace Points for a Carbide project not
+    just a single source file.</li>
+  <li>Change: TraceBuilder updated to understand all the commonly used Group
+    IDs defined in OSTv2.</li>
+  <li>Change: Added warning to "Add "this" pointer" title.</li>
+  <li>Fix: Bug fixes.</li>
+</ul>
+
+<h5>Version 1.3.1 &ndash; 7th October 2009</h5>
+<ul>
+  <li>Change: Code cleanup.</li>
+  <li>Fix: Bug fixes.</li>
+</ul>
+
+<h5>Version 1.2.3 &ndash; 1st September 2009</h5>
+<ul>
+  <li>Fix: Bug fixes.</li>
+</ul>
+
+<h5>Version 1.2.2 &ndash; 11th August 2009</h5>
+<ul>
+  <li>Fix: Bug fixes.</li>
+</ul>
+
+<h5>Version 1.2.1 &ndash; 11th May 2009</h5>
+<ul>
+  <li>Fix: Bug fixes.</li>
+</ul>
+
+<h5>Version 1.2.0 &ndash; 16th April 2009</h5>
+<ul>
+  <li>Change: Removed <b>Insert selected trace</b> feature.</li>
+</ul>
+
+<h5>Version 1.0.42 &ndash; 26th January 2009</h5>
+<ul>
+  <li>Fix: Bug fixes.</li>
+</ul>
+
+<h5>Version 1.0.36 &ndash; 24th November 2008</h5>
+<ul>
+  <li>Change: Support to fixed group and trace ids.</li>
+  <li>Change: Add traces folder user include to MMP files if needed.</li>
+  <li>Change: Get export path from Carbide preferences.</li>
+  <li>Change: Added support to type "p" in the OST macro.</li>
+  <li>Change: Removed <b>Link with Editor</b> button. Trace Builder is now
+    always linked with an editor.</li>
+  <li>Change: Removed Dictionary preference page. Dictionary export is now
+    always defaulted to the <i>\epoc32\ost_dictionaries</i> directory.</li>
+  <li>Fix: Bug fixes.</li>
+  <li>Doc: Online Help added. </li>
+</ul>
+
+<h5>Version 1.0.27 &ndash; 28th October 2008</h5>
+
+<p>The first version.</p>
+
+<div id="footer">
+<p>Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies).<br>
+All rights reserved. <br>
+This component and the accompanying materials are made available <br>
+under the terms of "Eclipse Public License v1.0" <br>
+which accompanies this distribution and is available <br>
+at the URL <a
+href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+<br>
+<br>
+Initial Contributors:<br>
+Nokia Corporation - initial contribution <br>
+<br>
+Contributors:<br>
+Description:</p>
+
+<p></p>
+</div>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.help/html/tasks/addingparameters.htm	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,49 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title>Adding parameters to existing traces</title>
+<link href="../../book.css" type="text/css" rel="stylesheet"></head>
+<body>
+
+<h2>Adding parameters to existing traces</h2>
+<p>Parameters can be used to associate data to traces: integers, strings and enumerations. A parameter
+specifies the format in which the parameter is shown in the viewer and text
+label associated with the parameter. </p><p>To add parameters to existing
+traces, do the following: </p>
+<ol>
+	<li>Select an existing trace from either of the following places:
+		<ul>
+			<li>from the source code</li>
+			<li>from the TraceBuilder tree view. </li>
+		</ul>
+	</li>
+	<li>Click the TraceBuilder menu and select <b>Add New Parameter</b>.</li>
+	<li>In the <b>Parameter Name</b> field, enter the variable name you want to
+		add to your trace.</li>
+	<li>In the <b>Parameter Type</b> field, enter the type for your parameter.<p>
+		The type defines how the parameter should be determined, for example:</p>
+		<ul>
+			<li><i>Signed</i> means signed integer and <i>Unsigned</i> means unsigned integer.</li>
+			<li><i>Hex</i> means that the parameter is an integer, but should be shown as hexadecimal number.</li>
+			<li>Also possible Enumerations are shown in the end of this list.</li>
+		</ul>
+	</li>
+	<li>(Optional) Select a <b>Template</b> for your parameter.<br>
+		The template defines pre-defined parameters that have special properties.
+		<p><img src="images/add_parameter.png"></p></li>
+	<li>Click <b>OK</b>. You should get this kind of change to your trace:<br><br>
+		<img src="images/ost_code_2.png"></li>
+</ol>
+<p>Note that you can always edit the trace text also manually.<p>
+<p>Now you can go on to <a href="setprojectandcompile.htm">compiling your source code</a>.</p>
+
+<h5>Related tasks</h5>
+<ul>
+	<li><a href="enumerations.htm">Adding and parsing Enumerations</a></li>
+	<li><a href="instrumenting.htm">Instrumenting traces</a></li>
+</ul>
+
+<div id="footer">Copyright &copy; 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/tracebuilder/com.nokia.tracebuilder.help/html/tasks/addingtraces.htm	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,48 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title>Adding traces to the source code</title>
+<link href="../../book.css" type="text/css" rel="stylesheet"></head>
+<body>
+
+<h2>Adding traces to the source code</h2>
+<p>To add a new trace, do the following: </p>
+<ol>
+	<li>Place the cursor in your source code where you want to add the trace.</li>
+	<li>Click the TraceBuilder menu and select <b>Add New Trace</b>.</li>
+	<li>In the <b>Add Trace</b> dialog, enter trace group, name, and text:
+	<ul>
+		<li><b>Trace Group</b>: the trace group is needed when you want to activate 
+			your traces from the device. There are some predefined groups which you 
+			can use if your trace fits the purpose. You can also define your own group 
+			just by typing to the field.</li>
+		<li><b>Trace Name</b>: the trace name is needed for creating unique identifiers 
+			for each OST trace so that they can be identified in the PC side. 
+			The trace name must be unique.</li>
+		<li><b>Trace Text</b>: enter here the string you want to see when you receive 
+			the trace in TraceViewer.</li>
+		<li>(Optional) From the <b>Templates</b> list, you can select pre-defined
+			format for the trace name and trace text.
+			<p>For example, <i>Function entry-exit</i> template parses the name of the 
+			class and function where the cursor is currently located. An entry trace is 
+			added to the beginning of the function and the exit trace is added to the end.</p></li>
+	</ul>		
+		<p><img src="images/add_trace.png"></p>
+	</li>
+	<li>Click <b>OK</b>. You should get this kind of line to your source code:<br><br>
+		<img src="images/ost_code.png"></li>
+</ol>
+
+<p>The trace is added to the defined location in the code, and details
+such as the trace group are displayed in TraceBuilder's tree view. </p>
+
+<h5>Related tasks</h5>
+<ul>
+	<li><a href="addingparameters.htm">Adding parameters to traces</a></li>
+	<li><a href="instrumenting.htm">Instrumenting traces</a></li>
+</ul>
+
+<div id="footer">Copyright &copy; 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/tracebuilder/com.nokia.tracebuilder.help/html/tasks/converting.htm	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,36 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title>Converting printf traces to OST traces</title>
+<link href="../../book.css" type="text/css" rel="stylesheet"></head>
+<body>
+
+<h2>Converting printf traces to OST traces</h2>
+<p>To convert your existing <code>Printf</code> traces to Open System Traces (OST), 
+do the following: </p>
+<ol>
+	<li>Go to <b>Window > Preferences > Carbide Extensions > TraceBuilder</b> to
+		enable the <b>Printf Parser Support</b> option.</li>
+	<li>Open a source file that contains the <code>Printf</code> traces. <p>You
+		should find <code>Printf</code> traces listed in the Trace Builder tree view,
+		as shown in the example: </p><p><img src="images/converttrace.png"></p></li>
+	<li>On the tree view, right-click the trace and select <b>Convert to Open
+		System Trace</b>.</li>
+	<li>From the <b>Trace Group</b> list, select a group for your trace, or define
+		a new one by typing its name into the field. </li>
+	<li>Type in a name for your trace. </li>
+	<li>Type the trace text you want to display in the TraceViewer tool. </li>
+	<li>(Optional) From the <b>Template</b> list, select a pre-defined template
+		for your trace. </li>
+	<li>Click <b>OK</b>.</li>
+</ol>
+
+<h5>Related concepts</h5>
+<ul>
+	<li><a href="../concepts/trace_format.htm">Open System Trace (OST)</a></li>
+</ul>
+
+<div id="footer">Copyright &copy; 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/tracebuilder/com.nokia.tracebuilder.help/html/tasks/deletingtraces.htm	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,21 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title>Deleting traces</title>
+<link href="../../book.css" type="text/css" rel="stylesheet"></head>
+<body>
+
+<h2>Deleting traces</h2>
+<p>To delete multiple traces at once, do the following: </p>
+<ol>
+	<li>From the TraceBuilder menu, select <b>Delete Traces</b>. </li>
+	<li>(Optional) If you have instrumented traces, you can select if you want
+		to delete  <b>Traces from instrumentation</b>, or <b>Traces from groups</b>.</li>
+	<li>From the tree view, select the traces you want to delete. </li>
+	<li>Click <b>OK</b>.</li>
+</ol>
+
+<div id="footer">Copyright &copy; 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/tracebuilder/com.nokia.tracebuilder.help/html/tasks/enumerations.htm	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,40 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title>Adding and parsing Enumerations</title>
+<link href="../../book.css" type="text/css" rel="stylesheet"></head>
+<body>
+
+<h2>Adding and parsing Enumerations</h2>
+<p>Enumerations can also be used as trace parameters. When a enum value is 
+passed to trace function, it will be converted to a string when the trace is decoded. </p>
+<p>To add an Enumeration, do the following: </p>
+<ol>
+	<li>From the Trace Builder menu, select <b>Add Enum / Constant to Enum</b>.</li>
+	<li>Select an existing Enumeration name or define a new one by typing the 
+		name to the <b>Enum Name</b> field. </li>
+	<li>Type a name for a new Constant. </li>
+	<li>Type a value for this Constant. You can also specify it as a hexaecimal
+		value by selecting the <b>Hex ID</b> box.</li>
+	<li>Click <b>OK</b>. </li>
+</ol>
+<p><b>Note:</b> To use the created Enumeration values in traces, you must 
+<a href="addingparameters.htm">add them as a parameter</a>.</p>
+
+<h3>Parsing Enumerations from the source code</h3>
+<p>To parse an existing Enumeration from a source code, do the following: </p>
+<ol>
+	<li>Select the Enumeration name from the source code, for example: 
+		<p><img src="images/enumeration.png"></p></li>
+	<li>From the Trace Builder menu, select <b>Parse Enum</b>.</li>
+	<li>The Enumeration should now be visible in the Trace Builder tree view,
+		for example: <p><img src="images/enumerationparsed.png"></p> </li>
+</ol>
+<p>You can now use the Enumeration as a parameter in a trace. For more
+information, see <a href="addingparameters.htm">Adding parameters to existing
+traces</a>. </p>
+
+<div id="footer">Copyright &copy; 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/tracebuilder/com.nokia.tracebuilder.help/html/tasks/images/add_parameter.png has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.help/html/tasks/images/add_trace.png has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.help/html/tasks/images/converttrace.png has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.help/html/tasks/images/enumeration.png has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.help/html/tasks/images/enumerationparsed.png has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.help/html/tasks/images/ost_code.png has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.help/html/tasks/images/ost_code_2.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.help/html/tasks/instrumenting.htm	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,62 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title>Instrumenting traces</title>
+<link href="../../book.css" type="text/css" rel="stylesheet"></head>
+<body>
+
+<h2>Instrumenting traces</h2>
+<p>To instrument traces to your source code, do the following: </p>
+<ol>
+	<li>From the TraceBuilder menu, select <b>Instrument Code</b>. </li>
+	<li>Select a group for your traces or define a new one by typing the name
+		into the <b>Trace Group</b> field. </li>
+	<li>Type a name format for your traces. 
+		<p>The default is <b>{$CN}_{$FN}</b>, which means 
+		<code>className_functionName</code>. </p>
+		<p>The values for <code>className</code> and <code>functionName</code> 
+		are parsed from the source code.</p></li>
+	<li>Type a text format for your traces. 
+		<p>The default is <b>{$cn}::{$fn}</b>, which means 
+		<code>className::functionName</code>. </p>
+		<p>The values for <code>className</code> and <code>functionName</code> 
+		are parsed from the source code.</p></li>
+	<li>(Optional) From the <b>Templates</b> list, you can select pre-defined
+		format for the trace. 
+		<p>For example, <i>Function entry-exit</i> template parses the name 
+		of the class and function where the cursor is currently located.
+		An entry trace is added to the beginning of the function and the exit trace
+		is added to the end.</p></li>
+	<li>(Optional) Select any of the following options, as needed:
+	<ul>
+		<li><b>Add "this" pointer parameter</b> to add <i>this</i> pointer to the
+			instrumented traces. </li>
+		<li><b>Add function parameters</b> to add function parameters to the instrumented
+			traces. </li>
+		<li><b>Add exit traces</b> to add exit trace to every function instrumented. 
+			<b>Note:</b> this option is selected only if the <i>Function Entry-Exit</i> template
+			is selected.</li>
+		<li><b>Add return value to exit traces</b> to add a function return value
+			to every function that is instrumented.</li>
+	</ul>
+	</li>
+	<li>Click <b>OK</b>. </li>
+	<li>In the displayed dialog, select the functions you want to instrument.</li>
+	<li>Click <b>OK</b> to start instrumentation of the source code. </li>
+</ol>
+
+<h5>Related tasks</h5>
+<ul>
+	<li><a href="addingparameters.htm">Adding parameters to traces</a></li>
+	<li><a href="deletingtraces.htm">Deleting traces</a></li>
+</ul>
+
+<h5>Related concepts</h5>
+<ul>
+	<li><a href="../concepts/trace_format.htm">Open System Trace (OST)</a></li>
+</ul>
+
+<div id="footer">Copyright &copy; 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/tracebuilder/com.nokia.tracebuilder.help/html/tasks/preferences.htm	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,24 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title>Setting TraceBuilder preferences</title>
+<link href="../../book.css" type="text/css" rel="stylesheet"></head>
+<body>
+
+<h2>Setting TraceBuilder preferences</h2>
+<p>To set the preferences, do the following: </p>
+<ol>
+	<li>Go to <b>Window > Preferences > Carbide Extensions > Trace Builder</b>.
+		<p>The <b>General</b> settings are displayed. </p></li>
+	<li>(Optional) Modify the <b>Printf Parser Support</b> status.
+		<p>If Printf parser support is enabled, TraceBuilder will try to find 
+		<code>Kern::Printf</code> and <code>RDebug::Printf</code> macros from 
+		your source code and offer to convert them into Open OST traces. 
+		You can also set own trace macro for TraceBuilder to look for.</p></li>
+	<li><p>Click <b>OK</b> to exit the dialog and apply the settings. </p></li>
+</ol>
+
+<div id="footer">Copyright &copy; 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/tracebuilder/com.nokia.tracebuilder.help/html/tasks/setprojectandcompile.htm	Wed Jun 23 14:35:40 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>Setting project include paths and compiling</title>
+<link href="../../book.css" type="text/css" rel="stylesheet">
+</head>
+<body>
+
+<h2>Setting project include paths and compiling</h2>
+<p>To use Open System Trace (OST) traces, you must include the <i>
+OpenSystemTrace.h</i> header file from the environment. 
+Currently TraceBuilder automatically adds the necessary system 
+include macro to the MMP file if it does not exist.</p>
+
+<p> If you get an error about a missing header when compiling, 
+set the project's include paths: </p>
+<ol>
+	<li>Search the <i>/epoc32/include/</i> folder for the <i>OpenSystemTrace.h</i> file. </li>
+	<li>Then add a following line to your component's MMP file: <br>
+		<code>SYSTEMINCLUDE</code> &lt;the path where <i>OpenSystemTrace.h</i> was found.
+		<p><b>Note:</b> If <i>OpenSystemTrace.h</i> was not found from your development environment,
+		you cannot use OST traces.</p></li>
+	<li>Compile your component using OST traces.
+		<p>The compilation is handled by <a href="../concepts/tracecompiler.htm">Trace Compiler</a>.</p></li>
+</ol>
+
+<p>Note that you might also get errors such as <code>Userinclude path "/traces/" not found</code> or <code>Can't find following headers in User or System Include Paths "OstTraceDefinitions.h"</code> when you are compiling for the first time. This is because those paths and files are generated by TraceCompiler, and in the first time they do not exist when the Symbian Build System generates makefile.</p>
+
+<p>When TraceCompiler is run to a component containing OST traces, you should see this kind of message:</p>
+
+<pre>
+******************* TRACECOMPILER STARTS *******************<br>Building traces for component Hello3. Component UID: 0xE1B04078.<br>******************* TRACECOMPILER ENDS *********************
+</pre>
+
+<p>After compilation, you should find a generated dictionary file for your component in the <i>/epoc32/ost_dictionaries/</i> folder.</p>
+
+<div id="footer">Copyright &copy; 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/tracebuilder/com.nokia.tracebuilder.help/html/tasks/tasks.htm	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,27 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 1.0 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+<title>Adding traces to the code</title>
+<link href="../../book.css" type="text/css" rel="StyleSheet"></head>
+<body>
+
+<h2>Adding traces to the code</h2>
+<p>Entries in this section tell you how to perform the tasks 
+available in TraceBuilder.</p>
+<p>Topics in this section include:</p>
+<ul>
+	<li><a href="preferences.htm">Setting Trace Builder preferences</a></li>
+	<li><a href="addingtraces.htm">Adding traces to the source code</a></li>
+	<li><a href="addingparameters.htm">Adding parameters to existing traces</a></li>
+	<li><a href="enumerations.htm">Adding and parsing Enumerations</a></li>
+	<li><a href="instrumenting.htm">Instrumenting traces</a></li>
+	<li><a href="setprojectandcompile.htm">Setting project include paths and compiling</a></li>
+	<li><a href="converting.htm">Converting printf traces to OST traces</a></li>
+	<li><a href="deletingtraces.htm">Deleting traces</a></li>
+</ul>
+
+<div id="footer">Copyright &copy; 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/tracebuilder/com.nokia.tracebuilder.help/html/tocConcepts.xml	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?NLS TYPE="org.eclipse.help.toc"?>
+
+<toc label="Concepts">
+	
+	<!-- Enter topic entries here for Concepts section of help -->
+	
+		<topic label="Tracing" href="html/concepts/tracing.htm" />
+		<topic label="Trace format" href="html/concepts/trace_format.htm" />
+		<topic label="Dictionary file" href="html/concepts/dictionaryfile.htm" />
+		<topic label="Trace Compiler" href="html/concepts/tracecompiler.htm" />
+</toc>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.help/html/tocGettingStarted.xml	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?NLS TYPE="org.eclipse.help.toc"?>
+
+<toc label="Getting Started">
+	
+	<!-- Enter topic entries here for Tasks section of help -->
+	
+	<topic label="TraceBuilder overview" href="html/gettingstarted/overview.htm" />
+	<topic label="TraceBuilder basic steps" href="html/gettingstarted/basic_steps.htm" />	
+
+	
+</toc>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.help/html/tocReference.xml	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?NLS TYPE="org.eclipse.help.toc"?>
+
+<toc label="References">
+	
+	<!-- Enter topic entries here for References section of help -->
+	
+	<topic label="TraceBuilder menubar" href="html/reference/menubar.htm" />
+	<topic label="TraceBuilder tips and tricks" href="html/reference/nonsourcefiles.htm" />
+</toc>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.help/html/tocTasks.xml	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?NLS TYPE="org.eclipse.help.toc"?>
+
+<toc label="Tasks">
+	
+	<!-- Enter topic entries here for Tasks section of help -->
+	
+	<topic label="Setting Trace Builder preferences" href="html/tasks/preferences.htm" />
+	<topic label="Adding traces to the source code" href="html/tasks/addingtraces.htm" />
+	<topic label="Adding parameters to existing traces" href="html/tasks/addingparameters.htm" />
+	<topic label="Adding and parsing Enumerations" href="html/tasks/enumerations.htm" />
+	<topic label="Instrumenting traces" href="html/tasks/instrumenting.htm" />
+	<topic label="Setting project include paths and compiling" href="html/tasks/setprojectandcompile.htm"/>
+	<topic label="Converting printf traces to OST traces" href="html/tasks/converting.htm" />
+	<topic label="Deleting traces" href="html/tasks/deletingtraces.htm" />
+	
+</toc>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.help/html/tool.htm	Wed Jun 23 14:35:40 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>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 class="titleSmall">Copyright © 2010 Nokia Corporation and/or its
+        subsidiary(-ies). All rights reserved.<br>
+        License: <a
+        href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.</p>
+      </td>
+    </tr>
+    <tr>
+      <td colspan="2"><h1 align="center">TraceBuilder User Guide </h1>
+
+        <p align="center" class="titleSmall">Version 2.4.0; June, 2010</p>
+      </td>
+    </tr>
+  </tbody>
+</table>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.help/html/toolTOC.xml	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,49 @@
+<?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="Trace Builder" 
+	link_to="../com.nokia.carbide.help.common/carbideHelpTOC.xml#anchorCarbideFeature">
+
+	<!--
+		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="TraceBuilder" 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" /> 
+	   </topic>
+	   
+	   <topic label="Concepts" href="html/concepts/concepts.htm" >
+      		  <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>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.help/plugin.xml	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,34 @@
+<?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.index">
+      <index file="html/index.xml"/>
+   </extension>
+
+    <extension point="org.eclipse.help.contexts">
+        <contexts
+            file="html/contexts.xml"
+            plugin="com.nokia.tracebuilder.help" />
+    </extension>
+</plugin>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/.classpath	Wed Jun 23 14:35:40 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/tracebuilder/com.nokia.tracebuilder.view/.settings/org.eclipse.core.resources.prefs	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,5 @@
+#Tue Feb 13 13:51:08 EET 2007
+eclipse.preferences.version=1
+encoding//src/com/nokia/tracebuilder/action/messages.properties=8859_1
+encoding//src/com/nokia/tracebuilder/preferences/messages.properties=8859_1
+encoding//src/com/nokia/tracebuilder/view/messages.properties=8859_1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/.settings/org.eclipse.jdt.core.prefs	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,8 @@
+#Mon Oct 05 11:27:24 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/tracebuilder/com.nokia.tracebuilder.view/META-INF/MANIFEST.MF	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,21 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: TraceBuilder View Plug-in
+Bundle-SymbolicName: com.nokia.tracebuilder.view;singleton:=true
+Bundle-Version: 2.4.0
+Bundle-Activator: com.nokia.tracebuilder.view.TraceViewPlugin
+Bundle-Vendor: Nokia
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.eclipse.ui,
+ com.nokia.tracebuilder,
+ org.eclipse.ui.ide,
+ com.nokia.carbide.cdt.builder,
+ com.nokia.carbide.cpp.epoc.engine,
+ com.nokia.carbide.cpp.sdk.core,
+ com.nokia.carbide.trk.support,
+ com.nokia.carbide.cpp.featureTracker
+Bundle-ActivationPolicy: lazy
+Export-Package: com.nokia.tracebuilder.action
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/about.html	Wed Jun 23 14:35:40 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 9, 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 the License "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/tracebuilder/com.nokia.tracebuilder.view/build.properties	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,8 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .,\
+               plugin.xml,\
+               icons/,\
+               plugin.properties,\
+               about.html
Binary file trace/tracebuilder/com.nokia.tracebuilder.view/icons/actions/add_constant.gif has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.view/icons/actions/add_enum.gif has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.view/icons/actions/add_parameter.gif has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.view/icons/actions/add_trace.gif has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.view/icons/actions/convert_trace.gif has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.view/icons/actions/delete.gif has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.view/icons/actions/delete_traces.gif has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.view/icons/actions/edit_properties.gif has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.view/icons/actions/editor_link.gif has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.view/icons/actions/export_project.gif has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.view/icons/actions/help.gif has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.view/icons/actions/import_project.gif has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.view/icons/actions/insert_trace.gif has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.view/icons/actions/instrumenter.gif has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.view/icons/actions/open_source.gif has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.view/icons/actions/parse_enum.gif has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.view/icons/actions/remove_trace.gif has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.view/icons/actions/remove_unrelated.gif has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.view/icons/actions/save_project.gif has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.view/icons/view/default.gif has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.view/icons/view/group.gif has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.view/icons/view/navigator.gif has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.view/icons/view/parameter.gif has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.view/icons/view/property.gif has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.view/icons/view/trace.gif has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.view/icons/view/tracebuilder.gif has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.view/icons/view/unrelated_location.gif has changed
Binary file trace/tracebuilder/com.nokia.tracebuilder.view/icons/view/unrelated_locations_list.gif has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/plugin.properties	Wed Jun 23 14:35:40 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:
+#
+#
+# plugin.properties
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# Plugin properties for Trace Builder View
+# This file should be translated.
+traceBuilderMenu=Trace Builder
+traceBuilderActionSet=Trace Builder
+traceBuilderViewCategory=Trace Builder
+traceView=Trace Builder
+commandCategoryName=Trace Builder
+commandCategoryDescription=Trace Builder commands
+addTraceCommand=Add Trace
+addTraceDescription=Add a new trace to a trace group
+addParameterCommand=Add Parameter
+addParameterDescription=Adds a new parameter to selected trace
+convertTraceCommand=Convert to Trace
+convertTraceDescription=Creates a new trace which has the same name as the location
+focusViewCommand=Activate View
+focusViewDescription=Sets the keyboard focus to Trace View
+
+editPropertiesCommand=Edit Properties
+editPropertiesDescription=Edits the properties of groups, traces and parameters
+addConstantCommand=Add Enum / Constant to Enum
+addConstantDescription=Adds a value-to-string mapping to the enum
+deleteCommand=Delete
+deleteDescription=Removes the selected entry from the model
+instrumenterCommand=Instrument Code
+instrumenterDescription=Starts the code instrumenter
+deleteTracesCommand=Delete Traces
+deleteTracesDescription=Delete multiple traces from groups or instrumentations
+parseEnumCommand=Parse Enum
+parseEnumDescription=Parses an enum from the source
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/plugin.xml	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,147 @@
+<?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.tracebuilder.view.TraceView"
+            icon="icons/view/tracebuilder.gif"
+            id="com.nokia.tracebuilder.view.TraceView"
+            name="%traceView"/>
+   </extension>
+
+   <extension
+         point="org.eclipse.ui.commands">
+      <command
+            categoryId="com.nokia.tracebuilder.category.trace"
+            defaultHandler="com.nokia.tracebuilder.action.AddTraceGlobalAction"
+            description="%addTraceDescription"
+            helpContextId="com.nokia.tracebuilder.help.add_trace"
+            id="com.nokia.tracebuilder.command.add_trace"
+            name="%addTraceCommand"/>
+      <command
+            categoryId="com.nokia.tracebuilder.category.trace"
+            defaultHandler="com.nokia.tracebuilder.action.AddParameterGlobalAction"
+            description="%addParameterDescription"
+            helpContextId="com.nokia.tracebuilder.help.add_parameter"
+            id="com.nokia.tracebuilder.command.add_parameter"
+            name="%addParameterCommand"/>
+      <command
+            categoryId="com.nokia.tracebuilder.category.trace"
+            defaultHandler="com.nokia.tracebuilder.action.FocusGlobalAction"
+            description="%focusViewDescription"
+            id="com.nokia.tracebuilder.command.focus"
+            name="%focusViewCommand"/>
+      <command
+            categoryId="com.nokia.tracebuilder.category.trace"
+            defaultHandler="com.nokia.tracebuilder.action.EditPropertiesGlobalAction"
+            description="%editPropertiesDescription"
+            helpContextId="com.nokia.tracebuilder.help.edit_properties"
+            id="com.nokia.tracebuilder.command.edit_properties"
+            name="%editPropertiesCommand"/>
+      <command
+            categoryId="com.nokia.tracebuilder.category.trace"
+            defaultHandler="com.nokia.tracebuilder.action.AddConstantGlobalAction"
+            description="%addConstantDescription"
+            helpContextId="com.nokia.tracebuilder.help.add_constant"
+            id="com.nokia.tracebuilder.command.add_constant"
+            name="%addConstantCommand"/>
+      <command
+            categoryId="com.nokia.tracebuilder.category.trace"
+            defaultHandler="com.nokia.tracebuilder.action.DeleteGlobalAction"
+            description="%deleteDescription"
+            helpContextId="com.nokia.tracebuilder.help.delete"
+            id="com.nokia.tracebuilder.command.delete"
+            name="%deleteCommand"/>
+      <command
+            categoryId="com.nokia.tracebuilder.category.trace"
+            defaultHandler="com.nokia.tracebuilder.action.InstrumentGlobalAction"
+            description="%instrumenterDescription"
+            helpContextId="com.nokia.tracebuilder.help.instrumenter"
+            id="com.nokia.tracebuilder.command.instrumenter"
+            name="%instrumenterCommand"/>
+      <command
+            categoryId="com.nokia.tracebuilder.category.trace"
+	    defaultHandler="com.nokia.tracebuilder.action.DeleteTracesGlobalAction"
+            description="%deleteTracesDescription"
+            helpContextId="com.nokia.tracebuilder.help.delete_traces"
+            id="com.nokia.tracebuilder.command.delete_traces"
+            name="%deleteTracesCommand"/>
+      <command
+            categoryId="com.nokia.tracebuilder.category.trace"
+	    defaultHandler="com.nokia.tracebuilder.action.ParseEnumGlobalAction"
+            description="%parseEnumDescription"
+            helpContextId="com.nokia.tracebuilder.help.parse_enum"
+            id="com.nokia.tracebuilder.command.parse_enum"
+            name="%parseEnumCommand"/>
+      <category
+            description="%commandCategoryDescription"
+            id="com.nokia.tracebuilder.category.trace"
+            name="%commandCategoryName"/>
+      <command
+            categoryId="com.nokia.tracebuilder.category.trace"
+	    defaultHandler="com.nokia.tracebuilder.action.ConvertTraceGlobalAction"	    
+            description="%convertTraceDescription"
+            helpContextId="com.nokia.tracebuilder.help.convert_trace"
+            id="com.nokia.tracebuilder.command.convert_trace"
+            name="%convertTraceCommand"/>
+   </extension>
+   
+   <extension
+         point="org.eclipse.ui.bindings">
+      <key
+            commandId="com.nokia.tracebuilder.command.add_trace"
+            contextId="org.eclipse.ui.contexts.window"
+            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+            sequence="M3+T"/>
+      <key
+            commandId="com.nokia.tracebuilder.command.add_parameter"
+            contextId="org.eclipse.ui.contexts.window"
+            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+            sequence="M3+Y"/>
+
+   </extension>
+   
+   <extension
+         point="org.eclipse.core.runtime.preferences">
+      <initializer class="com.nokia.tracebuilder.preferences.PreferenceInitializer"/>
+   </extension>
+   
+   <extension
+         point="org.eclipse.ui.preferencePages">
+      <page
+            class="com.nokia.tracebuilder.preferences.GeneralPreferencePage"
+            category="com.nokia.carbide.cpp.preferences.ExtensionsPreferencesPage"
+            id="com.nokia.tracebuilder.preferences.GeneralPreferencePage"
+            name="Trace Builder"/>
+   </extension>
+   
+   <extension point="org.eclipse.ui.actionSets">
+    <actionSet
+      description="Trace Builder&apos;s Actions"
+      id="com.nokia.tracebuilder.ui.actionSet"
+      label="Trace Builder"
+      visible="true">
+      <action                
+        class="com.nokia.tracebuilder.action.ToolbarShortcutAction"
+        icon="icons/view/tracebuilder.gif"
+        id="com.nokia.tracebuilder.action.ToolbarShortcutAction"
+        label="&amp;Trace Builder"               
+        menubarPath="com.nokia.carbide.cpp.ui.CarbideMenu/CarbideExtensions"
+        tooltip="Trace Builder">
+      </action>
+      <menu
+        id="com.nokia.carbide.cpp.ui.CarbideMenu"
+        label=" &amp;Carbide"
+        path="additions">
+        <groupMarker name="additions"/>
+      </menu>
+    </actionSet>
+  </extension>
+   
+</plugin>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/ActionFactory.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,171 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Creates the action objects for Trace Builder view
+*
+*/
+package com.nokia.tracebuilder.action;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.Separator;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+
+/**
+ * Creates the action objects for Trace Builder view
+ * 
+ */
+public final class ActionFactory implements TraceViewActions {
+
+	/**
+	 * List of menu actions
+	 */
+	private ArrayList<Object> actions = new ArrayList<Object>();
+
+	/**
+	 * Menu / toolbar separator
+	 */
+	private Separator separator = new Separator();
+
+	/**
+	 * Last selection is always stored
+	 */
+	private Object lastSelectedObject;
+
+	/**
+	 * Constructor
+	 */
+	public ActionFactory() {
+		createActions();
+	}
+
+	/**
+	 * Enables / disables actions based on current selection. The labels for
+	 * some of the actions are updated depending on which object has been
+	 * selected.
+	 * 
+	 * @param selectedObject
+	 *            the object that is currently selected
+	 */
+	public void enableActions(Object selectedObject) {
+		for (int i = 0; i < actions.size(); i++) {
+			Object action = actions.get(i);
+			if (action instanceof TraceBuilderAction) {
+				((TraceBuilderAction) action).setEnabled(TraceBuilderGlobals
+						.getTraceModel().isValid(), selectedObject);
+			}
+		}
+		lastSelectedObject = selectedObject;
+	}
+
+	/**
+	 * Fills the view menu with the actions
+	 * 
+	 * @param manager
+	 *            the menu manager
+	 */
+	public void fillMenu(IMenuManager manager) {
+		for (int i = 0; i < actions.size(); i++) {
+			Object action = actions.get(i);
+			if (action instanceof TraceBuilderAction
+					&& ((TraceBuilderAction) action).isInMenu()) {
+				manager.add((TraceBuilderAction) action);
+			} else if (action instanceof IContributionItem) {
+				manager.add((IContributionItem) action);
+			}
+		}
+	}
+
+	/**
+	 * Fills the right-click popup-menu.
+	 * 
+	 * @param manager
+	 *            the menu manager
+	 */
+	public void fillContextMenu(IMenuManager manager) {
+		for (int i = 0; i < actions.size(); i++) {
+			Object action = actions.get(i);
+			if (action instanceof TraceBuilderAction
+					&& ((TraceBuilderAction) action)
+							.isInPopupMenu(lastSelectedObject)) {
+				manager.add((TraceBuilderAction) action);
+			} else if (action instanceof IContributionItem) {
+				manager.add((IContributionItem) action);
+			}
+		}
+		addSelectionActions(manager);
+	}
+
+	/**
+	 * Adds the actions from the selection list to the manager
+	 * 
+	 * @param manager
+	 *            the menu manager
+	 */
+	private void addSelectionActions(IMenuManager manager) {
+		if (lastSelectedObject instanceof TraceViewActionProvider) {
+			Iterator<IAction> itr = ((TraceViewActionProvider) lastSelectedObject)
+					.getActions();
+			if (itr.hasNext()) {
+				manager.add(separator);
+			}
+			while (itr.hasNext()) {
+				manager.add(itr.next());
+			}
+		}
+	}
+
+	/**
+	 * Fills the tool bar
+	 * 
+	 * @param manager
+	 *            the tool bar manager
+	 */
+	public void fillToolBar(IToolBarManager manager) {
+		manager.add(separator);
+	}
+
+	/**
+	 * Creates the menu actions and adds them to the actions list
+	 */
+	private void createActions() {
+		actions.add(new AddTraceAction());
+		actions.add(new AddParameterAction());
+		// Constant tables go to the property file
+		actions.add(separator);
+		actions.add(new AddConstantAction());
+		actions.add(new ParseEnumAction());
+		actions.add(separator);
+		actions.add(new EditPropertiesAction());
+		actions.add(new DeleteAction());
+		actions.add(separator);
+		actions.add(new InstrumentAction());
+		actions.add(new DeleteTracesAction());
+		actions.add(separator);
+		actions.add(separator);
+		actions.add(new ConvertTraceAction());
+		actions.add(new OpenSourceAction());
+		actions.add(new RemoveSourceAction());
+		actions.add(new RemoveUnrelatedAction());
+		enableActions(null);
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/ActionIDs.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies 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 ID definitions
+ *
+ */
+package com.nokia.tracebuilder.action;
+
+/**
+ * Action ID definitions
+ * 
+ */
+interface ActionIDs {
+
+	/**
+	 * Base for action IDs
+	 */
+	String ACTION_ID_BASE = "com.nokia.tracebuilder.command."; //$NON-NLS-1$
+
+	/**
+	 * Action icons directory
+	 */
+	String ICONS_DIRECTORY = "icons/actions/"; //$NON-NLS-1$
+
+	/**
+	 * GIF file
+	 */
+	String GIF = ".gif"; //$NON-NLS-1$
+
+	/**
+	 * Action ID for Add Trace
+	 */
+	String ADD_TRACE_ACTION_ID = "add_trace"; //$NON-NLS-1$
+
+	/**
+	 * Action ID for Add Parameter
+	 */
+	String ADD_PARAMETER_ACTION_ID = "add_parameter"; //$NON-NLS-1$
+
+	/**
+	 * Action ID for Add Constant
+	 */
+	String ADD_CONSTANT_ACTION_ID = "add_constant"; //$NON-NLS-1$
+
+	/**
+	 * Action ID for Delete
+	 */
+	String DELETE_ACTION_ID = "delete"; //$NON-NLS-1$
+
+	/**
+	 * Action ID for Delete Traces
+	 */
+	String DELETE_TRACES_ACTION_ID = "delete_traces"; //$NON-NLS-1$
+
+	/**
+	 * Action ID for Switch Focus
+	 */
+	String FOCUS_ACTION_ID = "focus"; //$NON-NLS-1$
+
+	/**
+	 * Action ID for Edit Properties
+	 */
+	String EDIT_PROPERTIES_ACTION_ID = "edit_properties"; //$NON-NLS-1$
+
+	/**
+	 * Action ID for Convert to Trace
+	 */
+	String CONVERT_TRACE_ACTION_ID = "convert_trace"; //$NON-NLS-1$
+
+	/**
+	 * Action ID for Instrumenter
+	 */
+	String INSTRUMENTER_ACTION_ID = "instrumenter"; //$NON-NLS-1$
+
+	/**
+	 * Action ID for parse enum
+	 */
+	String PARSE_ENUM_ACTION_ID = "parse_enum"; //$NON-NLS-1$
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/AddConstantAction.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,75 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 constant command
+*
+*/
+package com.nokia.tracebuilder.action;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceBuilderHelp;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceConstantTable;
+
+/**
+ * Handler for add constant command
+ * 
+ */
+final class AddConstantAction extends TraceBuilderAction {
+
+	/**
+	 * Constructor
+	 */
+	AddConstantAction() {
+		setText(Messages.getString("AddConstantAction.Title")); //$NON-NLS-1$
+		setToolTipText(Messages.getString("AddConstantAction.Tooltip")); //$NON-NLS-1$
+		setDefaultProperties(ActionIDs.ADD_CONSTANT_ACTION_ID,
+				TraceBuilderHelp.ADD_ENUM_HELP_CONTEXT);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.action.TraceBuilderAction#doRun()
+	 */
+	@Override
+	protected void doRun() throws TraceBuilderException {
+		TraceBuilderGlobals.getTraceBuilder().addConstant();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.tracebuilder.action.TraceBuilderAction#getEnabledFlag(java.
+	 * lang.Object)
+	 */
+	@Override
+	protected boolean getEnabledFlag(Object selectedObject) {
+		return true;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.tracebuilder.action.TraceBuilderAction#isInPopupMenu(java.lang
+	 * .Object)
+	 */
+	@Override
+	protected boolean isInPopupMenu(Object selectedObject) {
+		return isEnabled() && (selectedObject instanceof TraceConstantTable);
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/AddConstantGlobalAction.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 global focus command
+*
+*/
+package com.nokia.tracebuilder.action;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+
+/**
+ * Handler for global add constant command
+ * 
+ */
+public class AddConstantGlobalAction extends TraceBuilderGlobalAction {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.action.TraceBuilderGlobalAction#doRun()
+	 */
+	@Override
+	protected void doRun() throws TraceBuilderException {
+		TraceBuilderGlobals.getTraceBuilder().addConstant();
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/AddParameterAction.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,97 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 parameter command
+*
+*/
+package com.nokia.tracebuilder.action;
+
+import com.nokia.tracebuilder.engine.LastKnownLocation;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceBuilderHelp;
+import com.nokia.tracebuilder.engine.TraceLocation;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceObject;
+import com.nokia.tracebuilder.rules.ReadOnlyObjectRule;
+import com.nokia.tracebuilder.rules.TraceParameterRestrictionRule;
+
+/**
+ * Handler for add parameter command
+ * 
+ */
+final class AddParameterAction extends TraceBuilderAction {
+
+	/**
+	 * Constructor
+	 */
+	AddParameterAction() {
+		setText(Messages.getString("AddParameterAction.Title")); //$NON-NLS-1$
+		setToolTipText(Messages.getString("AddParameterAction.Tooltip")); //$NON-NLS-1$
+		setDefaultProperties(ActionIDs.ADD_PARAMETER_ACTION_ID,
+				TraceBuilderHelp.ADD_PARAMETER_HELP_CONTEXT);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.action.TraceBuilderAction#doRun()
+	 */
+	@Override
+	protected void doRun() throws TraceBuilderException {
+		TraceBuilderGlobals.getTraceBuilder().addParameter();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.action.TraceBuilderAction#getEnabledFlag(java.lang.Object)
+	 */
+	@Override
+	protected boolean getEnabledFlag(Object selectedObject) {
+		boolean retval;
+		selectedObject = locationToTrace(selectedObject);
+		// Currently only traces can have parameters
+		if (selectedObject instanceof Trace) {
+			ReadOnlyObjectRule readOnly = ((Trace) selectedObject)
+					.getExtension(ReadOnlyObjectRule.class);
+			TraceParameterRestrictionRule restriction = ((Trace) selectedObject)
+					.getExtension(TraceParameterRestrictionRule.class);
+			if (readOnly != null
+					|| (restriction != null && !restriction.canAddParameters())) {
+				retval = false;
+			} else {
+				retval = true;
+			}
+		} else {
+			retval = false;
+		}
+		return retval;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.action.TraceBuilderAction#isInPopupMenu(java.lang.Object)
+	 */
+	@Override
+	protected boolean isInPopupMenu(Object selectedObject) {
+		Object parent = locationToTrace(selectedObject);
+		return isEnabled() && (parent instanceof TraceObject)
+				&& !(selectedObject instanceof TraceLocation)
+				&& !(selectedObject instanceof LastKnownLocation);
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/AddParameterGlobalAction.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 global add trace command
+*
+*/
+package com.nokia.tracebuilder.action;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+
+/**
+ * Handler for global add parameter command
+ * 
+ */
+public class AddParameterGlobalAction extends TraceBuilderGlobalAction {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.action.TraceBuilderGlobalAction#doRun()
+	 */
+	@Override
+	protected void doRun() throws TraceBuilderException {
+		TraceBuilderGlobals.getTraceBuilder().addParameter();
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/AddTraceAction.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 trace command
+*
+*/
+package com.nokia.tracebuilder.action;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceBuilderHelp;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceGroup;
+
+/**
+ * Handler for add trace command
+ * 
+ */
+final class AddTraceAction extends TraceBuilderAction {
+
+	/**
+	 * Constructor
+	 */
+	AddTraceAction() {
+		setText(Messages.getString("AddTraceAction.Title")); //$NON-NLS-1$
+		setToolTipText(Messages.getString("AddTraceAction.Tooltip")); //$NON-NLS-1$
+		setDefaultProperties(ActionIDs.ADD_TRACE_ACTION_ID,
+				TraceBuilderHelp.ADD_TRACE_HELP_CONTEXT);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.action.TraceBuilderAction#doRun()
+	 */
+	@Override
+	protected void doRun() throws TraceBuilderException {
+		TraceBuilderGlobals.getTraceBuilder().addTrace();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.action.TraceBuilderAction#getEnabledFlag(java.lang.Object)
+	 */
+	@Override
+	protected boolean getEnabledFlag(Object selectedObject) {
+		return true;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.action.TraceBuilderAction#isInPopupMenu(java.lang.Object)
+	 */
+	@Override
+	protected boolean isInPopupMenu(Object selectedObject) {
+		return isEnabled() && (selectedObject instanceof TraceGroup);
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/AddTraceFromEditor.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Editor action delegate for add trace command
+*
+*/
+package com.nokia.tracebuilder.action;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+
+/**
+ * Editor action delegate for add trace command
+ * 
+ */
+public class AddTraceFromEditor extends TraceBuilderEditorAction {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.action.TraceBuilderEditorAction#doRun()
+	 */
+	@Override
+	protected void doRun() throws TraceBuilderException {
+		TraceBuilderGlobals.getTraceBuilder().addTrace();
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/AddTraceGlobalAction.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 global add trace command
+*
+*/
+package com.nokia.tracebuilder.action;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+
+/**
+ * Handler for global add trace command
+ * 
+ */
+public class AddTraceGlobalAction extends TraceBuilderGlobalAction {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.action.TraceBuilderGlobalAction#doRun()
+	 */
+	@Override
+	protected void doRun() throws TraceBuilderException {
+		TraceBuilderGlobals.getTraceBuilder().addTrace();
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/ConvertTraceAction.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,85 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 convert trace command
+*
+*/
+package com.nokia.tracebuilder.action;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceBuilderHelp;
+import com.nokia.tracebuilder.engine.TraceLocation;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.TraceBuilderErrorCode;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.project.TraceProjectAPI;
+
+/**
+ * Handler for convert trace command
+ * 
+ */
+final class ConvertTraceAction extends TraceBuilderAction {
+
+	/**
+	 * Constructor
+	 */
+	ConvertTraceAction() {
+		setText(Messages.getString("ConvertTraceAction.Title")); //$NON-NLS-1$
+		setToolTipText(Messages.getString("ConvertTraceAction.Tooltip")); //$NON-NLS-1$
+		setDefaultProperties(ActionIDs.CONVERT_TRACE_ACTION_ID,
+				TraceBuilderHelp.CONVERT_TRACE_HELP_CONTEXT);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.action.TraceBuilderAction#doRun()
+	 */
+	@Override
+	protected void doRun() throws TraceBuilderException {
+		TraceBuilderGlobals.getTraceBuilder().convertTrace();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.action.TraceBuilderAction#getEnabledFlag(java.lang.Object)
+	 */
+	@Override
+	protected boolean getEnabledFlag(Object selectedObject) {
+		boolean retval = false;
+		if (selectedObject instanceof TraceLocation) {
+			TraceLocation loc = (TraceLocation) selectedObject;
+			if (loc.getValidityCode() == TraceBuilderErrorCode.TRACE_NEEDS_CONVERSION) {
+				TraceProjectAPI api = TraceBuilderGlobals.getTraceModel()
+						.getExtension(TraceProjectAPI.class);
+				setText(Messages.getString("ConvertTraceAction.Title") //$NON-NLS-1$
+						+ api.getTitle());
+				retval = true;
+			}
+		}
+		return retval;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.action.TraceBuilderAction#isInMenu()
+	 */
+	@Override
+	protected boolean isInMenu() {
+		return false;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/ConvertTraceGlobalAction.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 global focus command
+*
+*/
+package com.nokia.tracebuilder.action;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+
+/**
+ * Handler for global convert trace command
+ * 
+ */
+public class ConvertTraceGlobalAction extends TraceBuilderGlobalAction {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.action.TraceBuilderGlobalAction#doRun()
+	 */
+	@Override
+	protected void doRun() throws TraceBuilderException {
+		TraceBuilderGlobals.getTraceBuilder().convertTrace();
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/DeleteAction.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies 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 delete command
+ *
+ */
+package com.nokia.tracebuilder.action;
+
+import com.nokia.tracebuilder.engine.LastKnownLocation;
+import com.nokia.tracebuilder.engine.LastKnownLocationList;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceBuilderHelp;
+import com.nokia.tracebuilder.engine.TraceLocation;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceConstantTable;
+import com.nokia.tracebuilder.model.TraceConstantTableEntry;
+import com.nokia.tracebuilder.model.TraceGroup;
+import com.nokia.tracebuilder.model.TraceObject;
+import com.nokia.tracebuilder.model.TraceParameter;
+import com.nokia.tracebuilder.project.GroupNameHandlerBase;
+import com.nokia.tracebuilder.rules.ReadOnlyObjectRule;
+import com.nokia.tracebuilder.rules.TraceParameterRestrictionRule;
+
+/**
+ * Handler for delete command
+ * 
+ */
+final class DeleteAction extends TraceBuilderAction {
+
+	/**
+	 * Constructor
+	 */
+	DeleteAction() {
+		setText(Messages.getString("DeleteAction.Title")); //$NON-NLS-1$
+		setToolTipText(Messages.getString("DeleteAction.Tooltip")); //$NON-NLS-1$
+		setDefaultProperties(ActionIDs.DELETE_ACTION_ID,
+				TraceBuilderHelp.DELETE_OBJECT_HELP_CONTEXT);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.action.IAction#run()
+	 */
+	@Override
+	public void doRun() throws TraceBuilderException {
+		TraceBuilderGlobals.getTraceBuilder().delete();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.tracebuilder.action.TraceBuilderAction#getEnabledFlag(java.
+	 * lang.Object)
+	 */
+	@Override
+	protected boolean getEnabledFlag(Object selectedObject) {
+		boolean retval;
+		selectedObject = locationToTrace(selectedObject);
+		if (selectedObject instanceof TraceGroup) {
+			setText(Messages.getString("ActionFactory.DeleteGroupAction")); //$NON-NLS-1$
+			retval = true;
+		} else if (selectedObject instanceof Trace) {
+			setText(Messages.getString("ActionFactory.DeleteTraceAction")); //$NON-NLS-1$
+			retval = true;
+		} else if (selectedObject instanceof TraceParameter) {
+			TraceParameter selectedParameter = (TraceParameter) selectedObject;
+			Trace owner = selectedParameter.getTrace();
+			TraceParameterRestrictionRule restriction = owner
+					.getExtension(TraceParameterRestrictionRule.class);
+			ReadOnlyObjectRule readOnly = owner
+					.getExtension(ReadOnlyObjectRule.class);
+			if (readOnly != null
+					|| (restriction != null && !restriction
+							.canRemoveParameters())) {
+				setText(Messages.getString("DeleteAction.Title")); //$NON-NLS-1$
+				retval = false;
+			} else {
+				setText(Messages
+						.getString("ActionFactory.DeleteParameterAction")); //$NON-NLS-1$
+
+				// If there are last known locations, source file is not open
+				// and parameters cannot be deleted
+				LastKnownLocationList list = owner
+						.getExtension(LastKnownLocationList.class);
+				String groupName = owner.getGroup().getName();
+
+				// Only optional 32-bit instance identifier can be deleted from
+				// State Trace
+				GroupNameHandlerBase groupNameHandler = TraceBuilderGlobals
+						.getGroupNameHandler();
+				boolean isStateTrace = groupName.equals(groupNameHandler
+						.getDefaultGroups()[groupNameHandler
+						.getStateGroupIdIndex()]);
+				if ((list != null && list.hasLocations())
+						|| (isStateTrace && selectedParameter.getType().equals(
+								TraceParameter.ASCII))) {
+					retval = false;
+				} else {
+					retval = true;
+				}
+			}
+		} else if (selectedObject instanceof TraceConstantTable) {
+			if (!((TraceConstantTable) selectedObject).hasParameterReferences()) {
+				setText(Messages
+						.getString("ActionFactory.DeleteConstantTableAction")); //$NON-NLS-1$
+				retval = true;
+			} else {
+				setText(Messages.getString("DeleteAction.ConstantTableInUse")); //$NON-NLS-1$
+				retval = false;
+			}
+		} else if (selectedObject instanceof TraceConstantTableEntry) {
+			setText(Messages.getString("ActionFactory.DeleteConstantAction")); //$NON-NLS-1$
+			retval = true;
+		} else {
+			setText(Messages.getString("DeleteAction.Title")); //$NON-NLS-1$
+			retval = false;
+		}
+		return retval;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.tracebuilder.action.TraceBuilderAction#isInPopupMenu(java.lang
+	 * .Object)
+	 */
+	@Override
+	protected boolean isInPopupMenu(Object selectedObject) {
+		Object parent = locationToTrace(selectedObject);
+		return isEnabled() && (parent instanceof TraceObject)
+				&& !(selectedObject instanceof TraceLocation)
+				&& !(selectedObject instanceof LastKnownLocation);
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/DeleteGlobalAction.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 global focus command
+*
+*/
+package com.nokia.tracebuilder.action;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+
+/**
+ * Handler for global delete command
+ * 
+ */
+public class DeleteGlobalAction extends TraceBuilderGlobalAction {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.action.TraceBuilderGlobalAction#doRun()
+	 */
+	@Override
+	protected void doRun() throws TraceBuilderException {
+		TraceBuilderGlobals.getTraceBuilder().delete();
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/DeleteTracesAction.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 multiple traces
+*
+*/
+package com.nokia.tracebuilder.action;
+
+import com.nokia.tracebuilder.engine.TraceBuilderErrorMessages;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceBuilderHelp;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.TraceBuilderErrorCode;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+
+/**
+ * Action to remove multiple traces
+ * 
+ */
+final class DeleteTracesAction extends TraceBuilderAction {
+
+	/**
+	 * Constructor
+	 */
+	DeleteTracesAction() {
+		setText(Messages.getString("DeleteTracesAction.Title")); //$NON-NLS-1$
+		setToolTipText(Messages.getString("DeleteTracesAction.Tooltip")); //$NON-NLS-1$
+		setDefaultProperties(ActionIDs.DELETE_TRACES_ACTION_ID,
+				TraceBuilderHelp.DELETE_TRACES_HELP_CONTEXT);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.action.TraceBuilderAction#doRun()
+	 */
+	@Override
+	protected void doRun() throws TraceBuilderException {
+		TraceBuilderGlobals.getTraceBuilder().deleteMultipleTraces();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.action.TraceBuilderAction#getEnabledFlag(java.lang.Object)
+	 */
+	@Override
+	protected boolean getEnabledFlag(Object selectedObject) {
+		return true;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.action.TraceBuilderAction#isInPopupMenu(java.lang.Object)
+	 */
+	@Override
+	protected boolean isInPopupMenu(Object selectedObject) {
+		return false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.action.IAction#run()
+	 */
+	@Override
+	public void run() {
+		try {
+			doRun();
+		} catch (TraceBuilderException e) {
+			if (e.getErrorCode() == TraceBuilderErrorCode.NO_TRACES_TO_DELETE) {
+				String msg = TraceBuilderErrorMessages.getErrorMessage(
+						TraceBuilderErrorCode.NO_TRACES_TO_DELETE, null);
+				TraceBuilderGlobals.getEvents().postInfoMessage(msg, null);
+			} else {
+				TraceBuilderGlobals.getEvents().postError(e);
+			}
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/DeleteTracesGlobalAction.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 global focus command
+*
+*/
+package com.nokia.tracebuilder.action;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+
+/**
+ * Handler for global delete traces command
+ * 
+ */
+public class DeleteTracesGlobalAction extends TraceBuilderGlobalAction {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.action.TraceBuilderGlobalAction#doRun()
+	 */
+	@Override
+	protected void doRun() throws TraceBuilderException {
+		TraceBuilderGlobals.getTraceBuilder().deleteMultipleTraces();
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/EditPropertiesAction.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,139 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 properties command
+*
+*/
+package com.nokia.tracebuilder.action;
+
+import com.nokia.tracebuilder.engine.LastKnownLocation;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceBuilderHelp;
+import com.nokia.tracebuilder.engine.TraceLocation;
+import com.nokia.tracebuilder.engine.TraceLocationList;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceConstantTable;
+import com.nokia.tracebuilder.model.TraceConstantTableEntry;
+import com.nokia.tracebuilder.model.TraceGroup;
+import com.nokia.tracebuilder.model.TraceObject;
+import com.nokia.tracebuilder.model.TraceParameter;
+import com.nokia.tracebuilder.project.GroupNameHandlerBase;
+import com.nokia.tracebuilder.rules.ReadOnlyObjectRule;
+
+/**
+ * Handler for edit properties command
+ * 
+ */
+final class EditPropertiesAction extends TraceBuilderAction {
+
+	/**
+	 * Constructor
+	 */
+	EditPropertiesAction() {
+		setText(Messages.getString("EditPropertiesAction.Title")); //$NON-NLS-1$
+		setToolTipText(Messages.getString("EditPropertiesAction.Tooltip")); //$NON-NLS-1$
+		setDefaultProperties(ActionIDs.EDIT_PROPERTIES_ACTION_ID,
+				TraceBuilderHelp.EDIT_PROPERTIES_HELP_CONTEXT);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.action.TraceBuilderAction#doRun()
+	 */
+	@Override
+	protected void doRun() throws TraceBuilderException {
+		TraceBuilderGlobals.getTraceBuilder().showProperties();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.action.TraceBuilderAction#getEnabledFlag(java.lang.Object)
+	 */
+	@Override
+	protected boolean getEnabledFlag(Object selectedObject) {
+		boolean retval;
+		selectedObject = locationToTrace(selectedObject);
+		if (selectedObject instanceof TraceGroup) {
+			retval = true;
+			setText(Messages.getString("ActionFactory.GroupPropertiesAction")); //$NON-NLS-1$
+		} else if (selectedObject instanceof Trace) {
+			if (((Trace) selectedObject).getExtension(ReadOnlyObjectRule.class) != null) {
+				retval = false;
+				setText(Messages.getString("EditPropertiesAction.Title")); //$NON-NLS-1$
+			} else {
+				retval = true;
+				setText(Messages
+						.getString("ActionFactory.TracePropertiesAction")); //$NON-NLS-1$
+			}
+		} else if (selectedObject instanceof TraceConstantTable) {
+			if (!((TraceConstantTable) selectedObject).hasParameterReferences()) {
+				retval = true;
+				setText(Messages
+						.getString("ActionFactory.ConstantTableProperties")); //$NON-NLS-1$
+			} else {
+				retval = false;
+				setText(Messages
+						.getString("EditPropertiesAction.ConstantTableInUse")); //$NON-NLS-1$
+			}
+		} else if (selectedObject instanceof TraceConstantTableEntry) {
+			retval = true;
+			setText(Messages
+					.getString("ActionFactory.ConstantPropertiesAction")); //$NON-NLS-1$
+		} else {
+			retval = false;
+			setText(Messages.getString("EditPropertiesAction.Title")); //$NON-NLS-1$
+		}
+		return retval;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.action.TraceBuilderAction#isInPopupMenu(java.lang.Object)
+	 */
+	@Override
+	protected boolean isInPopupMenu(Object selectedObject) {
+		Object parent = locationToTrace(selectedObject);
+		boolean retval = isEnabled() && (parent instanceof TraceObject)
+				&& !(selectedObject instanceof TraceLocation)
+				&& !(selectedObject instanceof TraceParameter)
+				&& !(selectedObject instanceof LastKnownLocation);
+		if (retval && (selectedObject instanceof TraceLocationList)) {
+			// Unrelated locations list does not show this action
+			if (!(((TraceLocationList) selectedObject).getOwner() instanceof Trace)) {
+				retval = false;
+			}
+		} else if (retval && (selectedObject instanceof TraceGroup)) {
+			TraceGroup group = (TraceGroup) selectedObject;
+			String groupName = group.getName();
+			
+			// Name of TRACE_STATE and TRACE_PERFORMANCE groups can not be changed
+			GroupNameHandlerBase groupNameHandler = TraceBuilderGlobals.getGroupNameHandler();
+			String[] defaultGroups = groupNameHandler.getDefaultGroups();
+			if (groupName
+					.equals(defaultGroups[groupNameHandler.getStateGroupIdIndex()])
+					|| groupName
+							.equals(defaultGroups[groupNameHandler.getPerformanceGroupIdIndex()])) {
+				retval = false;
+			}
+
+		}
+		return retval;
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/EditPropertiesGlobalAction.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 global focus command
+*
+*/
+package com.nokia.tracebuilder.action;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+
+/**
+ * Handler for global edit properties command
+ * 
+ */
+public class EditPropertiesGlobalAction extends TraceBuilderGlobalAction {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.action.TraceBuilderGlobalAction#doRun()
+	 */
+	@Override
+	protected void doRun() throws TraceBuilderException {
+		TraceBuilderGlobals.getTraceBuilder().showProperties();
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/FocusGlobalAction.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 global focus command
+*
+*/
+package com.nokia.tracebuilder.action;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+
+/**
+ * Handler for global focus command
+ * 
+ */
+public class FocusGlobalAction extends TraceBuilderGlobalAction {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.action.TraceBuilderGlobalAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		TraceBuilderGlobals.getTraceBuilder().switchFocus();
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/InstrumentAction.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 instrument code command
+*
+*/
+package com.nokia.tracebuilder.action;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceBuilderHelp;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+
+/**
+ * Handler for instrument code command
+ * 
+ */
+final class InstrumentAction extends TraceBuilderAction {
+
+	/**
+	 * Constructor
+	 */
+	InstrumentAction() {
+		setText(Messages.getString("InstrumentAction.Title")); //$NON-NLS-1$
+		setToolTipText(Messages.getString("InstrumentAction.Tooltip")); //$NON-NLS-1$
+		setDefaultProperties(ActionIDs.INSTRUMENTER_ACTION_ID,
+				TraceBuilderHelp.INSTRUMENTER_HELP_CONTEXT);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.action.TraceBuilderAction#doRun()
+	 */
+	@Override
+	protected void doRun() throws TraceBuilderException {
+		TraceBuilderGlobals.getTraceBuilder().startInstrumenter();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.action.TraceBuilderAction#getEnabledFlag(java.lang.Object)
+	 */
+	@Override
+	protected boolean getEnabledFlag(Object selectedObject) {
+		return true;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.action.TraceBuilderAction#isInPopupMenu(java.lang.Object)
+	 */
+	@Override
+	protected boolean isInPopupMenu(Object selectedObject) {
+		return false;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/InstrumentGlobalAction.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 global focus command
+*
+*/
+package com.nokia.tracebuilder.action;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+
+/**
+ * Handler for global instrument command
+ * 
+ */
+public class InstrumentGlobalAction extends TraceBuilderGlobalAction {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.action.TraceBuilderGlobalAction#doRun()
+	 */
+	@Override
+	protected void doRun() throws TraceBuilderException {
+		TraceBuilderGlobals.getTraceBuilder().startInstrumenter();
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/Messages.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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.tracebuilder.action;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * String localization for action package
+ * 
+ */
+class Messages {
+
+	/**
+	 * Name of resource bundle
+	 */
+	private static final String BUNDLE_NAME = "com.nokia.tracebuilder.action.messages"; //$NON-NLS-1$
+
+	/**
+	 * Resource 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/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/OpenSourceAction.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies 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 for opening a source file
+ *
+ */
+package com.nokia.tracebuilder.action;
+
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.ui.IEditorDescriptor;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IDE;
+
+import com.nokia.tracebuilder.engine.LastKnownLocation;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.file.FileUtils;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+
+/**
+ * Action for opening a source file
+ * 
+ */
+final class OpenSourceAction extends TraceBuilderAction {
+
+	/**
+	 * Location which specifies the source to be opened
+	 */
+	private LastKnownLocation location;
+
+	/**
+	 * Constructor
+	 */
+	OpenSourceAction() {
+		setText(Messages.getString("OpenSourceAction.Title")); //$NON-NLS-1$
+		setToolTipText(Messages.getString("OpenSourceAction.Tooltip")); //$NON-NLS-1$
+		setDefaultProperties(null, null);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.action.TraceBuilderAction#doRun()
+	 */
+	@Override
+	protected void doRun() throws TraceBuilderException {
+		openSource(location.getFilePath(), location.getFileName());
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.tracebuilder.action.TraceBuilderAction#getEnabledFlag(java.
+	 * lang.Object)
+	 */
+	@Override
+	protected boolean getEnabledFlag(Object selectedObject) {
+		boolean retval;
+		if (selectedObject instanceof LastKnownLocation) {
+			location = (LastKnownLocation) selectedObject;
+			retval = true;
+		} else {
+			location = null;
+			retval = false;
+		}
+		return retval;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.action.TraceBuilderAction#isInMenu()
+	 */
+	@Override
+	protected boolean isInMenu() {
+		return false;
+	}
+
+	/**
+	 * Stores the location for next action call
+	 * 
+	 * @param location
+	 *            the location
+	 */
+	void setLocation(LastKnownLocation location) {
+		this.location = location;
+	}
+
+	/**
+	 * Opens a source file
+	 * 
+	 * @param filePath
+	 *            the file path
+	 * @param fileName
+	 *            the file name
+	 */
+	private void openSource(String filePath, String fileName) {
+		String pathString = filePath + fileName;
+		try {
+			IPath path = new Path(pathString);
+			IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+			IFile[] fileArr = root.findFilesForLocationURI(FileUtils.makeURI(path));
+			IFile file = null;
+			// There can be only one file with this url so take the first item
+			if (fileArr != null && fileArr.length > 0) {
+				file = fileArr[0];
+			}
+			Trace trace = location.getTrace();
+
+			// Store trace name, because it will be lost during editor open
+			// operation
+			String name = trace.getName();
+			if (file != null) {
+				IEditorDescriptor editorDesc = IDE.getDefaultEditor(file);
+				String defaultEditor;
+				if (editorDesc == null) {
+					defaultEditor = "org.eclipse.ui.DefaultTextEditor"; //$NON-NLS-1$
+				} else {
+					defaultEditor = editorDesc.getId();
+				}
+				IDE.openEditor(PlatformUI.getWorkbench()
+						.getActiveWorkbenchWindow().getActivePage(), file,
+						defaultEditor, true);
+			} else {
+				String msg = Messages
+						.getString("OpenSourceAction.FailedToOpenErrorPrefix") //$NON-NLS-1$
+						+ pathString;
+				TraceBuilderGlobals.getEvents().postErrorMessage(msg, null,
+						true);
+			}
+
+			// Return trace name back to trace
+			trace.setName(name);
+			TraceBuilderGlobals.getTraceBuilder().traceObjectSelected(trace,
+					false, true);
+		} catch (Exception e) {
+			String msg = Messages
+					.getString("OpenSourceAction.FailedToOpenErrorPrefix") //$NON-NLS-1$
+					+ pathString;
+			TraceBuilderGlobals.getEvents().postErrorMessage(msg, null, true);
+		}
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/ParseEnumAction.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 convert enum from source into a constant table
+*
+*/
+package com.nokia.tracebuilder.action;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceBuilderHelp;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+
+/**
+ * Action to convert enum from source into a constant table
+ * 
+ */
+final class ParseEnumAction extends TraceBuilderAction {
+
+	/**
+	 * Constructor
+	 */
+	ParseEnumAction() {
+		setText(Messages.getString("ParseEnumAction.Title")); //$NON-NLS-1$
+		setToolTipText(Messages.getString("ParseEnumAction.Tooltip")); //$NON-NLS-1$
+		setDefaultProperties(ActionIDs.PARSE_ENUM_ACTION_ID,
+				TraceBuilderHelp.PARSE_ENUM_HELP_CONTEXT);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.action.TraceBuilderAction#doRun()
+	 */
+	@Override
+	protected void doRun() throws TraceBuilderException {
+		TraceBuilderGlobals.getTraceBuilder()
+				.createConstantTableFromSelection();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.action.TraceBuilderAction#getEnabledFlag(java.lang.Object)
+	 */
+	@Override
+	protected boolean getEnabledFlag(Object selectedObject) {
+		return true;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.action.TraceBuilderAction#isInPopupMenu(java.lang.Object)
+	 */
+	@Override
+	protected boolean isInPopupMenu(Object selectedObject) {
+		return false;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/ParseEnumGlobalAction.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 global focus command
+*
+*/
+package com.nokia.tracebuilder.action;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+
+/**
+ * Handler for global parse enum command
+ * 
+ */
+public class ParseEnumGlobalAction extends TraceBuilderGlobalAction {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.action.TraceBuilderGlobalAction#doRun()
+	 */
+	@Override
+	protected void doRun() throws TraceBuilderException {
+		TraceBuilderGlobals.getTraceBuilder().createConstantTableFromSelection();
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/RemoveSourceAction.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,78 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 from source" action
+*
+*/
+package com.nokia.tracebuilder.action;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceBuilderHelp;
+import com.nokia.tracebuilder.engine.TraceLocation;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+
+/**
+ * Handler for "Remove from source" action
+ * 
+ */
+final class RemoveSourceAction extends TraceBuilderAction {
+
+	/**
+	 * Constructor
+	 */
+	RemoveSourceAction() {
+		setText(Messages.getString("RemoveSourceAction.Title")); //$NON-NLS-1$
+		setToolTipText(Messages.getString("RemoveSourceAction.Tooltip")); //$NON-NLS-1$
+		setDefaultProperties(null,
+				TraceBuilderHelp.REMOVE_TRACE_HELP_CONTEXT);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.action.TraceBuilderAction#doRun()
+	 */
+	@Override
+	protected void doRun() throws TraceBuilderException {
+		TraceBuilderGlobals.getTraceBuilder().removeFromSource();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.action.TraceBuilderAction#getEnabledFlag(java.lang.Object)
+	 */
+	@Override
+	protected boolean getEnabledFlag(Object selectedObject) {
+		boolean retval;
+		if (selectedObject instanceof TraceLocation) {
+			retval = true;
+		} else {
+			retval = false;
+		}
+		return retval;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.action.TraceBuilderAction#isInMenu()
+	 */
+	@Override
+	protected boolean isInMenu() {
+		return false;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/RemoveUnrelatedAction.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,85 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Remove all unrelated traces action
+*
+*/
+package com.nokia.tracebuilder.action;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceBuilderHelp;
+import com.nokia.tracebuilder.engine.TraceLocationList;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+
+/**
+ * Remove all unrelated traces action
+ * 
+ */
+final class RemoveUnrelatedAction extends TraceBuilderAction {
+
+	/**
+	 * Constructor
+	 */
+	RemoveUnrelatedAction() {
+		setText(Messages.getString("RemoveUnrelatedAction.Title")); //$NON-NLS-1$
+		setToolTipText(Messages.getString("RemoveUnrelatedAction.Tooltip")); //$NON-NLS-1$
+		setDefaultProperties(null,
+				TraceBuilderHelp.REMOVE_UNRELATED_HELP_CONTEXT);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.action.TraceBuilderAction#doRun()
+	 */
+	@Override
+	protected void doRun() throws TraceBuilderException {
+		TraceBuilderGlobals.getTraceBuilder().removeUnrelatedFromSource();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.action.TraceBuilderAction#getEnabledFlag(java.lang.Object)
+	 */
+	@Override
+	protected boolean getEnabledFlag(Object selectedObject) {
+		boolean retval;
+		if (selectedObject instanceof TraceLocationList) {
+			if (((TraceLocationList) selectedObject).getOwner() instanceof Trace) {
+				retval = false;
+			} else if (((TraceLocationList) selectedObject).getListTitle() != null) {
+				retval = false;
+			} else {
+				retval = true;
+			}
+		} else {
+			retval = false;
+		}
+		return retval;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.action.TraceBuilderAction#isInMenu()
+	 */
+	@Override
+	protected boolean isInMenu() {
+		return false;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/ToolbarShortcutAction.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,77 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 Trace Builder main view
+*
+*/
+package com.nokia.tracebuilder.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 Trace Builder main view
+ * 
+ */
+public class ToolbarShortcutAction implements IWorkbenchWindowActionDelegate {
+
+	/**
+	 * Trace Builder main view ID
+	 */
+	private final String TB_VIEW_ID = "com.nokia.tracebuilder.view.TraceView"; //$NON-NLS-1$
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
+	 */
+	public void dispose() {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.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(TB_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/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/TraceBuilderAction.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,168 @@
+/*
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies 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 Builder view
+ *
+ */
+package com.nokia.tracebuilder.action;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.tracebuilder.engine.LastKnownLocation;
+import com.nokia.tracebuilder.engine.LastKnownLocationList;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceBuilderHelp;
+import com.nokia.tracebuilder.engine.TraceLocation;
+import com.nokia.tracebuilder.engine.TraceLocationList;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.view.TraceViewPlugin;
+
+/**
+ * Base class for all action objects of Trace Builder view
+ * 
+ */
+abstract class TraceBuilderAction extends Action {
+
+	/**
+	 * Constructor
+	 */
+	protected TraceBuilderAction() {
+	}
+
+	/**
+	 * Constructor with action type
+	 * 
+	 * @param type
+	 *            the action type
+	 */
+	protected TraceBuilderAction(int type) {
+		super("", type); //$NON-NLS-1$
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.action.IAction#run()
+	 */
+	@Override
+	public void run() {
+		try {
+			doRun();
+		} catch (TraceBuilderException e) {
+			TraceBuilderGlobals.getEvents().postError(e);
+		}
+	}
+
+	/**
+	 * Sets the properties of this action
+	 * 
+	 * @param actionID
+	 *            the action ID
+	 * @param helpID
+	 *            the help ID
+	 */
+	protected void setDefaultProperties(String actionID, String helpID) {
+		if (actionID != null) {
+			setImageDescriptor(TraceViewPlugin
+					.getImageDescriptor(ActionIDs.ICONS_DIRECTORY + actionID
+							+ ActionIDs.GIF));
+			setActionDefinitionId(ActionIDs.ACTION_ID_BASE + actionID);
+		}
+		if (helpID != null) {
+			PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
+					TraceBuilderHelp.HELP_CONTEXT_BASE + helpID);
+		}
+	}
+
+	/**
+	 * Enables this action based on model validity and selected object
+	 * 
+	 * @param modelValid
+	 *            the model validity
+	 * @param selectedObject
+	 *            the object
+	 */
+	protected void setEnabled(boolean modelValid, Object selectedObject) {
+		if (!modelValid) {
+			setEnabled(false);
+		} else {
+			setEnabled(getEnabledFlag(selectedObject));
+		}
+	}
+
+	/**
+	 * Checks if this action belongs to the menu
+	 * 
+	 * @return true if in menu, false if not
+	 */
+	protected boolean isInMenu() {
+		return true;
+	}
+
+	/**
+	 * Checks if this action belongs to the pop-up menu
+	 * 
+	 * @param selectedObject
+	 *            the selection associated to the pop-up
+	 * @return true if in pop-up, false if not
+	 */
+	protected boolean isInPopupMenu(Object selectedObject) {
+		return isEnabled();
+	}
+
+	/**
+	 * If given object is a location or location list, this returns the
+	 * associated trace. Otherwise returns the object passed as parameter
+	 * 
+	 * @param selectedObject
+	 *            the object
+	 * @return the trace related to the object
+	 */
+	protected Object locationToTrace(Object selectedObject) {
+		Object retval = null;
+		if (selectedObject instanceof TraceLocation) {
+			retval = ((TraceLocation) selectedObject).getTrace();
+		} else if (selectedObject instanceof LastKnownLocation) {
+			retval = ((LastKnownLocation) selectedObject).getTrace();
+		} else if (selectedObject instanceof TraceLocationList) {
+			retval = ((TraceLocationList) selectedObject).getOwner();
+		} else if (selectedObject instanceof LastKnownLocationList) {
+			retval = ((LastKnownLocationList) selectedObject).getOwner();
+		}
+		if (retval == null) {
+			retval = selectedObject;
+		}
+		return retval;
+	}
+
+	/**
+	 * Gets the enabled flag based on the object selected by user
+	 * 
+	 * @param selectedObject
+	 *            the object
+	 * @return true if enabled, false if not
+	 */
+	protected abstract boolean getEnabledFlag(Object selectedObject);
+
+	/**
+	 * Runs this action
+	 * 
+	 * @throws TraceBuilderException
+	 *             if an exception occurs
+	 */
+	protected abstract void doRun() throws TraceBuilderException;
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/TraceBuilderEditorAction.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,75 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 editor actions of Trace Builder
+*
+*/
+package com.nokia.tracebuilder.action;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IEditorActionDelegate;
+import org.eclipse.ui.IEditorPart;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+
+/**
+ * Base class for all editor actions of Trace Builder
+ * 
+ */
+public abstract class TraceBuilderEditorAction implements IEditorActionDelegate {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ui.IEditorActionDelegate#setActiveEditor(org.eclipse.jface.action.IAction,
+	 *      org.eclipse.ui.IEditorPart)
+	 */
+	public void setActiveEditor(IAction action, IEditorPart targetEditor) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+	 */
+	public void run(IAction action) {
+		try {
+			doRun();
+		} catch (TraceBuilderException e) {
+			TraceBuilderGlobals.getEvents().postError(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) {
+	}
+
+	/**
+	 * Runs this action
+	 * 
+	 * @throws TraceBuilderException
+	 *             if processing fails, shows an error dialog based on the
+	 *             exception content
+	 */
+	protected abstract void doRun() throws TraceBuilderException;
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/TraceBuilderGlobalAction.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies 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 Trace Builder
+ *
+ */
+package com.nokia.tracebuilder.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.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+
+/**
+ * Base class for all global action objects of Trace Builder
+ * 
+ */
+public abstract class TraceBuilderGlobalAction implements IHandler {
+
+	/**
+	 * Constructor
+	 */
+	public TraceBuilderGlobalAction() {
+	}
+
+	/*
+	 * (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 {
+		try {
+			if (TraceBuilderGlobals.isViewRegistered()) {
+				doRun();
+			}
+		} catch (TraceBuilderException e) {
+			TraceBuilderGlobals.getEvents().postError(e);
+		}
+
+		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
+	 * 
+	 * @throws TraceBuilderException
+	 *             if processing fails, shows an error dialog based on the
+	 *             exception content
+	 */
+	protected abstract void doRun() throws TraceBuilderException;
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/TraceViewActionProvider.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Creates the action objects for Trace Builder view
+*
+*/
+package com.nokia.tracebuilder.action;
+
+import java.util.Iterator;
+
+import org.eclipse.jface.action.IAction;
+
+import com.nokia.tracebuilder.engine.TraceViewExtension;
+
+/**
+ * Interface that can be implemented by trace view extensions to provide actions
+ * to the view
+ * 
+ */
+public interface TraceViewActionProvider extends TraceViewExtension {
+
+	/**
+	 * Gets a iterator of action objects
+	 * 
+	 * @return the action list iterator
+	 */
+	public Iterator<IAction> getActions();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/TraceViewActions.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Allows TraceBuilder actions to be associated to different menus
+*
+*/
+package com.nokia.tracebuilder.action;
+
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+
+import com.nokia.tracebuilder.engine.TraceBuilderActions;
+
+/**
+ * Allows TraceBuilder actions to be associated to different menus
+ * 
+ */
+public interface TraceViewActions extends TraceBuilderActions {
+
+	/**
+	 * Fills the given context menu with TraceBuilder actions. Actions are based
+	 * on last call to enableActions
+	 * 
+	 * @param manager
+	 *            the menu manager
+	 */
+	public void fillContextMenu(IMenuManager manager);
+
+	/**
+	 * Fills the given menu with TraceBuilder actions. Actions are based on last
+	 * call to enableActions
+	 * 
+	 * @param manager
+	 *            the menu manager
+	 */
+	public void fillMenu(IMenuManager manager);
+
+	/**
+	 * Fills the given toolbar with TraceBuilder actions
+	 * 
+	 * @param manager
+	 *            the toolbar manager
+	 */
+	public void fillToolBar(IToolBarManager manager);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/messages.properties	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,38 @@
+AddTraceAction.Title=Add New Trace
+AddTraceAction.Tooltip=Adds a new trace to the active trace group
+ConvertTraceAction.Title=Convert to 
+ConvertTraceAction.Tooltip=Creates a new trace which has the same name as the location
+InsertTraceAction.Title=Insert Selected Trace to Source
+InsertTraceAction.Tooltip=Inserts the selected trace to the source file
+EditPropertiesAction.Title=Properties
+EditPropertiesAction.Tooltip=View and edit the properties of the selected object
+EditPropertiesAction.ConstantTableInUse=In use, cannot modify
+DeleteAction.Title=Delete
+DeleteAction.Tooltip=Removes the selected entry from the model
+DeleteAction.ConstantTableInUse=In use, cannot delete
+DeleteTracesAction.Title=Delete Traces
+DeleteTracesAction.Tooltip=Delete multiple traces from groups or instrumentations
+AddParameterAction.Title=Add New Parameter
+AddParameterAction.Tooltip=Adds a new parameter to the selected object
+ActionFactory.GroupPropertiesAction=Group Properties
+ActionFactory.TracePropertiesAction=Trace Properties
+ActionFactory.ConstantPropertiesAction=Enum Constant Properties
+ActionFactory.DeleteGroupAction=Delete Group
+ActionFactory.DeleteConstantTableAction=Delete Enum
+ActionFactory.ConstantTableProperties=Enum Properties
+ActionFactory.DeleteTraceAction=Delete Trace
+ActionFactory.DeleteParameterAction=Delete Parameter
+ActionFactory.DeleteConstantAction=Delete Enum Value
+AddConstantAction.Title=Add Enum / Constant to Enum
+AddConstantAction.Tooltip=Adds a value-to-string mapping to the enum
+InstrumentAction.Title=Instrument Code
+InstrumentAction.Tooltip=Starts the code instrumenter
+RemoveSourceAction.Title=Remove Location
+RemoveSourceAction.Tooltip=Removes trace from source file
+RemoveUnrelatedAction.Title=Remove All Unrelated Locations
+RemoveUnrelatedAction.Tooltip=Removes all unrelated traces from source files
+ParseEnumAction.Title=Parse Enum
+ParseEnumAction.Tooltip=Parses an enum from the source
+OpenSourceAction.Title=Open Source File
+OpenSourceAction.Tooltip=Opens the source file which contains the trace
+OpenSourceAction.FailedToOpenErrorPrefix=Failed to open 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/action/package.html	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,3 @@
+<html><body>
+Trace builder event handlers
+</body></html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/preferences/ConfigurationImpl.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,190 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Configuration interface implementation
+*
+*/
+package com.nokia.tracebuilder.preferences;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+
+import com.nokia.tracebuilder.engine.TraceBuilderConfiguration;
+import com.nokia.tracebuilder.engine.TraceBuilderConfigurationListener;
+import com.nokia.tracebuilder.view.TraceViewPlugin;
+
+/**
+ * Configuration interface implementation
+ * 
+ */
+public final class ConfigurationImpl implements TraceBuilderConfiguration {
+
+	/**
+	 * UI preferences
+	 */
+	private IPreferenceStore uiPreferences;
+
+	/**
+	 * List of configuration listeners
+	 */
+	private ArrayList<TraceBuilderConfigurationListener> configurationListeners;
+
+	/**
+	 * Property change listener for preferences
+	 */
+	private IPropertyChangeListener propertyChangeListener = new IPropertyChangeListener() {
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see org.eclipse.jface.util.IPropertyChangeListener#
+		 *      propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
+		 */
+		public void propertyChange(PropertyChangeEvent event) {
+			if (configurationListeners != null) {
+				Iterator<TraceBuilderConfigurationListener> itr = configurationListeners
+						.iterator();
+				while (itr.hasNext()) {
+					itr.next().configurationChanged(event.getProperty(),
+							event.getNewValue());
+				}
+			}
+		}
+	};
+
+	/**
+	 * Constructor
+	 */
+	public ConfigurationImpl() {
+		uiPreferences = TraceViewPlugin.getDefault().getPreferenceStore();
+		setDefaults();
+		uiPreferences.addPropertyChangeListener(propertyChangeListener);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderConfiguration#hasEntry(java.lang.String)
+	 */
+	public boolean hasEntry(String entryName) {
+		return uiPreferences.contains(entryName);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderConfiguration#setFlag(java.lang.String,
+	 *      boolean)
+	 */
+
+	public void setFlag(String flagName, boolean flag) {
+		uiPreferences.setValue(flagName, flag);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderConfiguration#getFlag(java.lang.String)
+	 */
+	public boolean getFlag(String flagName) {
+		return uiPreferences.getBoolean(flagName);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderConfiguration#setValue(java.lang.String,
+	 *      int)
+	 */
+	public void setValue(String valueName, int value) {
+		uiPreferences.setValue(valueName, value);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderConfiguration#getValue(java.lang.String)
+	 */
+	public int getValue(String valueName) {
+		return uiPreferences.getInt(valueName);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderConfiguration#setText(java.lang.String,
+	 *      java.lang.String)
+	 */
+	public void setText(String textName, String text) {
+		uiPreferences.setValue(textName, text);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderConfiguration#getText(java.lang.String)
+	 */
+	public String getText(String textName) {
+		return uiPreferences.getString(textName);
+	}
+
+	/**
+	 * Sets default values for configuration entries not found from
+	 * configuration file
+	 */
+	private void setDefaults() {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderConfiguration#
+	 *      addConfigurationListener(com.nokia.tracebuilder.engine.TraceBuilderConfigurationListener)
+	 */
+	public void addConfigurationListener(
+			TraceBuilderConfigurationListener configurationListener) {
+		if (configurationListeners == null) {
+			configurationListeners = new ArrayList<TraceBuilderConfigurationListener>();
+		}
+		configurationListeners.add(configurationListener);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderConfiguration#
+	 *      removeConfigurationListener(com.nokia.tracebuilder.engine.TraceBuilderConfigurationListener)
+	 */
+	public void removeConfigurationListener(
+			TraceBuilderConfigurationListener configurationListener) {
+		if (configurationListeners != null) {
+			configurationListeners.remove(configurationListener);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderConfiguration#isAvailable()
+	 */
+	public boolean isAvailable() {
+		return true;
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/preferences/GeneralPreferencePage.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,135 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* General preferences page
+*
+*/
+package com.nokia.tracebuilder.preferences;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.jface.preference.RadioGroupFieldEditor;
+import org.eclipse.jface.preference.StringFieldEditor;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.tracebuilder.engine.TraceBuilderConfiguration;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceBuilderHelp;
+import com.nokia.tracebuilder.project.TraceProjectAPI;
+import com.nokia.tracebuilder.project.TraceProjectAPIList;
+import com.nokia.tracebuilder.view.TraceViewPlugin;
+
+/**
+ * This class represents a preference page that is contributed to the
+ * Preferences dialog. By subclassing <samp>FieldEditorPreferencePage</samp>, we
+ * can use the field support built into JFace that allows us to create a page
+ * that is small and knows how to save, restore and apply itself.
+ * <p>
+ * This page is used to modify preferences only. They are stored in the
+ * preference store that belongs to the main plug-in class. That way,
+ * preferences can be accessed directly via the preference store.
+ * 
+ */
+public class GeneralPreferencePage extends FieldEditorPreferencePage implements
+		IWorkbenchPreferencePage {
+
+	/**
+	 * Number of columns in format radio group
+	 */
+	private static final int FORMAT_COLUMNS = 1; // CodForChk_Dis_Magic
+
+	/**
+	 * Constructor
+	 */
+	public GeneralPreferencePage() {
+		super(GRID);
+		setPreferenceStore(TraceViewPlugin.getDefault().getPreferenceStore());
+		setDescription(Messages.getString("GeneralPreferencePage.Description")); //$NON-NLS-1$
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors
+	 * ()
+	 */
+	@Override
+	protected void createFieldEditors() {
+		String formatGroupTitle = Messages
+				.getString("GeneralPreferencePage.TraceFormatTitle"); //$NON-NLS-1$
+		TraceProjectAPIList apilist = TraceBuilderGlobals.getTraceModel()
+				.getExtension(TraceProjectAPIList.class);
+		if (apilist != null) {
+			Iterator<TraceProjectAPI> apis = apilist.getAPIs();
+			ArrayList<String[]> list = new ArrayList<String[]>();
+			while (apis.hasNext()) {
+				TraceProjectAPI api = apis.next();
+				if (api.isVisibleInConfiguration()) {
+					String name = api.getName();
+					String title = api.getTitle();
+					list.add(new String[] { title, name });
+				}
+			}
+			if (list.size() > 1) {
+				String[][] formatters = new String[list.size()][];
+				list.toArray(formatters);
+				addField(new RadioGroupFieldEditor(
+						TraceBuilderConfiguration.FORMATTER_NAME,
+						formatGroupTitle, FORMAT_COLUMNS, formatters,
+						getFieldEditorParent(), true));
+			}
+		}
+		addField(new BooleanFieldEditor(
+				TraceBuilderConfiguration.PRINTF_SUPPORT,
+				Messages
+						.getString("GeneralPreferencePage.PrintfParserSupportTitle"), //$NON-NLS-1$
+				getFieldEditorParent()));
+		addField(new StringFieldEditor(
+				TraceBuilderConfiguration.PRINTF_EXTENSION, Messages
+						.getString("GeneralPreferencePage.PrintfMacroTitle"), //$NON-NLS-1$
+				StringFieldEditor.UNLIMITED, getFieldEditorParent()));
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.preference.FieldEditorPreferencePage#initialize()
+	 */
+	@Override
+	protected void initialize() {
+		super.initialize();
+
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(
+				getControl(),
+				TraceBuilderHelp.HELP_CONTEXT_BASE
+						+ TraceBuilderHelp.GENERAL_PREFERENCES_CONTEXT);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+	 */
+	public void init(IWorkbench workbench) {
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/preferences/Messages.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 preferences package
+*
+*/
+package com.nokia.tracebuilder.preferences;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * Localized strings for preferences package
+ * 
+ */
+class Messages {
+
+	/**
+	 * Bundle name
+	 */
+	private static final String BUNDLE_NAME = "com.nokia.tracebuilder.preferences.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/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/preferences/PreferenceInitializer.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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.tracebuilder.preferences;
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+
+/**
+ * Class used to initialize default preference values.
+ * 
+ */
+public class PreferenceInitializer extends AbstractPreferenceInitializer {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#
+	 *      initializeDefaultPreferences()
+	 */
+	@Override
+	public void initializeDefaultPreferences() {
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/preferences/TraceBuilderConfigurationDefaults.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Default configuration values
+*
+*/
+package com.nokia.tracebuilder.preferences;
+
+import com.nokia.tracebuilder.engine.TraceBuilderConfiguration;
+
+/**
+ * Default configuration values
+ * 
+ */
+interface TraceBuilderConfigurationDefaults {
+
+	/**
+	 * Default comment position
+	 */
+	String COMMENT_POSITION = TraceBuilderConfiguration.COMMENT_POSITION_AFTER_TRACE;
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/preferences/messages.properties	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,4 @@
+GeneralPreferencePage.Description=General preferences
+GeneralPreferencePage.TraceFormatTitle=Default Trace Format
+GeneralPreferencePage.PrintfMacroTitle=Printf Macro:
+GeneralPreferencePage.PrintfParserSupportTitle=Printf Parser Support
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/preferences/package.html	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,3 @@
+<html><body>
+Trace builder preferences
+</body></html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/CheckListCheckStateListener.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,194 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 listener for tree viewer check boxes
+*
+*/
+package com.nokia.tracebuilder.view;
+
+import java.util.Iterator;
+
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTreeViewer;
+import org.eclipse.jface.viewers.ICheckStateListener;
+
+import com.nokia.tracebuilder.engine.CheckListDialogEntry;
+
+/**
+ * State listener for tree viewer check boxes
+ * 
+ */
+final class CheckListCheckStateListener implements ICheckStateListener {
+
+	/**
+	 * Content provider
+	 */
+	private final CheckboxTreeViewer viewer;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param viewer
+	 *            the viewer
+	 */
+	CheckListCheckStateListener(CheckboxTreeViewer viewer) {
+		this.viewer = viewer;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.viewers.ICheckStateListener#
+	 *      checkStateChanged(org.eclipse.jface.viewers.CheckStateChangedEvent)
+	 */
+	public void checkStateChanged(CheckStateChangedEvent event) {
+		CheckListDialogEntry entry = (CheckListDialogEntry) event.getElement();
+		boolean newState = event.getChecked();
+		// View update is not needed with the entry that was clicked by user
+		checkEntryAndRelatives(entry, newState, false);
+	}
+
+	/**
+	 * Changes the state of an entry, its parent and children
+	 * 
+	 * @param entry
+	 *            the entry
+	 * @param newState
+	 *            the new entry state
+	 * @param updateView
+	 *            true if view needs to be updated
+	 * @return true if entries were changed
+	 */
+	private boolean checkEntryAndRelatives(CheckListDialogEntry entry,
+			boolean newState, boolean updateView) {
+		boolean changed = checkEntry(entry, newState, updateView);
+		if (changed) {
+			viewer.setSubtreeChecked(entry, newState);
+			checkChildren(entry, newState);
+			checkParent(entry);
+		}
+		return changed;
+	}
+
+	/**
+	 * Checks the children of given entry
+	 * 
+	 * @param entry
+	 *            the entry
+	 * @param newState
+	 *            the new state
+	 */
+	private void checkChildren(CheckListDialogEntry entry, boolean newState) {
+		for (CheckListDialogEntry child : entry) {
+			child.setChecked(newState);
+			checkChildren(child, newState);
+		}
+	}
+
+	/**
+	 * Checks an entry and unchecks the partially checked flag if it exists
+	 * 
+	 * @param entry
+	 *            the entry
+	 * @param newState
+	 *            the new entry state
+	 * @param updateView
+	 *            true if view needs to be updated
+	 * @return true if entry was changed
+	 */
+	private boolean checkEntry(CheckListDialogEntry entry, boolean newState,
+			boolean updateView) {
+		boolean retval;
+		if (entry.isChecked() != newState) {
+			entry.setChecked(newState);
+			if (entry.isPartiallyChecked()) {
+				entry.setPartiallyChecked(false);
+				viewer.setGrayChecked(entry, false);
+			}
+			if (updateView) {
+				viewer.setChecked(entry, newState);
+			}
+			retval = true;
+		} else {
+			retval = false;
+		}
+		return retval;
+	}
+
+	/**
+	 * Recursively checks the parent of the checked element. If all children are
+	 * checked, the parent is checked. If all children are unchecked, the parent
+	 * is unchecked. If children are partially checked, the parent is grayed.
+	 * 
+	 * @param entry
+	 *            the entry whose parent needs to be checked
+	 */
+	private void checkParent(CheckListDialogEntry entry) {
+		CheckListDialogEntry parent = entry.getParent();
+		if (parent != null && parent.hasChildren()) {
+			boolean checked = false;
+			boolean unchecked = false;
+			boolean partiallyChecked = false;
+			Iterator<CheckListDialogEntry> children = parent.getChildren();
+			while (children.hasNext() && !partiallyChecked) {
+				CheckListDialogEntry child = children.next();
+				boolean childChecked = child.isChecked();
+				boolean childPartial = child.isPartiallyChecked();
+				if (childPartial) {
+					partiallyChecked = true;
+				} else if (childChecked) {
+					checked = true;
+					if (unchecked) {
+						partiallyChecked = true;
+					}
+				} else {
+					unchecked = true;
+					if (checked) {
+						partiallyChecked = true;
+					}
+				}
+			}
+			if (partiallyChecked) {
+				if (!parent.isPartiallyChecked()) {
+					viewer.setGrayChecked(parent, true);
+					parent.setPartiallyChecked(true);
+				} else if (!parent.isChecked()) {
+					viewer.setChecked(parent, true);
+				}
+				// Checked flag needs to be set in both cases
+				parent.setChecked(true);
+			} else if (checked) {
+				if (parent.isPartiallyChecked()) {
+					viewer.setGrayed(parent, false);
+					parent.setPartiallyChecked(false);
+				}
+				if (!parent.isChecked()) {
+					viewer.setChecked(parent, true);
+					parent.setChecked(true);
+				}
+			} else {
+				if (parent.isPartiallyChecked()) {
+					viewer.setGrayChecked(parent, false);
+					parent.setPartiallyChecked(false);
+				} else if (parent.isChecked()) {
+					viewer.setChecked(parent, false);
+				}
+				// Checked flag needs to be set in both cases
+				parent.setChecked(false);
+			}
+			checkParent(parent);
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/CheckListSelectionDialog.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,172 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Check list selection dialog
+*
+*/
+package com.nokia.tracebuilder.view;
+
+import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.jface.viewers.CheckboxTreeViewer;
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.jface.viewers.ILabelProvider;
+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.widgets.Combo;
+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.tracebuilder.engine.CheckListDialogEntry;
+import com.nokia.tracebuilder.engine.TraceBuilderDialogs.CheckListDialogParameters;
+
+/**
+ * Check list selection dialog
+ * 
+ */
+class CheckListSelectionDialog extends TitleAreaDialog {
+
+	/**
+	 * Table width
+	 */
+	private static final int TREE_WIDTH = 400; // CodForChk_Dis_Magic
+
+	/**
+	 * Table height
+	 */
+	private static final int TREE_HEIGHT = 300; // CodForChk_Dis_Magic
+
+	/**
+	 * Content provider
+	 */
+	private IContentProvider contentProvider;
+
+	/**
+	 * Label provider
+	 */
+	private ILabelProvider labelProvider;
+
+	/**
+	 * Tree viewer
+	 */
+	private CheckboxTreeViewer viewer;
+
+	/**
+	 * Dialog parameters
+	 */
+	private CheckListDialogParameters parameters;
+
+	/**
+	 * Root selector combo box
+	 */
+	private Combo rootSelector;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param shell
+	 *            the dialog shell
+	 * @param parameters
+	 *            dialog parameters
+	 */
+	CheckListSelectionDialog(Shell shell, CheckListDialogParameters parameters) {
+		super(shell);
+		contentProvider = new CheckListSelectionDialogContentProvider();
+		labelProvider = new CheckListSelectionDialogLabelProvider();
+		this.parameters = parameters;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.dialogs.TitleAreaDialog#
+	 *      createContents(org.eclipse.swt.widgets.Composite)
+	 */
+	@Override
+	protected Control createContents(Composite parent) {
+		Control control = super.createContents(parent);
+		// Registers the help context to the root control
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(control,
+				TraceViewHelp.getCheckListDialogContext(parameters.dialogType));
+		return control;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.dialogs.TitleAreaDialog#
+	 *      createDialogArea(org.eclipse.swt.widgets.Composite)
+	 */
+	@Override
+	protected Control createDialogArea(Composite parent) {
+		setTitle(TraceViewMessages.getCheckListTitle(parameters.dialogType));
+		setMessage(TraceViewMessages.getCheckListText(parameters.dialogType));
+		getShell().setText(
+				TraceViewMessages.getCheckListTitle(parameters.dialogType));
+		Composite composite = (Composite) super.createDialogArea(parent);
+		if (parameters.showRoot) {
+			createRootSelector(composite);
+		}
+		viewer = new CheckboxTreeViewer(composite, SWT.BORDER);
+		GridData data = new GridData(GridData.FILL_BOTH);
+		data.heightHint = TREE_HEIGHT;
+		data.widthHint = TREE_WIDTH;
+		viewer.getTree().setLayoutData(data);
+		viewer.setContentProvider(contentProvider);
+		viewer.setLabelProvider(labelProvider);
+		viewer.setInput(parameters.rootItems.get(0));
+		((CheckListSelectionDialogContentProvider) contentProvider)
+				.initializeCheckStates(parameters.expandLevel);
+		return composite;
+	}
+
+	/**
+	 * Creates the root selector combo box
+	 * 
+	 * @param composite
+	 *            the parent composite
+	 */
+	private void createRootSelector(Composite composite) {
+		rootSelector = new Combo(composite, SWT.BORDER | SWT.READ_ONLY);
+		GridData gridData = new GridData();
+		gridData.horizontalAlignment = GridData.FILL;
+		rootSelector.setLayoutData(gridData);
+		for (int i = 0; i < parameters.rootItems.size(); i++) {
+			rootSelector
+					.add(parameters.rootItems.get(i).getObject().toString());
+		}
+		rootSelector.select(0);
+		rootSelector.addSelectionListener(new SelectionAdapter() {
+
+			/*
+			 * (non-Javadoc)
+			 * 
+			 * @see org.eclipse.swt.events.SelectionAdapter#
+			 *      widgetSelected(org.eclipse.swt.events.SelectionEvent)
+			 */
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				CheckListDialogEntry entry = parameters.rootItems
+						.get(rootSelector.getSelectionIndex());
+				viewer.setInput(entry);
+			}
+
+		});
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/CheckListSelectionDialogContentProvider.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,218 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 Builder view implementation
+*
+*/
+package com.nokia.tracebuilder.view;
+
+import org.eclipse.jface.viewers.CheckboxTreeViewer;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+import com.nokia.tracebuilder.engine.CheckListDialogEntry;
+
+/**
+ * Content provider for check list dialog
+ * 
+ */
+class CheckListSelectionDialogContentProvider implements ITreeContentProvider {
+
+	/**
+	 * List root
+	 */
+	private CheckListDialogEntry rootItem;
+
+	/**
+	 * Dummy object
+	 */
+	private Object[] dummy = new Object[0];
+
+	/**
+	 * The viewer
+	 */
+	private CheckboxTreeViewer viewer;
+
+	/**
+	 * Constructor
+	 */
+	CheckListSelectionDialogContentProvider() {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.viewers.IStructuredContentProvider#
+	 *      getElements(java.lang.Object)
+	 */
+	public Object[] getElements(Object inputElement) {
+		return rootItem.childrenToArray();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
+	 */
+	public Object[] getChildren(Object parentElement) {
+		Object[] retval;
+		if (parentElement instanceof CheckListDialogEntry) {
+			retval = ((CheckListDialogEntry) parentElement).childrenToArray();
+		} else {
+			retval = dummy;
+		}
+		return retval;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
+	 */
+	public Object getParent(Object element) {
+		Object retval;
+		if (element instanceof CheckListDialogEntry) {
+			retval = ((CheckListDialogEntry) element).getParent();
+		} else {
+			retval = null;
+		}
+		return retval;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
+	 */
+	public boolean hasChildren(Object element) {
+		boolean retval;
+		if (element instanceof CheckListDialogEntry) {
+			retval = ((CheckListDialogEntry) element).hasChildren();
+		} else {
+			retval = false;
+		}
+		return retval;
+	}
+
+	/*
+	 * (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) {
+		this.viewer = (CheckboxTreeViewer) viewer;
+		if (rootItem != null && newInput != null) {
+			// Clears the check states of previous root
+			setCheckStates(rootItem, false);
+		}
+		rootItem = (CheckListDialogEntry) newInput;
+	}
+
+	/**
+	 * Recursively clears all check states
+	 * 
+	 * @param entry
+	 *            the entry to be cleared
+	 * @param flag
+	 *            new check state
+	 */
+	private void setCheckStates(CheckListDialogEntry entry, boolean flag) {
+		entry.setChecked(flag);
+		for (CheckListDialogEntry child : entry) {
+			setCheckStates(child, flag);
+		}
+	}
+
+	/**
+	 * Checks all elements if root is checked
+	 * 
+	 * @param expandLevel
+	 *            the number of tree levels to expand
+	 */
+	void initializeCheckStates(int expandLevel) {
+		viewer.addCheckStateListener(new CheckListCheckStateListener(viewer));
+		if (rootItem.isChecked()) {
+			viewer.expandAll();
+			updateViewState(rootItem);
+			viewer.collapseAll();
+		}
+		if (expandLevel >= 0) {
+			viewer.expandToLevel(rootItem, expandLevel);
+		}
+	}
+
+	/**
+	 * Updates the view to match the given entry
+	 * 
+	 * @param entry
+	 *            the entry to be checked
+	 */
+	private void updateViewState(CheckListDialogEntry entry) {
+		if (entry.hasChildren()) {
+			boolean individualChecksNeeded = false;
+			for (CheckListDialogEntry child : entry) {
+				if (child.hasChildren() || !child.isChecked()) {
+					individualChecksNeeded = true;
+					break;
+				}
+			}
+			if (individualChecksNeeded) {
+				boolean checked = false;
+				boolean unchecked = false;
+				for (CheckListDialogEntry child : entry) {
+					updateViewState(child);
+					if (child.isPartiallyChecked()) {
+						unchecked = true;
+						checked = true;
+					} else if (child.isChecked()) {
+						checked = true;
+					} else {
+						unchecked = true;
+					}
+				}
+				if (checked && unchecked) {
+					viewer.setGrayChecked(entry, true);
+					entry.setPartiallyChecked(true);
+					entry.setChecked(true);
+				} else if (checked) {
+					viewer.setChecked(entry, true);
+					entry.setChecked(true);
+				} else {
+					// Viewer is already unchecked
+					entry.setChecked(false);
+				}
+			} else {
+				// If all children are checked, this is a lot faster
+				viewer.setSubtreeChecked(entry, true);
+				entry.setChecked(true);
+			}
+		} else {
+			if (entry.isChecked()) {
+				viewer.setChecked(entry, true);
+			}
+		}
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/CheckListSelectionDialogLabelProvider.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CheckListEntry
+*
+*/
+package com.nokia.tracebuilder.view;
+
+import org.eclipse.jface.viewers.LabelProvider;
+
+import com.nokia.tracebuilder.engine.CheckListDialogEntry;
+import com.nokia.tracebuilder.model.TraceObject;
+
+/**
+ * Label provider for CheckListEntry
+ * 
+ */
+final class CheckListSelectionDialogLabelProvider extends LabelProvider {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
+	 */
+	@Override
+	public String getText(Object element) {
+		String retval;
+		if (element instanceof CheckListDialogEntry) {
+			Object o = ((CheckListDialogEntry) element).getObject();
+			if (o instanceof TraceObject) {
+				retval = ((TraceObject) o).getName();
+			} else {
+				retval = o.toString();
+			}
+		} else {
+			retval = ""; //$NON-NLS-1$
+		}
+		return retval;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/ConstantTableEntryWrapper.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Wrapper for a constant table
+*
+*/
+package com.nokia.tracebuilder.view;
+
+import com.nokia.tracebuilder.model.TraceConstantTableEntry;
+
+/**
+ * Wrapper for a constant table entry
+ * 
+ */
+final class ConstantTableEntryWrapper extends TraceObjectWrapper {
+
+	/**
+	 * Default constructor
+	 * 
+	 * @param entry
+	 *            the table entry
+	 * @param parent
+	 *            parent wrapper
+	 * @param updater
+	 *            the update notifier
+	 */
+	ConstantTableEntryWrapper(TraceConstantTableEntry entry,
+			WrapperBase parent, WrapperUpdater updater) {
+		super(entry, parent, updater);
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/ConstantTableListWrapper.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,74 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Wrapper for list of constant tables
+*
+*/
+package com.nokia.tracebuilder.view;
+
+import java.util.Iterator;
+
+import com.nokia.tracebuilder.model.TraceConstantTable;
+import com.nokia.tracebuilder.model.TraceModel;
+
+/**
+ * Wrapper for list of constant tables
+ * 
+ */
+final class ConstantTableListWrapper extends TraceObjectListWrapper {
+
+	/**
+	 * Creates a new wrapper
+	 * 
+	 * @param model
+	 *            trace model
+	 * @param parent
+	 *            parent wrapper
+	 * @param updater
+	 *            the update notifier
+	 */
+	ConstantTableListWrapper(TraceModel model, WrapperBase parent,
+			WrapperUpdater updater) {
+		super(parent, updater);
+		Iterator<TraceConstantTable> itr = model.getConstantTables();
+		while (itr.hasNext()) {
+			addConstantTable(itr.next());
+		}
+	}
+
+	/**
+	 * Adds a new constant table
+	 * 
+	 * @param table
+	 *            the table to be added
+	 * @return the wrapper which needs to be refreshed
+	 */
+	WrapperBase addConstantTable(TraceConstantTable table) {
+		add(new ConstantTableWrapper(table, this, getUpdater()));
+		return this;
+	}
+
+	/**
+	 * Removes a constant table
+	 * 
+	 * @param table
+	 *            the constant table to be removed
+	 * @return the wrapper which needs to be refreshed
+	 */
+	WrapperBase removeConstantTable(TraceConstantTable table) {
+		remove(table.getExtension(ConstantTableWrapper.class));
+		return this;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/ConstantTableWrapper.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,74 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Wrapper for a constant table
+*
+*/
+package com.nokia.tracebuilder.view;
+
+import java.util.Iterator;
+
+import com.nokia.tracebuilder.model.TraceConstantTable;
+import com.nokia.tracebuilder.model.TraceConstantTableEntry;
+
+/**
+ * Wrapper for a constant table
+ * 
+ */
+final class ConstantTableWrapper extends TraceObjectWrapper {
+
+	/**
+	 * Wrapper constructor
+	 * 
+	 * @param table
+	 *            constant table
+	 * @param parent
+	 *            parent wrapper
+	 * @param updater
+	 *            the update notifier
+	 */
+	ConstantTableWrapper(TraceConstantTable table, WrapperBase parent,
+			WrapperUpdater updater) {
+		super(table, parent, updater);
+		Iterator<TraceConstantTableEntry> itr = table.getEntries();
+		while (itr.hasNext()) {
+			add(new ConstantTableEntryWrapper(itr.next(), this, updater));
+		}
+	}
+
+	/**
+	 * Adds a entry to this table
+	 * 
+	 * @param entry
+	 *            the entry to be added
+	 * @return the wrapper which needs to be refreshed
+	 */
+	WrapperBase addConstantTableEntry(TraceConstantTableEntry entry) {
+		add(new ConstantTableEntryWrapper(entry, this, getUpdater()));
+		return this;
+	}
+
+	/**
+	 * Removes a table entry
+	 * 
+	 * @param entry
+	 *            the entry to be removed
+	 * @return the wrapper which needs to be refreshed
+	 */
+	WrapperBase removeConstantTableEntry(TraceConstantTableEntry entry) {
+		remove(entry.getExtension(ConstantTableEntryWrapper.class));
+		return this;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/LastKnownLocationListWrapper.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,161 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Wrapper class for last known location list
+*
+*/
+package com.nokia.tracebuilder.view;
+
+import java.util.Iterator;
+
+import com.nokia.tracebuilder.engine.LocationProperties;
+import com.nokia.tracebuilder.engine.LastKnownLocation;
+import com.nokia.tracebuilder.engine.LastKnownLocationList;
+import com.nokia.tracebuilder.engine.LastKnownLocationListListener;
+
+/**
+ * Wrapper class for last known location list
+ * 
+ */
+final class LastKnownLocationListWrapper extends ListWrapper implements
+		LastKnownLocationListListener {
+
+	/**
+	 * Location list
+	 */
+	private LastKnownLocationList locationList;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param list
+	 *            the location list
+	 * @param parent
+	 *            the parent wrapper
+	 * @param updater
+	 *            the update notifier
+	 */
+	LastKnownLocationListWrapper(LastKnownLocationList list,
+			WrapperBase parent, WrapperUpdater updater) {
+		super(parent, updater);
+		this.locationList = list;
+		createChildren();
+		locationList.addLocationListListener(this);
+	}
+
+	/**
+	 * Creates the location wrappers
+	 */
+	private void createChildren() {
+		for (LocationProperties loc : locationList) {
+			LastKnownLocationWrapper wrapper = new LastKnownLocationWrapper(
+					(LastKnownLocation) loc, this, getUpdater());
+			add(wrapper);
+		}
+	}
+
+	/**
+	 * Gets the location list
+	 * 
+	 * @return the location list
+	 */
+	LastKnownLocationList getLocationList() {
+		return locationList;
+	}
+
+	/**
+	 * Updates the location list
+	 * 
+	 * @param list
+	 *            the new location list
+	 */
+	void updateLocationList(LastKnownLocationList list) {
+		locationList.removeLocationListListener(this);
+		clear();
+		locationList = list;
+		if (locationList != null) {
+			locationList.addLocationListListener(this);
+			createChildren();
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.view.ListWrapper#delete()
+	 */
+	@Override
+	void delete() {
+		super.delete();
+		locationList.removeLocationListListener(this);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.LastKnownLocationListListener#
+	 *      locationAdded(com.nokia.tracebuilder.engine.LastKnownLocation)
+	 */
+	public void locationAdded(LastKnownLocation location) {
+		LastKnownLocationWrapper wrapper = new LastKnownLocationWrapper(
+				location, this, getUpdater());
+		boolean inView = false;
+		boolean hidden = false;
+		if (!hasChildren()) {
+			hidden = true;
+		}
+		// If one of the existing locations is shown in view, or there are no
+		// existing locations the new one is also marked as shown in view
+		if (isInView()) {
+			if (hasChildren()) {
+				Iterator<WrapperBase> itr = getVisibleWrappers();
+				if (itr.next().isInView()) {
+					inView = true;
+				}
+			} else {
+				inView = true;
+			}
+		}
+		add(wrapper);
+		wrapper.setInView(inView);
+		if (hidden) {
+			TraceWrapper parent = (TraceWrapper) getParent();
+			parent.showLastKnownLocationList();
+			getUpdater().queueUpdate(parent);
+		} else {
+			getUpdater().queueUpdate(this);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.LastKnownLocationListListener#
+	 *      locationRemoved(com.nokia.tracebuilder.engine.LastKnownLocation)
+	 */
+	public void locationRemoved(LastKnownLocation location) {
+		LastKnownLocationWrapper wrapper = (LastKnownLocationWrapper) location
+				.getViewReference();
+		remove(wrapper);
+		if (!hasChildren()) {
+			TraceWrapper parent = (TraceWrapper) getParent();
+			parent.hideLastKnownLocationList();
+			getUpdater().queueUpdate(parent);
+		} else {
+			getUpdater().queueUpdate(this);
+		}
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/LastKnownLocationWrapper.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Wrapper for a last known location
+*
+*/
+package com.nokia.tracebuilder.view;
+
+import com.nokia.tracebuilder.engine.LastKnownLocation;
+
+/**
+ * Wrapper for a last known location
+ * 
+ */
+final class LastKnownLocationWrapper extends WrapperBase {
+
+	/**
+	 * The location
+	 */
+	private LastKnownLocation location;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param location
+	 *            the trace location
+	 * @param parent
+	 *            the parent wrapper
+	 * @param updater
+	 *            the update notifier
+	 */
+	LastKnownLocationWrapper(LastKnownLocation location, WrapperBase parent,
+			WrapperUpdater updater) {
+		super(parent, updater);
+		this.location = location;
+		location.setViewReference(this);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.view.WrapperBase#getChildren()
+	 */
+	@Override
+	Object[] getChildren() {
+		return new Object[0];
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.view.WrapperBase#hasChildren()
+	 */
+	@Override
+	boolean hasChildren() {
+		return false;
+	}
+
+	/**
+	 * Gets the location
+	 * 
+	 * @return location
+	 */
+	LastKnownLocation getLocation() {
+		return location;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/ListNavigator.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,142 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* List navigator, which is used when a list contains more elements than should be shown at a time
+*
+*/
+package com.nokia.tracebuilder.view;
+
+import com.nokia.tracebuilder.action.TraceViewActionProvider;
+
+/**
+ * List navigator, which is used when a list contains more elements than should
+ * be shown at a time
+ * 
+ */
+final class ListNavigator extends WrapperBase {
+
+	/**
+	 * Action provider
+	 */
+	private ListNavigatorActionProvider actionProvider;
+
+	/**
+	 * Index of the first element currently visible
+	 */
+	private int startIndex;
+
+	/**
+	 * Number of visible elements
+	 */
+	private int visibleCount;
+
+	/**
+	 * Total number of elements
+	 */
+	private int totalCount;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parent
+	 *            the parent wrapper
+	 * @param updater
+	 *            the update notifier
+	 */
+	protected ListNavigator(ListWrapper parent, WrapperUpdater updater) {
+		super(parent, updater);
+		actionProvider = new ListNavigatorActionProvider(parent);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.view.WrapperBase#getChildren()
+	 */
+	@Override
+	public Object[] getChildren() {
+		return new Object[0];
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.view.WrapperBase#hasChildren()
+	 */
+	@Override
+	public boolean hasChildren() {
+		return false;
+	}
+
+	/**
+	 * Gets the start index of visible elements
+	 * 
+	 * @return the start index
+	 */
+	int getStartIndex() {
+		return startIndex;
+	}
+
+	/**
+	 * Gets the number of visible elements
+	 * 
+	 * @return the visible element count
+	 */
+	int getVisibleCount() {
+		return visibleCount;
+	}
+
+	/**
+	 * Gets the total length of elements
+	 * 
+	 * @return the total count
+	 */
+	int getTotalCount() {
+		return totalCount;
+	}
+
+	/**
+	 * Gets the action provider interface
+	 * 
+	 * @return the action provider
+	 */
+	public TraceViewActionProvider getActionProvider() {
+		return actionProvider;
+	}
+
+	/**
+	 * Sets the index to currently visible area
+	 * 
+	 * @param startIndex
+	 * @param visibleCount
+	 * @param totalCount
+	 */
+	void setIndex(int startIndex, int visibleCount, int totalCount) {
+		this.startIndex = startIndex;
+		this.visibleCount = visibleCount;
+		this.totalCount = totalCount;
+		if (startIndex + visibleCount >= totalCount) {
+			actionProvider.setNextEnabled(false);
+			actionProvider.setPreviousEnabled(true);
+		} else if (startIndex == 0) {
+			actionProvider.setNextEnabled(true);
+			actionProvider.setPreviousEnabled(false);
+		} else {
+			actionProvider.setNextEnabled(true);
+			actionProvider.setPreviousEnabled(true);
+		}
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/ListNavigatorActionProvider.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,217 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Navigator action provider
+*
+*/
+package com.nokia.tracebuilder.view;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.tracebuilder.action.TraceViewActionProvider;
+import com.nokia.tracebuilder.model.TraceModelExtensionUpdateListener;
+import com.nokia.tracebuilder.model.TraceObject;
+
+/**
+ * Navigator action provider
+ * 
+ */
+final class ListNavigatorActionProvider implements TraceViewActionProvider {
+
+	/**
+	 * Action list
+	 */
+	private ArrayList<IAction> actions = new ArrayList<IAction>();
+
+	/**
+	 * The list to be navigated
+	 */
+	private ListWrapper listWrapper;
+
+	/**
+	 * Next action
+	 */
+	private Action nextAction;
+
+	/**
+	 * Previous action
+	 */
+	private Action previousAction;
+
+	/**
+	 * View reference
+	 */
+	private Object viewReference;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param list
+	 *            the list wrapper to be navigated
+	 */
+	ListNavigatorActionProvider(ListWrapper list) {
+		this.listWrapper = list;
+		nextAction = new Action(Messages
+				.getString("ListNavigatorActionProvider.Next")) { //$NON-NLS-1$
+			@Override
+			public void run() {
+				listWrapper.showNext();
+			}
+		};
+		previousAction = new Action(Messages
+				.getString("ListNavigatorActionProvider.Previous")) { //$NON-NLS-1$
+			@Override
+			public void run() {
+				listWrapper.showPrevious();
+			}
+		};
+		actions.add(previousAction);
+		actions.add(nextAction);
+		nextAction.setImageDescriptor(PlatformUI.getWorkbench()
+				.getSharedImages().getImageDescriptor(
+						ISharedImages.IMG_TOOL_FORWARD));
+		previousAction.setImageDescriptor(PlatformUI.getWorkbench()
+				.getSharedImages().getImageDescriptor(
+						ISharedImages.IMG_TOOL_BACK));
+		nextAction.setDisabledImageDescriptor(PlatformUI.getWorkbench()
+				.getSharedImages().getImageDescriptor(
+						ISharedImages.IMG_TOOL_FORWARD_DISABLED));
+		previousAction.setDisabledImageDescriptor(PlatformUI.getWorkbench()
+				.getSharedImages().getImageDescriptor(
+						ISharedImages.IMG_TOOL_BACK_DISABLED));
+		// The list is initially at the end
+		nextAction.setEnabled(false);
+	}
+
+	/**
+	 * Enables / disables the previous action
+	 * 
+	 * @param flag
+	 *            the flag value
+	 */
+	void setPreviousEnabled(boolean flag) {
+		previousAction.setEnabled(flag);
+	}
+
+	/**
+	 * Enables / disables the next action
+	 * 
+	 * @param flag
+	 *            the flag value
+	 */
+	void setNextEnabled(boolean flag) {
+		nextAction.setEnabled(flag);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceViewActionProvider#getActions()
+	 */
+	public Iterator<IAction> getActions() {
+		return actions.iterator();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceViewExtension#hideWhenEmpty()
+	 */
+	public boolean hideWhenEmpty() {
+		return false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelExtension#
+	 *      setOwner(com.nokia.tracebuilder.model.TraceObject)
+	 */
+	public void setOwner(TraceObject owner) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelExtension#getOwner()
+	 */
+	public TraceObject getOwner() {
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceViewExtension#getChildren()
+	 */
+	public Iterator<?> getChildren() {
+		List<Object> list = Collections.emptyList();
+		return list.iterator();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceViewExtension#hasChildren()
+	 */
+	public boolean hasChildren() {
+		return false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelUpdatableExtension#
+	 *      addUpdateListener(com.nokia.tracebuilder.model.TraceModelExtensionUpdateListener)
+	 */
+	public void addUpdateListener(TraceModelExtensionUpdateListener listener) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelUpdatableExtension#
+	 *      removeUpdateListener(com.nokia.tracebuilder.model.TraceModelExtensionUpdateListener)
+	 */
+	public void removeUpdateListener(TraceModelExtensionUpdateListener listener) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceViewExtension#getViewReference()
+	 */
+	public Object getViewReference() {
+		return viewReference;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceViewExtension#setViewReference(java.lang.Object)
+	 */
+	public void setViewReference(Object reference) {
+		this.viewReference = reference;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/ListWrapper.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,417 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 wrappers containing a list of other wrappers
+*
+*/
+package com.nokia.tracebuilder.view;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import com.nokia.tracebuilder.engine.TraceBuilderConfiguration;
+
+/**
+ * Base class for wrappers containing a list of other wrappers
+ * 
+ */
+abstract class ListWrapper extends WrapperBase implements Iterable<WrapperBase> {
+
+	/**
+	 * Number of visible elements in the tree viewer
+	 */
+	private final static int TREE_VIEW_VISIBLE_ELEMENTS = 100; // CodForChk_Dis_Magic
+
+	/**
+	 * The full list of wrappers.
+	 */
+	private ArrayList<WrapperBase> fullList = new ArrayList<WrapperBase>();
+
+	/**
+	 * Sublist which is shown in view
+	 */
+	private ArrayList<WrapperBase> subList = new ArrayList<WrapperBase>();
+
+	/**
+	 * Sub-list start index
+	 */
+	private int subListStartIndex = 0;
+
+	/**
+	 * Navigator if there are more children that can be shown in view at a time
+	 */
+	private ListNavigator navigator;
+
+	/**
+	 * Constructor takes the parent as parameter.
+	 * 
+	 * @param parent
+	 *            the parent wrapper
+	 * @param updater
+	 *            the update notifier
+	 */
+	ListWrapper(WrapperBase parent, WrapperUpdater updater) {
+		super(parent, updater);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.view.WrapperBase#getChildren()
+	 */
+	@Override
+	Object[] getChildren() {
+		return subList.toArray();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Iterable#iterator()
+	 */
+	public Iterator<WrapperBase> iterator() {
+		return fullList.iterator();
+	}
+
+	/**
+	 * Gets the wrappers that are currently visible
+	 * 
+	 * @return the wrappers
+	 */
+	Iterator<WrapperBase> getVisibleWrappers() {
+		return subList.iterator();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.view.WrapperBase#hasChildren()
+	 */
+	@Override
+	boolean hasChildren() {
+		return !fullList.isEmpty();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.view.WrapperBase#delete()
+	 */
+	@Override
+	void delete() {
+		for (WrapperBase wrapper : fullList) {
+			wrapper.delete();
+		}
+		fullList.clear();
+		subList.clear();
+	}
+
+	/**
+	 * Adds a child to this model
+	 * 
+	 * @param child
+	 */
+	void add(WrapperBase child) {
+		fullList.add(child);
+		if (getSubListSize() < TREE_VIEW_VISIBLE_ELEMENTS) {
+			subList.add(child);
+		} else {
+			showSubList(fullList.size() - TREE_VIEW_VISIBLE_ELEMENTS);
+		}
+	}
+
+	/**
+	 * Removes the child from the list but does not call delete
+	 * 
+	 * @param child
+	 *            the child to be removed
+	 */
+	void hide(WrapperBase child) {
+		fullList.remove(child);
+		subList.remove(child);
+	}
+
+	/**
+	 * Checks if the wrapper is in this list
+	 * 
+	 * @param wrapper
+	 *            the wrapper
+	 * @return true if the wrapper exists, false otherwise
+	 */
+	boolean contains(WrapperBase wrapper) {
+		return fullList.contains(wrapper);
+	}
+
+	/**
+	 * Resets and removes the child
+	 * 
+	 * @param child
+	 *            the child to be removed
+	 */
+	void remove(WrapperBase child) {
+		child.delete();
+		int index = fullList.indexOf(child);
+		if (index >= 0) {
+			fullList.remove(index);
+			// If the item was removed prior to sublist, the sublist index is
+			// changed. If item is in sublist, it is removed from it and a
+			// replacement is added to the sub-list
+			if (index < subListStartIndex) {
+				subListStartIndex--;
+			} else if (index < subListStartIndex + getSubListSize()) {
+				removeFromSubList(child);
+			}
+		}
+	}
+
+	/**
+	 * Removes the element from the visible list and replaces it with a new one
+	 * 
+	 * @param child
+	 *            the child element to be removed
+	 */
+	private void removeFromSubList(WrapperBase child) {
+		subList.remove(child);
+		if (fullList.size() > getSubListSize()) {
+			int end = subListStartIndex + getSubListSize();
+			// If the sub-list is at the end, previous element is added to it
+			// Otherwise the next element is added prior to the navigator
+			if (end == fullList.size()) {
+				subList.add(0, fullList.get(subListStartIndex - 1));
+				subListStartIndex--;
+			} else {
+				subList.add(getSubListSize() - 1, fullList.get(end));
+			}
+		} else if (!subList.isEmpty()) {
+			// If the sub-list covers the entire list, the navigator is removed
+			// if it exists
+			if (subList.get(subList.size() - 1) == navigator) {
+				subList.remove(subList.size() - 1);
+			}
+		}
+	}
+
+	/**
+	 * Removes and calls delete on all children
+	 */
+	void clear() {
+		for (WrapperBase wrapper : fullList) {
+			wrapper.delete();
+		}
+		fullList.clear();
+		subList.clear();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.view.WrapperBase#setInView(boolean)
+	 */
+	@Override
+	void setInView(boolean flag) {
+		super.setInView(flag);
+		// When an element is hidden, all its children are also hidden
+		// When element is shown, its children are not necessarily shown
+		if (!flag) {
+			setChildrenInView(false);
+		} else {
+			restoreChildrenIntoView();
+		}
+	}
+
+	/**
+	 * Sets the shown in view flag for child elements that are currently shown
+	 * in view
+	 * 
+	 * @param isInView
+	 *            the shown in view flag
+	 */
+	void setChildrenInView(boolean isInView) {
+		for (WrapperBase wrapper : subList) {
+			wrapper.setInView(isInView);
+		}
+	}
+
+	/**
+	 * Sets the shown in view flag for child elements that have the
+	 * restoreIntoView flag
+	 */
+	void restoreChildrenIntoView() {
+		if (isRestoredIntoView()) {
+			super.setInView(true);
+			super.setRestoreIntoView(false);
+		}
+		for (WrapperBase wrapper : subList) {
+			if (wrapper instanceof ListWrapper) {
+				((ListWrapper) wrapper).restoreChildrenIntoView();
+			} else {
+				if (wrapper.isRestoredIntoView()) {
+					wrapper.setRestoreIntoView(false);
+					wrapper.setInView(true);
+				}
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.view.WrapperBase#setRestoreIntoView(boolean)
+	 */
+	@Override
+	void setRestoreIntoView(boolean flag) {
+		super.setRestoreIntoView(flag);
+		for (WrapperBase wrapper : subList) {
+			wrapper.setRestoreIntoView(flag);
+		}
+	}
+
+	/**
+	 * Updates the sub-list in view
+	 * 
+	 * @param start
+	 *            the start of sub-list
+	 */
+	private void showSubList(int start) {
+		subList.clear();
+		if (start < 0) {
+			start = 0;
+		} else if (start > fullList.size() - TREE_VIEW_VISIBLE_ELEMENTS) {
+			start = fullList.size() - TREE_VIEW_VISIBLE_ELEMENTS;
+		}
+		subListStartIndex = start;
+		int end = subListStartIndex + TREE_VIEW_VISIBLE_ELEMENTS;
+		for (int i = 0; i < fullList.size(); i++) {
+			if (i >= start && i < end) {
+				subList.add(fullList.get(i));
+			} else {
+				fullList.get(i).setInView(false);
+			}
+		}
+		if (navigator == null) {
+			createNavigator();
+		}
+		navigator
+				.setIndex(subListStartIndex, getSubListSize(), fullList.size());
+		subList.add(navigator);
+	}
+
+	/**
+	 * Creates the navigator
+	 */
+	private void createNavigator() {
+		navigator = new ListNavigator(this, getUpdater());
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.view.WrapperBase# dumpToSystemOut(int,
+	 *      com.nokia.tracebuilder.view.TraceLabelProvider)
+	 */
+	@Override
+	void dumpToSystemOut(int indentLevel, TraceLabelProvider provider) {
+		if (TraceBuilderConfiguration.TRACE_VIEW_STATE) {
+			super.dumpToSystemOut(indentLevel, provider);
+			indentLevel++;
+			// This uses the full list -> Verifies that items do not contain
+			// visible flag unless they actually are in the sub-list and visible
+			for (WrapperBase wrapper : fullList) {
+				if (wrapper.isInView()) {
+					wrapper.dumpToSystemOut(indentLevel, provider);
+				}
+			}
+		}
+	}
+
+	/**
+	 * Shows the next elements in the list
+	 */
+	void showNext() {
+		int start = subListStartIndex + TREE_VIEW_VISIBLE_ELEMENTS;
+		showSubList(start);
+		// showSubList does not change the in-view flag to true, since it is
+		// used also with hidden lists
+		int size = getSubListSize();
+		for (int i = 0; i < size; i++) {
+			subList.get(i).setInView(true);
+		}
+		getUpdater().update(this);
+	}
+
+	/**
+	 * Shows the previous elements in the list
+	 */
+	void showPrevious() {
+		int start = subListStartIndex - TREE_VIEW_VISIBLE_ELEMENTS;
+		showSubList(start);
+		// showSubList does not change the in-view flag to true, since it is
+		// used also with hidden lists
+		int size = getSubListSize();
+		for (int i = 0; i < size; i++) {
+			subList.get(i).setInView(true);
+		}
+		getUpdater().update(this);
+	}
+
+	/**
+	 * Gets the size of the sub-list
+	 * 
+	 * @return the size
+	 */
+	private int getSubListSize() {
+		int size = subList.size();
+		if (size > 0) {
+			if (subList.get(size - 1) == navigator) {
+				size--;
+			}
+		}
+		return size;
+	}
+
+	/**
+	 * Moves a child wrapper to the sub-list that is shown in view. Note that
+	 * this does not expand the tree to actually show the child
+	 * 
+	 * @param child
+	 *            the child to be revealed
+	 * @return the wrapper that needs to be updated
+	 */
+	WrapperBase moveChildToView(WrapperBase child) {
+		WrapperBase retval = null;
+		if (!child.isInView()) {
+			int index = fullList.indexOf(child);
+			if (index < subListStartIndex
+					|| index >= subListStartIndex + getSubListSize()) {
+				showSubList(index);
+				// If the list changes, this wrapper needs to be updated
+				retval = this;
+			}
+		}
+		WrapperBase parent = getParent();
+		if (parent instanceof ListWrapper) {
+			// Delegates the call also to parent lists in case this list is not
+			// currently in the view. If a parent list changes, the return value
+			// is changed so it gets updated instead of this list
+			WrapperBase updatedParent = ((ListWrapper) parent)
+					.moveChildToView(this);
+			if (updatedParent != null) {
+				retval = updatedParent;
+			}
+		}
+		return retval;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/MessageDialogRunnable.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Async runnable which shows an message dialog to user
+*
+*/
+package com.nokia.tracebuilder.view;
+
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * Async runnable which shows an message dialog to user
+ * 
+ */
+class MessageDialogRunnable implements Runnable {
+
+	/**
+	 * Dialog message
+	 */
+	private String message;
+
+	/**
+	 * Dialog shell
+	 */
+	private Shell shell;
+
+	/**
+	 * Creates a new message dialog runnable
+	 * 
+	 * @param shell
+	 *            the dialog shell
+	 * @param message
+	 *            the message to be shown
+	 */
+	MessageDialogRunnable(Shell shell, String message) {
+		this.shell = shell;
+		this.message = message;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Runnable#run()
+	 */
+	public void run() {
+		if (!shell.isDisposed()) {
+			MessageDialog.openError(shell, Messages
+					.getString("TraceView.TraceBuilder"), //$NON-NLS-1$
+					message);
+		}
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/Messages.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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.tracebuilder.view;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * Localized strings for view package
+ * 
+ */
+class Messages {
+
+	/**
+	 * Bundle name
+	 */
+	private static final String BUNDLE_NAME = "com.nokia.tracebuilder.view.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/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/ObjectWrapper.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,87 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Wrapper for a single object in trace view
+*
+*/
+package com.nokia.tracebuilder.view;
+
+/**
+ * Wrapper for a single object in trace view
+ * 
+ */
+class ObjectWrapper extends WrapperBase {
+
+	/**
+	 * The object object
+	 */
+	private Object object;
+
+	/**
+	 * Creates a wrapper
+	 * 
+	 * @param object
+	 *            the object
+	 * @param parent
+	 *            the parent wrapper
+	 * @param updater
+	 *            the update notifier
+	 */
+	public ObjectWrapper(Object object, WrapperBase parent,
+			WrapperUpdater updater) {
+		super(parent, updater);
+		this.object = object;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.view.WrapperBase#getChildren()
+	 */
+	@Override
+	public Object[] getChildren() {
+		return new Object[0];
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.view.WrapperBase#hasChildren()
+	 */
+	@Override
+	public boolean hasChildren() {
+		return false;
+	}
+
+	/**
+	 * Gets the wrapped object.
+	 * 
+	 * @return the object
+	 */
+	public Object getObject() {
+		return object;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.view.WrapperBase#delete()
+	 */
+	@Override
+	public void delete() {
+		super.delete();
+		object = null;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/PropertyDialog.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,520 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 dialog for TraceObject
+*
+*/
+package com.nokia.tracebuilder.view;
+
+import java.util.List;
+
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.RowLayout;
+import org.eclipse.swt.widgets.Button;
+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.tracebuilder.engine.TraceBuilderConfiguration;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorMessages;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialog;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialogDynamicFlag;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialogFlag;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate;
+import com.nokia.tracebuilder.engine.TraceParameterPropertyDialogDynamicFlag;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.TraceBuilderErrorCode;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+
+/**
+ * Property dialog for TraceObject
+ * 
+ */
+class PropertyDialog extends TitleAreaDialog {
+
+	/**
+	 * Callback for dialog UI
+	 * 
+	 */
+	private final class UIChangeCallback implements
+			PropertyDialogUIChangeCallback {
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see com.nokia.tracebuilder.view.PropertyDialogUIChangeCallback#
+		 *      templateChanged(com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate)
+		 */
+		public void templateChanged(TraceObjectPropertyDialogTemplate template) {
+			PropertyDialog.this.templateChanged(template, false);
+			verifyContents(true);
+		}
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see com.nokia.tracebuilder.view.PropertyDialogUIChangeCallback#fieldChanged()
+		 */
+		public void fieldChanged() {
+			verifyContents(true);
+		}
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see com.nokia.tracebuilder.view.PropertyDialogUIChangeCallback#targetChanged(java.lang.String)
+		 */
+		public void targetChanged(String target) {
+			properties.setTarget(target);
+			updateTitle();
+			verifyContents(true);
+		}
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see com.nokia.tracebuilder.view.PropertyDialogUIChangeCallback#typeChanged(java.lang.String)
+		 */
+		public void typeChanged(String type) {
+			properties.setValue(type);
+			verifyContents(true);
+			PropertyDialog.this.typeChanged(type);
+		}
+	}
+
+	/**
+	 * Selection listener for flag buttons
+	 * 
+	 */
+	private final class FlagButtonSelectionListener implements
+			SelectionListener {
+
+		/**
+		 * The flag to be monitored
+		 */
+		private TraceObjectPropertyDialogFlag flag;
+
+		/**
+		 * Constructor
+		 * 
+		 * @param flag
+		 *            the flag to be monitored
+		 */
+		FlagButtonSelectionListener(TraceObjectPropertyDialogFlag flag) {
+			this.flag = flag;
+		}
+
+		/*
+		 * (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) {
+			flag.setEnabled(((Button) e.widget).getSelection());
+			flagChanged(flag);
+		}
+	}
+
+	/**
+	 * Dialog margin
+	 */
+	private static final int MARGIN_WIDTH = 5; // CodForChk_Dis_Magic
+
+	/**
+	 * Dialog UI
+	 */
+	private PropertyDialogUI ui;
+
+	/**
+	 * Dialog properties
+	 */
+	private PropertyDialogProperties properties;
+
+	/**
+	 * Buttons for flags
+	 */
+	private Button[] flagButtons;
+
+	/**
+	 * Dialog constructor
+	 * 
+	 * @param shell
+	 *            the shell where the dialog is associated to
+	 * @param properties
+	 *            the dialog properties
+	 */
+	PropertyDialog(Shell shell, PropertyDialogProperties properties) {
+		super(shell);
+		this.properties = properties;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.dialogs.TitleAreaDialog#
+	 *      createContents(org.eclipse.swt.widgets.Composite)
+	 */
+	@Override
+	protected Control createContents(Composite parent) {
+		Control control = super.createContents(parent);
+		// Registers the help context to the root control
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(
+				control,
+				TraceViewHelp.getPropertyDialogContext(properties
+						.getDialogType()));
+		parent.pack();
+		Point size = parent.getSize();
+		Point location = getInitialLocation(size);
+		parent.setBounds(getConstrainedShellBounds(new Rectangle(location.x,
+				location.y, size.x, size.y)));
+		return control;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+	 */
+	@Override
+	protected Control createDialogArea(Composite parent) {
+		Composite composite = (Composite) super.createDialogArea(parent);
+		ui = new PropertyDialogUI(composite, properties.getDialogType(),
+				properties.getTemplates());
+		createFlagButtons(composite);
+		loadProperties();
+		updateTitle();
+		TraceObjectPropertyDialogTemplate template = properties.getTemplate();
+		ui.setTemplate(template);
+		ui.setChangeCallback(new UIChangeCallback());
+		// The dynamic flags are notified and thus each can initialize itself to
+		// correct state
+		templateChanged(template, true);
+		List<TraceObjectPropertyDialogFlag> flags = properties.getFlags();
+		if (flags != null) {
+			for (int i = 0; i < flags.size(); i++) {
+				flagChanged(flags.get(i));
+			}
+		}
+		// After all initialization has been done, the enabler is used to
+		// disabler UI elements that should not be modified
+		ui.setEnabler(properties.getEnabler());
+		return composite;
+	}
+
+	/**
+	 * Creates the check-boxes for flags
+	 * 
+	 * @param composite
+	 *            the owner for the check-boxes
+	 */
+	private void createFlagButtons(Composite composite) {
+		List<TraceObjectPropertyDialogFlag> flags = properties.getFlags();
+		if (flags != null && flags.size() > 0) {
+			Composite flagContainer = new Composite(composite, SWT.NONE);
+			RowLayout layout = new RowLayout(SWT.VERTICAL);
+			layout.marginWidth = MARGIN_WIDTH;
+			flagContainer.setLayout(layout);
+			flagButtons = new Button[flags.size()];
+			for (int i = 0; i < flags.size(); i++) {
+				createFlagButton(flags, flagContainer, i);
+			}
+		}
+	}
+
+	/**
+	 * Creates a flag button
+	 * 
+	 * @param flags
+	 *            the flags list
+	 * @param flagContainer
+	 *            the container
+	 * @param i
+	 *            the list index
+	 */
+	private void createFlagButton(List<TraceObjectPropertyDialogFlag> flags,
+			Composite flagContainer, int i) {
+		TraceObjectPropertyDialogFlag flag = flags.get(i);
+		if (flag.isVisible()) {
+			flagButtons[i] = new Button(flagContainer, SWT.CHECK);
+			flagButtons[i].setText(flag.getText());
+			flagButtons[i]
+					.addSelectionListener(new FlagButtonSelectionListener(flag));
+			flagButtons[i].setSelection(flag.isEnabled());
+		}
+	}
+
+	/**
+	 * Template change notification
+	 * 
+	 * @param template
+	 *            the new template
+	 * @param forceUiUpdate
+	 *            forces UI update even if flag did not change
+	 */
+	void templateChanged(TraceObjectPropertyDialogTemplate template,
+			boolean forceUiUpdate) {
+		// When a template changes, the dynamic flags are updated
+		properties.setTemplate(template);
+		List<TraceObjectPropertyDialogFlag> flags = properties.getFlags();
+		if (flags != null) {
+			TraceObjectPropertyDialogDynamicFlag dynflag;
+			for (int i = 0; i < flags.size(); i++) {
+				TraceObjectPropertyDialogFlag flag = flags.get(i);
+				if (flag instanceof TraceObjectPropertyDialogDynamicFlag
+						&& flagButtons[i] != null) {
+					// Notifies all dynamic flags with the change in template
+					dynflag = (TraceObjectPropertyDialogDynamicFlag) flag;
+					if (dynflag.templateChanged(template) || forceUiUpdate) {
+						updateDynamicFlag(i, dynflag);
+					}
+				}
+			}
+		}
+		typeChanged(ui.getType());
+	}
+
+	/**
+	 * Parameter type change notification
+	 * 
+	 * @param type
+	 *            the new type
+	 */
+	void typeChanged(String type) {
+		List<TraceObjectPropertyDialogFlag> flags = properties.getFlags();
+		if (flags != null) {
+			TraceParameterPropertyDialogDynamicFlag dynflag;
+			for (int i = 0; i < flags.size(); i++) {
+				TraceObjectPropertyDialogFlag flag = flags.get(i);
+				if (flag instanceof TraceParameterPropertyDialogDynamicFlag
+						&& flagButtons[i] != null) {
+					// Notifies all dynamic parameter flags with the change
+					dynflag = (TraceParameterPropertyDialogDynamicFlag) flag;
+					if (dynflag.typeChanged(type)) {
+						updateDynamicFlag(i, dynflag);
+					}
+				}
+			}
+		}
+	}
+
+	/**
+	 * Updates the flag button of a dynamic flag
+	 * 
+	 * @param i
+	 *            the flag index
+	 * @param dynflag
+	 *            the flag
+	 */
+	private void updateDynamicFlag(int i,
+			TraceObjectPropertyDialogDynamicFlag dynflag) {
+		if (dynflag.isAvailable()) {
+			flagButtons[i].setSelection(dynflag.isEnabled());
+			flagButtons[i].setEnabled(true);
+		} else {
+			flagButtons[i].setSelection(dynflag.isAlwaysEnabled());
+			flagButtons[i].setEnabled(false);
+		}
+	}
+
+	/**
+	 * Flag change notification
+	 * 
+	 * @param flag
+	 *            the flag that was changed
+	 */
+	void flagChanged(TraceObjectPropertyDialogFlag flag) {
+		// When a flag changes, other flags are updated
+		List<TraceObjectPropertyDialogFlag> flags = properties.getFlags();
+		if (flags != null) {
+			TraceObjectPropertyDialogDynamicFlag dynflag;
+			for (int i = 0; i < flags.size(); i++) {
+				TraceObjectPropertyDialogFlag otherFlag = flags.get(i);
+				if (otherFlag instanceof TraceObjectPropertyDialogDynamicFlag
+						&& otherFlag != flag && flagButtons[i] != null) {
+					// Notifies all dynamic flags with the change in template
+					dynflag = (TraceObjectPropertyDialogDynamicFlag) otherFlag;
+					if (dynflag.flagChanged(flag)) {
+						updateDynamicFlag(i, dynflag);
+					}
+				}
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.dialogs.Dialog#createButtonBar(org.eclipse.swt.widgets.Composite)
+	 */
+	@Override
+	protected void createButtonsForButtonBar(Composite parent) {
+		super.createButtonsForButtonBar(parent);
+		verifyContents(false);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
+	 */
+	@Override
+	protected void buttonPressed(int buttonId) {
+		super.buttonPressed(buttonId);
+		ui = null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+	 */
+	@Override
+	protected void okPressed() {
+		boolean save = saveProperties();
+		if (TraceBuilderConfiguration.ASSERTIONS_ENABLED && !save) {
+			TraceBuilderGlobals.getEvents().postAssertionFailed(
+					"Save dialog properties failed -> Object might be invalid", //$NON-NLS-1$
+					null);
+		}
+		checkFlags();
+		super.okPressed();
+	}
+
+	/**
+	 * Loads the properties to UI
+	 */
+	private void loadProperties() {
+		ui.setNameField(properties.getName());
+		ui.setIDField(properties.getID());
+		int dialogType = properties.getDialogType();
+
+		// In case of select component, type and name fields are not used
+		if (dialogType != TraceObjectPropertyDialog.SELECT_COMPONENT) {
+			if (dialogType == TraceObjectPropertyDialog.ADD_PARAMETER) {
+				// In case of parameters value is mapped to the type selector
+				ui.setType(properties.getValue());
+			} else {
+				// Otherwise the value is mapped to the value field
+				ui.setValueField(properties.getValue());
+			}
+		}
+		ui.setTarget(properties.getTarget());
+	}
+
+	/**
+	 * Saves the properties from the UI to the properties object
+	 * 
+	 * @return true if saved, false if failed
+	 */
+	private boolean saveProperties() {
+		boolean retval;
+		try {
+			properties.setID(ui.getIDField());
+			properties.setName(ui.getNameField());
+			if (properties.getDialogType() == TraceObjectPropertyDialog.ADD_PARAMETER) {
+				properties.setValue(ui.getType());
+			} else {
+				properties.setValue(ui.getValueField());
+			}
+			properties.setTarget(ui.getTarget());
+			retval = true;
+		} catch (Exception e) {
+			setErrorMessage(Messages.getString("PropertyDialog.InvalidId")); //$NON-NLS-1$
+			retval = false;
+		}
+		return retval;
+	}
+
+	/**
+	 * Changes the state of flags depending on the check boxes
+	 */
+	private void checkFlags() {
+		// When user changes a template or updates a flag state, some flags may
+		// be disabled in the UI. However, the enabled state of the flag is not
+		// changed when that happens. This allows the checkbox to be set to
+		// correct selection if it is re-enabled.
+		// When OK button is pressed, the enabled state of flags needs to be
+		// synchronized with the button selection state
+		List<TraceObjectPropertyDialogFlag> flags = properties.getFlags();
+		if (flags != null) {
+			for (int i = 0; i < flags.size(); i++) {
+				if (flagButtons[i] != null) {
+					flags.get(i).setEnabled(flagButtons[i].getSelection());
+				}
+			}
+		}
+	}
+
+	/**
+	 * Uses the verification callback to verify dialog contents
+	 * 
+	 * @param setError
+	 *            true if error needs to be set to dialog, false if not
+	 */
+	private void verifyContents(boolean setError) {
+		Button okButton = getButton(IDialogConstants.OK_ID);
+		if (okButton != null) {
+			boolean enabled;
+			if (saveProperties()) {
+				try {
+					properties.verifyContents();
+					setErrorMessage(null);
+					enabled = true;
+				} catch (TraceBuilderException e) {
+					if (setError) {
+						setErrorMessage(TraceBuilderErrorMessages
+								.getErrorMessage((TraceBuilderErrorCode) e
+										.getErrorCode(), e.getErrorParameters()));
+					}
+					enabled = false;
+				}
+			} else {
+				enabled = false;
+			}
+			okButton.setEnabled(enabled);
+		}
+	}
+
+	/**
+	 * Updates the title of this dialog
+	 */
+	private void updateTitle() {
+		getShell().setText(
+				TraceViewMessages.getPropertyDialogCaption(properties
+						.getDialogType()));
+		setTitle(TraceViewMessages.getPropertyDialogTitle(properties
+				.getDialogType()));
+		setMessage(TraceViewMessages.getPropertyDialogMessage(properties
+				.getDialogType(), properties.getTarget()));
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/PropertyDialogComposite.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,114 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Composite, which wraps a text field / combo box and a button
+*
+*/
+package com.nokia.tracebuilder.view;
+
+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;
+
+/**
+ * Composite, which wraps a text field / combo box and a button
+ * 
+ */
+class PropertyDialogComposite {
+
+	/**
+	 * Number of columns in sub-composites
+	 */
+	private static final int SUB_COMPOSITE_COLUMNS = 2; // CodForChk_Dis_Magic
+
+	/**
+	 * Button width
+	 */
+	private static final int BUTTON_WIDTH = 75; // CodForChk_Dis_Magic
+
+	/**
+	 * Field width
+	 */
+	private final static int FIELD_WIDTH = 350; // CodForChk_Dis_Magic
+
+	/**
+	 * The parent composite
+	 */
+	private Composite parent;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parent
+	 *            the parent composite
+	 */
+	PropertyDialogComposite(Composite parent) {
+		this.parent = parent;
+	}
+
+	/**
+	 * Creates a composite with two columns and grid layout
+	 * 
+	 * @return the composite
+	 */
+	protected Composite createFieldButtonComposite() {
+		GridLayout layout = new GridLayout();
+		layout.numColumns = SUB_COMPOSITE_COLUMNS;
+		layout.marginLeft = 0;
+		layout.marginRight = 0;
+		layout.marginTop = 0;
+		layout.marginBottom = 0;
+		layout.marginWidth = 0;
+		layout.marginHeight = 0;
+		Composite composite = new Composite(parent, SWT.NONE);
+		composite.setLayout(layout);
+		GridData gridData = new GridData();
+		gridData.horizontalAlignment = GridData.FILL;
+		composite.setLayoutData(gridData);
+		return composite;
+	}
+
+	/**
+	 * Sets the layout data of the controls in field-button composite
+	 * 
+	 * @param field
+	 *            the field
+	 * @param button
+	 *            the button
+	 */
+	protected void setFieldButtonLayoutData(Control field, Control button) {
+		GridData fieldData = new GridData();
+		fieldData.horizontalAlignment = GridData.FILL;
+		fieldData.widthHint = FIELD_WIDTH;
+		field.setLayoutData(fieldData);
+		if (button != null) {
+			GridData buttonData = new GridData();
+			buttonData.widthHint = BUTTON_WIDTH;
+			button.setLayoutData(buttonData);
+		}
+	}
+
+	/**
+	 * Gets the parent composite
+	 * 
+	 * @return the parent composite
+	 */
+	protected Composite getParent() {
+		return parent;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/PropertyDialogProperties.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,341 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Properties of property dialog
+*
+*/
+package com.nokia.tracebuilder.view;
+
+import java.util.List;
+
+import org.eclipse.swt.widgets.Shell;
+
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialog;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialogEnabler;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialogFlag;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialogVerifier;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceObject;
+
+/**
+ * Properties of property dialog
+ * 
+ */
+class PropertyDialogProperties implements TraceObjectPropertyDialog {
+
+	/**
+	 * Type of dialog
+	 */
+	private int dialogType;
+
+	/**
+	 * Trace object name
+	 */
+	private String name;
+
+	/**
+	 * Trace object ID
+	 */
+	private int id;
+
+	/**
+	 * Trace object value
+	 */
+	private String value;
+
+	/**
+	 * Target object
+	 */
+	private String target;
+
+	/**
+	 * Flags for check boxes
+	 */
+	private List<TraceObjectPropertyDialogFlag> flags;
+
+	/**
+	 * Dialog templates
+	 */
+	private List<TraceObjectPropertyDialogTemplate> templates;
+
+	/**
+	 * Enabler
+	 */
+	private TraceObjectPropertyDialogEnabler enabler;
+
+	/**
+	 * Currently selected template
+	 */
+	private TraceObjectPropertyDialogTemplate selectedTemplate;
+
+	/**
+	 * Data verification interface
+	 */
+	protected TraceObjectPropertyDialogVerifier dataVerifier;
+
+	/**
+	 * Trace view
+	 */
+	private TraceView view;
+
+	/**
+	 * Target object
+	 */
+	private TraceObject targetObject;
+
+	/**
+	 * Creates a new property dialog properties object
+	 * 
+	 * @param view
+	 *            the view
+	 */
+	PropertyDialogProperties(TraceView view) {
+		this.view = view;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialog#setID(int)
+	 */
+	public void setID(int id) {
+		this.id = id;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialog#getID()
+	 */
+	public int getID() {
+		return id;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialog#setValue(java.lang.String)
+	 */
+	public void setValue(String value) {
+		this.value = value;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialog#getValue()
+	 */
+	public String getValue() {
+		return value;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialog#setName(java.lang.String)
+	 */
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialog#getName()
+	 */
+	public String getName() {
+		return name;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialog#setDialogType(int)
+	 */
+	public void setDialogType(int dialogType) {
+		this.dialogType = dialogType;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialog#getDialogType()
+	 */
+	public int getDialogType() {
+		return dialogType;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialog#setTarget(java.lang.String)
+	 */
+	public void setTarget(String target) {
+		this.target = target;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialog#getTarget()
+	 */
+	public String getTarget() {
+		return target;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialog#
+	 *      setUpdateObject(com.nokia.tracebuilder.model.TraceObject)
+	 */
+	public void setTargetObject(TraceObject targetObject) {
+		this.targetObject = targetObject;
+		if (targetObject != null) {
+			this.target = targetObject.getName();
+		} else {
+			this.target = ""; //$NON-NLS-1$
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialog#getUpdateObject()
+	 */
+	public TraceObject getTargetObject() {
+		return targetObject;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialog#
+	 *      setFlags(com.nokia.tracebuilder.engine.TraceObjectPropertyDialogFlag[])
+	 */
+	public void setFlags(List<TraceObjectPropertyDialogFlag> flags) {
+		this.flags = flags;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialog#getFlags()
+	 */
+	public List<TraceObjectPropertyDialogFlag> getFlags() {
+		return flags;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialog#
+	 *      setTemplates(java.util.List,
+	 *      com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate)
+	 */
+	public void setTemplates(List<TraceObjectPropertyDialogTemplate> templates,
+			TraceObjectPropertyDialogTemplate active) {
+		this.templates = templates;
+		selectedTemplate = active;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialog#getTemplate()
+	 */
+	public TraceObjectPropertyDialogTemplate getTemplate() {
+		return selectedTemplate;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialog#
+	 *      setEnabler(com.nokia.tracebuilder.engine.TraceObjectPropertyDialogEnabler)
+	 */
+	public void setEnabler(TraceObjectPropertyDialogEnabler enabler) {
+		this.enabler = enabler;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialog#
+	 *      setVerifier(com.nokia.tracebuilder.engine.TraceObjectPropertyDialogVerifier)
+	 */
+	public void setVerifier(TraceObjectPropertyDialogVerifier verifier) {
+		this.dataVerifier = verifier;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialog#open()
+	 */
+	public int open() {
+		Shell shell = view.getShell();
+		int retval;
+		if (shell != null) {
+			PropertyDialog dialog = new PropertyDialog(shell, this);
+			retval = dialog.open();
+		} else {
+			retval = CANCEL;
+		}
+		return retval;
+	}
+
+	/**
+	 * Verfies the properties
+	 * 
+	 * @throws TraceBuilderException
+	 *             if contents are not valid
+	 */
+	void verifyContents() throws TraceBuilderException {
+		if (dataVerifier != null) {
+			dataVerifier.verifyContents();
+		}
+	}
+
+	/**
+	 * Gets the templates list
+	 * 
+	 * @return the templates
+	 */
+	List<TraceObjectPropertyDialogTemplate> getTemplates() {
+		return templates;
+	}
+
+	/**
+	 * Gets the enabler interface
+	 * 
+	 * @return the interface
+	 */
+	TraceObjectPropertyDialogEnabler getEnabler() {
+		return enabler;
+	}
+
+	/**
+	 * Sets the selected template
+	 * 
+	 * @param template
+	 *            the template that was selected
+	 */
+	void setTemplate(TraceObjectPropertyDialogTemplate template) {
+		this.selectedTemplate = template;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/PropertyDialogUI.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,551 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* UI for property dialogs
+*
+*/
+package com.nokia.tracebuilder.view;
+
+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.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialog;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialogEnabler;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate;
+import com.nokia.tracebuilder.engine.TraceParameterPropertyDialogTemplate;
+
+/**
+ * UI for property dialogs
+ * 
+ */
+final class PropertyDialogUI extends Composite {
+
+	/**
+	 * Target combo-box selection listener
+	 * 
+	 */
+	private final class TargetSelectionListener implements SelectionListener {
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see org.eclipse.swt.events.SelectionListener#
+		 *      widgetSelected(org.eclipse.swt.events.SelectionEvent)
+		 */
+		public void widgetSelected(SelectionEvent e) {
+			if (changeCallback != null) {
+				changeCallback.targetChanged(getTarget());
+			}
+		}
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see org.eclipse.swt.events.SelectionListener#
+		 *      widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
+		 */
+		public void widgetDefaultSelected(SelectionEvent e) {
+			widgetSelected(e);
+		}
+	}
+
+	/**
+	 * Target combo-box modify listener
+	 * 
+	 */
+	private final class TargetFieldModifyListener implements ModifyListener {
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
+		 */
+		public void modifyText(ModifyEvent e) {
+			if (changeCallback != null) {
+				changeCallback.targetChanged(getTarget());
+			}
+		}
+	}
+
+	/**
+	 * Type combo-box selection listener
+	 * 
+	 */
+	private final class TypeSelectionListener implements SelectionListener {
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see org.eclipse.swt.events.SelectionListener#
+		 *      widgetSelected(org.eclipse.swt.events.SelectionEvent)
+		 */
+		public void widgetSelected(SelectionEvent e) {
+			if (changeCallback != null) {
+				changeCallback.typeChanged(getType());
+			}
+		}
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see org.eclipse.swt.events.SelectionListener#
+		 *      widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
+		 */
+		public void widgetDefaultSelected(SelectionEvent e) {
+			widgetSelected(e);
+		}
+	}
+
+	/**
+	 * Text field modification listener
+	 * 
+	 */
+	private final class TextFieldModifyListener implements ModifyListener {
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
+		 */
+		public void modifyText(ModifyEvent e) {
+			if (changeCallback != null) {
+				changeCallback.fieldChanged();
+			}
+		}
+	}
+
+	/**
+	 * Stores target object if combo is not created
+	 */
+	private String dummyTarget;
+
+	/**
+	 * Stores ID if ID field is not created
+	 */
+	private int dummyID;
+
+	/**
+	 * Stores name if name field is not created
+	 */
+	private String dummyName;
+
+	/**
+	 * Stores value if value field is not created
+	 */
+	private String dummyValue;
+
+	/**
+	 * Stores type if type combo is not created
+	 */
+	private String dummyType;
+
+	/**
+	 * Target composite
+	 */
+	private PropertyDialogUITarget targetComposite;
+
+	/**
+	 * ID composite
+	 */
+	private PropertyDialogUIID idComposite;
+
+	/**
+	 * Name composite
+	 */
+	private PropertyDialogUIName nameComposite;
+
+	/**
+	 * Type composite
+	 */
+	private PropertyDialogUIType typeComposite;
+
+	/**
+	 * Value composite
+	 */
+	public PropertyDialogUIValue valueComposite;
+
+	/**
+	 * Template composite
+	 */
+	public PropertyDialogUITemplate templateComposite;
+
+	/**
+	 * Callback to dialog
+	 */
+	private PropertyDialogUIChangeCallback changeCallback;
+
+	/**
+	 * Template combo box listener
+	 */
+	private TemplateComboSelectionListener templateListener;
+
+	/**
+	 * Text field modification listener
+	 */
+	private ModifyListener textFieldModifyListener;
+
+	/**
+	 * Ui type
+	 */
+	private int uiType;
+	
+	/**
+	 * Number of columns in UI
+	 */
+	private static final int COLUMN_COUNT = 2; // CodForChk_Dis_Magic
+
+	/**
+	 * Creates a dialog UI with given parent component
+	 * 
+	 * @param parent
+	 *            the parent composite
+	 * @param uiType
+	 *            the UI type
+	 * @param templates
+	 *            the dialog templates
+	 */
+	PropertyDialogUI(Composite parent, int uiType,
+			List<TraceObjectPropertyDialogTemplate> templates) {
+		super(parent, SWT.NONE);
+		initialize(uiType, templates);
+	}
+
+	/**
+	 * Initializes the member widgets
+	 * 
+	 * @param uiType
+	 *            the UI type
+	 * @param templates
+	 *            the templates list
+	 */
+	private void initialize(int uiType,
+			List<TraceObjectPropertyDialogTemplate> templates) {
+		this.uiType = uiType;
+		GridLayout gridLayout = new GridLayout();
+		gridLayout.numColumns = COLUMN_COUNT;
+		this.setLayout(gridLayout);
+		if (uiType == TraceObjectPropertyDialog.ADD_TRACE
+				|| uiType == TraceObjectPropertyDialog.ADD_CONSTANT
+				|| uiType == TraceObjectPropertyDialog.INSTRUMENTER
+				|| uiType == TraceObjectPropertyDialog.SELECT_COMPONENT) {
+			// Target is needed when adding traces or constants
+			targetComposite = new PropertyDialogUITarget(this, uiType,
+					new TargetFieldModifyListener(),
+					new TargetSelectionListener());
+		}
+
+		if (uiType != TraceObjectPropertyDialog.SELECT_COMPONENT) {
+			textFieldModifyListener = new TextFieldModifyListener();
+			nameComposite = new PropertyDialogUIName(this, uiType,
+					textFieldModifyListener);
+		}
+		if (uiType == TraceObjectPropertyDialog.ADD_TRACE
+				|| uiType == TraceObjectPropertyDialog.EDIT_TRACE
+				|| uiType == TraceObjectPropertyDialog.INSTRUMENTER) {
+			// Trace text is the only value
+			valueComposite = new PropertyDialogUIValue(this, uiType,
+					textFieldModifyListener);
+		}
+		if (uiType == TraceObjectPropertyDialog.ADD_CONSTANT
+				|| uiType == TraceObjectPropertyDialog.EDIT_CONSTANT) {
+			// Constants have user-defined ID's. Other ID's are managed by
+			// builder
+			idComposite = new PropertyDialogUIID(this, uiType,
+					textFieldModifyListener);
+		}
+		if (uiType == TraceObjectPropertyDialog.ADD_PARAMETER) {
+			// Type is needed by parameters
+			typeComposite = new PropertyDialogUIType(this, uiType,
+					new TypeSelectionListener());
+		}
+		if (uiType == TraceObjectPropertyDialog.ADD_PARAMETER
+				|| uiType == TraceObjectPropertyDialog.ADD_TRACE
+				|| uiType == TraceObjectPropertyDialog.INSTRUMENTER) {
+			templateListener = new TemplateComboSelectionListener(this);
+			templateComposite = new PropertyDialogUITemplate(this, uiType,
+					templateListener, templates);
+		}
+	}
+
+	/**
+	 * Gets the target object
+	 * 
+	 * @return the target
+	 */
+	String getTarget() {
+		String target;
+		if (targetComposite != null) {
+			target = targetComposite.getTarget();
+		} else {
+			target = dummyTarget;
+		}
+		return target;
+	}
+
+	/**
+	 * Selects the target which has given name
+	 * 
+	 * @param target
+	 *            the target to be selected
+	 */
+	void setTarget(String target) {
+		if (targetComposite != null && target != null) {
+			targetComposite.setTarget(target);
+		} else {
+			dummyTarget = target;
+		}
+	}
+
+	/**
+	 * Sets the ID field value
+	 * 
+	 * @param id
+	 *            the ID field value
+	 */
+	void setIDField(int id) {
+		if (idComposite != null) {
+			idComposite.setID(id);
+		} else {
+			dummyID = id;
+		}
+	}
+
+	/**
+	 * Gets the ID field value
+	 * 
+	 * @return the ID field value
+	 */
+	int getIDField() {
+		int retval;
+		if (idComposite != null) {
+			retval = idComposite.getID();
+		} else {
+			retval = dummyID;
+		}
+		return retval;
+	}
+
+	/**
+	 * Sets the contents of the name field
+	 * 
+	 * @param name
+	 *            the name field
+	 */
+	void setNameField(String name) {
+		if (nameComposite != null) {
+			if (name != null) {
+				nameComposite.setName(name);
+			} else {
+				nameComposite.setName(""); //$NON-NLS-1$
+			}
+		} else {
+			dummyName = name;
+		}
+	}
+
+	/**
+	 * Returns the contents of the name field
+	 * 
+	 * @return the name field
+	 */
+	String getNameField() {
+		String name;
+		if (nameComposite != null) {
+			name = nameComposite.getName();
+		} else {
+			name = dummyName;
+		}
+		return name;
+	}
+
+	/**
+	 * Sets the contents of the value field.
+	 * 
+	 * @param value
+	 *            the field contents
+	 */
+	void setValueField(String value) {
+		if (valueComposite != null) {
+			if (value != null) {
+				valueComposite.setValue(value);
+			} else {
+				valueComposite.setValue(""); //$NON-NLS-1$
+			}
+		} else {
+			dummyValue = value;
+		}
+	}
+
+	/**
+	 * Gets the value field contents
+	 * 
+	 * @return value field contents
+	 */
+	String getValueField() {
+		String ret;
+		if (valueComposite != null) {
+			ret = valueComposite.getValue();
+		} else {
+			ret = dummyValue;
+		}
+		return ret;
+	}
+
+	/**
+	 * Sets the type
+	 * 
+	 * @param type
+	 *            the type
+	 */
+	void setType(String type) {
+		if (typeComposite != null) {
+			typeComposite.setType(type);
+		} else {
+			dummyType = type;
+		}
+	}
+
+	/**
+	 * Gets the type
+	 * 
+	 * @return the type
+	 */
+	String getType() {
+		String type;
+		if (typeComposite != null) {
+			type = typeComposite.getSelectedType();
+		} else {
+			type = dummyType;
+		}
+		return type;
+	}
+
+	/**
+	 * Gets the UI type
+	 * 
+	 * @return the UI type
+	 */
+	int getUiType() {
+		return uiType;
+	}
+	
+	/**
+	 * Gets the template at given index
+	 * 
+	 * @param index
+	 *            the index to the template
+	 * @return the template
+	 */
+	TraceObjectPropertyDialogTemplate getTemplate(int index) {
+		return templateComposite.getTemplateAt(index);
+	}
+
+	/**
+	 * Called by the listener when template changes
+	 * 
+	 * @param template
+	 *            the new template
+	 */
+	void notifyTemplateChanged(TraceObjectPropertyDialogTemplate template) {
+		if (targetComposite != null) {
+			targetComposite.setEnabled(template == null
+					|| template.isTargetEnabled());
+		}
+		if (idComposite != null) {
+			idComposite.setEnabled(template == null || template.isIDEnabled());
+		}
+		if (valueComposite != null) {
+			valueComposite.setEnabled(template == null
+					|| template.isValueEnabled());
+		}
+		if (nameComposite != null) {
+			nameComposite.setEnabled(template == null
+					|| template.isNameEnabled());
+		}
+		if (typeComposite != null) {
+			boolean typeEnabled = !(template instanceof TraceParameterPropertyDialogTemplate)
+					|| ((TraceParameterPropertyDialogTemplate) template)
+							.isTypeEnabled();
+			typeComposite.setEnabled(typeEnabled);
+		}
+		if (changeCallback != null) {
+			changeCallback.templateChanged(template);
+		}
+	}
+
+	/**
+	 * Selects a template
+	 * 
+	 * @param template
+	 *            the template to be selected
+	 */
+	void setTemplate(TraceObjectPropertyDialogTemplate template) {
+		if (templateComposite != null) {
+			int index = templateComposite.selectTemplate(template);
+			if (templateListener != null) {
+				if (index < 0) {
+					templateListener.templateSelected(0);
+				} else {
+					templateListener.templateSelected(index);
+				}
+			}
+		}
+	}
+
+	/**
+	 * Disables all UI elements flagged to be disabled
+	 * 
+	 * @param enabler
+	 *            the enabler interface
+	 */
+	void setEnabler(TraceObjectPropertyDialogEnabler enabler) {
+		if (enabler != null) {
+			if (nameComposite != null && !enabler.isNameEnabled()) {
+				nameComposite.setEnabled(false);
+			}
+			if (targetComposite != null && !enabler.isTargetEnabled()) {
+				targetComposite.setEnabled(false);
+			}
+			if (idComposite != null && !enabler.isIdEnabled()) {
+				idComposite.setEnabled(false);
+			}
+			if (typeComposite != null && !enabler.isTypeEnabled()) {
+				typeComposite.setEnabled(false);
+			}
+			if (valueComposite != null && !enabler.isValueEnabled()) {
+				valueComposite.setEnabled(false);
+			}
+		}
+	}
+
+	/**
+	 * Sets the change notification callback
+	 * 
+	 * @param callback
+	 *            the callback
+	 */
+	void setChangeCallback(PropertyDialogUIChangeCallback callback) {
+		this.changeCallback = callback;
+
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/PropertyDialogUIChangeCallback.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Callback from property dialog UI
+*
+*/
+package com.nokia.tracebuilder.view;
+
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate;
+
+/**
+ * Callback from property dialog UI
+ * 
+ */
+interface PropertyDialogUIChangeCallback {
+
+	/**
+	 * Called when template changes
+	 * 
+	 * @param template
+	 *            the template
+	 */
+	void templateChanged(TraceObjectPropertyDialogTemplate template);
+
+	/**
+	 * Target change notification
+	 * 
+	 * @param target
+	 *            new target
+	 */
+	void targetChanged(String target);
+
+	/**
+	 * Called when a text field changes
+	 */
+	void fieldChanged();
+
+	/**
+	 * Called when parameter type changes
+	 * 
+	 * @param type
+	 *            the new type
+	 */
+	void typeChanged(String type);
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/PropertyDialogUIID.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,304 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Composite for ID label, field and hex checkbox
+*
+*/
+package com.nokia.tracebuilder.view;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialog;
+
+/**
+ * Composite for ID label, field and hex checkbox
+ * 
+ */
+class PropertyDialogUIID extends PropertyDialogComposite {
+
+	/**
+	 * Configuration name for hex checkbox state
+	 */
+	private static final String HEX_CHECK_CONFIG = "PropertyDialogUIID.hexCheck"; //$NON-NLS-1$
+
+	/**
+	 * Hex checkbox listener
+	 * 
+	 */
+	private final class HexCheckSelectionListener implements SelectionListener {
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see org.eclipse.swt.events.SelectionListener#
+		 *      widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
+		 */
+		public void widgetDefaultSelected(SelectionEvent e) {
+			widgetSelected(e);
+		}
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see org.eclipse.swt.events.SelectionListener#
+		 *      widgetSelected(org.eclipse.swt.events.SelectionEvent)
+		 */
+		public void widgetSelected(SelectionEvent e) {
+			try {
+				TraceBuilderGlobals.getConfiguration().setFlag(
+						HEX_CHECK_CONFIG, hexCheck.getSelection());
+				// Converts the ID field to new format. The old value of the
+				// hex checkbox is used, since that represents the value
+				// before the checkbox was changed
+				setID(idFromString(idField.getText(), !hexCheck.getSelection()));
+			} catch (NumberFormatException ex) {
+			}
+		}
+	}
+
+	/**
+	 * Modification listener for the ID field
+	 * 
+	 */
+	private final class IDFieldModifyListener implements ModifyListener {
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
+		 */
+		public void modifyText(ModifyEvent e) {
+			// If the hex field is not checked, a hex character checks it
+			if (!hexCheck.getSelection()) {
+				String text = idField.getText();
+				if (hasHexPrefix(text) || hasHexChars(text)) {
+					hexCheck.setSelection(true);
+				}
+			}
+		}
+	}
+
+	/**
+	 * Radix for hex values
+	 */
+	private static final int HEX_RADIX = 16; // CodForChk_Dis_Magic
+
+	/**
+	 * ID label
+	 */
+	private Label idLabel;
+
+	/**
+	 * ID field is mapped to trace object ID.
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceObject#setID(int)
+	 */
+	private Text idField;
+
+	/**
+	 * Hex ID checkbox
+	 */
+	private Button hexCheck;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parent
+	 *            parent composite
+	 * @param uiType
+	 *            type of UI
+	 * @param modifyListener
+	 *            the modify listener for ID field
+	 */
+	PropertyDialogUIID(Composite parent, int uiType,
+			ModifyListener modifyListener) {
+		super(parent);
+		create(uiType, modifyListener);
+	}
+
+	/**
+	 * Creates the ID text field and associated label
+	 * 
+	 * @param uiType
+	 *            the UI type
+	 * @param modifyListener
+	 *            listener for text field changes
+	 */
+	private void create(int uiType, ModifyListener modifyListener) {
+		// Label is added to this composite
+		idLabel = new Label(getParent(), SWT.NONE);
+		idLabel.setText(getIDLabel(uiType));
+		// Field and button are added to sub-composite
+		Composite composite = createFieldButtonComposite();
+		idField = new Text(composite, SWT.BORDER);
+		idField.addModifyListener(modifyListener);
+		idField.addModifyListener(new IDFieldModifyListener());
+		hexCheck = new Button(composite, SWT.CHECK);
+		hexCheck.setSelection(TraceBuilderGlobals.getConfiguration().getFlag(
+				HEX_CHECK_CONFIG));
+		hexCheck.setText(Messages.getString("PropertyDialogUI.HexButtonTitle")); //$NON-NLS-1$
+		hexCheck.addSelectionListener(new HexCheckSelectionListener());
+		setFieldButtonLayoutData(idField, hexCheck);
+	}
+
+	/**
+	 * Gets the label for ID field
+	 * 
+	 * @param uiType
+	 *            the UI type
+	 * @return the label
+	 */
+	private String getIDLabel(int uiType) {
+		String id;
+		switch (uiType) {
+		case TraceObjectPropertyDialog.ADD_CONSTANT:
+			id = Messages.getString("PropertyDialogUI.AddConstantIDLabel"); //$NON-NLS-1$
+			break;
+		case TraceObjectPropertyDialog.EDIT_CONSTANT:
+			id = Messages.getString("PropertyDialogUI.EditConstantIDLabel"); //$NON-NLS-1$
+			break;
+		default:
+			id = ""; //$NON-NLS-1$
+			break;
+		}
+		return id;
+	}
+
+	/**
+	 * Checks if given string has hex characters
+	 * 
+	 * @param text
+	 *            the text
+	 * @return true if there are hex characters
+	 */
+	private boolean hasHexChars(String text) {
+		boolean isHex = false;
+		for (int i = 0; i < text.length() && !isHex; i++) {
+			char c = text.charAt(i);
+			if (c == 'a' || c == 'b' || c == 'c' || c == 'd' || c == 'e'
+					|| c == 'f' || c == 'A' || c == 'B' || c == 'C' || c == 'D'
+					|| c == 'E' || c == 'F') {
+				isHex = true;
+			}
+		}
+		return isHex;
+	}
+
+	/**
+	 * Checks if the text has hex prefix
+	 * 
+	 * @param text
+	 *            the text
+	 * @return true if there is hex prefix
+	 */
+	private boolean hasHexPrefix(String text) {
+		boolean isHex = false;
+		String pref = Messages.getString("PropertyDialogUI.HexPrefix"); //$NON-NLS-1$
+		if (text.length() > pref.length()) {
+			if (text.substring(0, pref.length()).equalsIgnoreCase(pref)) {
+				isHex = true;
+			}
+		}
+		return isHex;
+	}
+
+	/**
+	 * Tries to convert an ID string to number
+	 * 
+	 * @param text
+	 *            the ID string
+	 * @param isHex
+	 *            true if interpreted as hex
+	 * @return the ID
+	 * @throws NumberFormatException
+	 *             if ID is not valid
+	 */
+	int idFromString(String text, boolean isHex) throws NumberFormatException {
+		if (!isHex) {
+			// If hex checkbox is not selected, the content is still checked
+			// If there is hex prefix or hex characters, it is interpreted as
+			// hex
+			isHex = hasHexPrefix(text);
+			if (!isHex) {
+				isHex = hasHexChars(text);
+			} else {
+				text = text.substring(Messages.getString(
+						"PropertyDialogUI.HexPrefix").length()); //$NON-NLS-1$
+			}
+		} else {
+			// If checkbox is selected, the prefix needs to be removed if
+			// it exists
+			if (hasHexPrefix(text)) {
+				text = text.substring(Messages.getString(
+						"PropertyDialogUI.HexPrefix").length()); //$NON-NLS-1$
+			}
+		}
+		int id;
+		if (isHex) {
+			id = Long.valueOf(text, HEX_RADIX).intValue();
+		} else {
+			id = Integer.valueOf(text).intValue();
+		}
+		return id;
+	}
+
+	/**
+	 * Sets the ID field value
+	 * 
+	 * @param id
+	 *            the new ID value
+	 */
+	void setID(int id) {
+		if (hexCheck.getSelection()) {
+			idField.setText(Messages.getString("PropertyDialogUI.HexPrefix") //$NON-NLS-1$ 
+					+ Integer.toHexString(id));
+		} else {
+			idField.setText(Integer.toString(id));
+		}
+	}
+
+	/**
+	 * Returns the value from the ID field. Throws NumberFormatException if the
+	 * ID field does not contain a number
+	 * 
+	 * @return id field value
+	 * @throws NumberFormatException
+	 *             if the ID field does not contain valid data
+	 */
+	int getID() throws NumberFormatException {
+		return idFromString(idField.getText(), hexCheck.getSelection());
+	}
+
+	/**
+	 * Enables or disables the ID field and hex button
+	 * 
+	 * @param flag
+	 *            the enabled flag
+	 */
+	void setEnabled(boolean flag) {
+		idField.setEnabled(flag);
+		hexCheck.setEnabled(flag);
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/PropertyDialogUIName.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,150 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Composite for name label, field and tag button
+*
+*/
+package com.nokia.tracebuilder.view;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialog;
+
+/**
+ * Composite for name label, field and tag button
+ * 
+ */
+final class PropertyDialogUIName extends PropertyDialogComposite {
+
+	/**
+	 * Name label
+	 */
+	private Label nameLabel;
+
+	/**
+	 * Name field is mapped to trace object name.
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceObject#setName(String)
+	 */
+	private Text nameField;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parent
+	 *            the parent composite
+	 * @param uiType
+	 *            the UI type
+	 * @param modifyListener
+	 *            the field modify listener
+	 */
+	PropertyDialogUIName(Composite parent, int uiType,
+			ModifyListener modifyListener) {
+		super(parent);
+		create(uiType, modifyListener);
+	}
+
+	/**
+	 * Creates the name text field and associated label
+	 * 
+	 * @param uiType
+	 *            the UI type
+	 * @param modifyListener
+	 *            the field modify listener
+	 */
+	private void create(int uiType, ModifyListener modifyListener) {
+		nameLabel = new Label(getParent(), SWT.NONE);
+		nameLabel.setText(getNameLabel(uiType));
+		nameField = new Text(getParent(), SWT.BORDER);
+		nameField.addModifyListener(modifyListener);
+		setFieldButtonLayoutData(nameField, null);
+	}
+
+	/**
+	 * Gets the label for name field
+	 * 
+	 * @param uiType
+	 *            the UI type
+	 * @return the label
+	 */
+	private String getNameLabel(int uiType) {
+		String name;
+		switch (uiType) {
+		case TraceObjectPropertyDialog.EDIT_GROUP:
+			name = Messages.getString("PropertyDialogUI.EditGroupNameLabel"); //$NON-NLS-1$
+			break;
+		case TraceObjectPropertyDialog.ADD_TRACE:
+			name = Messages.getString("PropertyDialogUI.AddTraceNameLabel"); //$NON-NLS-1$
+			break;
+		case TraceObjectPropertyDialog.EDIT_TRACE:
+			name = Messages.getString("PropertyDialogUI.EditTraceNameLabel"); //$NON-NLS-1$
+			break;
+		case TraceObjectPropertyDialog.ADD_PARAMETER:
+			name = Messages.getString("PropertyDialogUI.AddParameterNameLabel"); //$NON-NLS-1$
+			break;
+		case TraceObjectPropertyDialog.ADD_CONSTANT:
+			name = Messages.getString("PropertyDialogUI.AddConstantNameLabel"); //$NON-NLS-1$
+			break;
+		case TraceObjectPropertyDialog.EDIT_CONSTANT:
+			name = Messages.getString("PropertyDialogUI.EditConstantNameLabel"); //$NON-NLS-1$
+			break;
+		case TraceObjectPropertyDialog.EDIT_CONSTANT_TABLE:
+			name = Messages
+					.getString("PropertyDialogUI.EditConstantTableNameLabel"); //$NON-NLS-1$
+			break;
+		case TraceObjectPropertyDialog.INSTRUMENTER:
+			name = Messages.getString("PropertyDialogUI.TraceNameFormat"); //$NON-NLS-1$
+			break;
+		default:
+			name = ""; //$NON-NLS-1$
+			break;
+		}
+		return name;
+	}
+
+	/**
+	 * Sets the name
+	 * 
+	 * @param name
+	 *            the name
+	 */
+	void setName(String name) {
+		nameField.setText(name);
+	}
+
+	/**
+	 * Gets the name
+	 * 
+	 * @return the name
+	 */
+	String getName() {
+		return nameField.getText();
+	}
+
+	/**
+	 * Enables / disables the name field and tag button
+	 * 
+	 * @param flag
+	 *            new enabled state
+	 */
+	void setEnabled(boolean flag) {
+		nameField.setEnabled(flag);
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/PropertyDialogUITarget.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,198 @@
+/*
+ * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ * Composite for target label and combo box
+ *
+ */
+package com.nokia.tracebuilder.view;
+
+import java.util.Iterator;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+
+import com.nokia.tracebuilder.engine.SoftwareComponent;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialog;
+import com.nokia.tracebuilder.engine.rules.RuleUtils;
+import com.nokia.tracebuilder.model.TraceConstantTable;
+import com.nokia.tracebuilder.project.FormattingUtils;
+import com.nokia.tracebuilder.project.GroupNameHandlerBase;
+
+/**
+ * Composite for target label and combo box
+ * 
+ */
+final class PropertyDialogUITarget extends PropertyDialogComposite {
+
+	/**
+	 * Target label
+	 */
+	private Label targetLabel = null;
+
+	/**
+	 * Target selector
+	 */
+	private Combo targetCombo = null;
+
+	/**
+	 * Property dialog UI
+	 */
+	private PropertyDialogUI dialogUI;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parent
+	 *            parent composite
+	 * @param uiType
+	 *            the type of UI
+	 * @param modifyListener
+	 *            combobox text change listener
+	 * @param selectionListener
+	 *            combobox selection change listener
+	 */
+	PropertyDialogUITarget(Composite parent, int uiType,
+			ModifyListener modifyListener, SelectionListener selectionListener) {
+		super(parent);
+		this.dialogUI = (PropertyDialogUI) parent;
+		create(uiType, modifyListener, selectionListener);
+	}
+
+	/**
+	 * Creates the label and combo box
+	 * 
+	 * @param uiType
+	 *            the UI type
+	 * @param modifyListener
+	 *            combobox text change listener
+	 * @param selectionListener
+	 *            combobox selection change listener
+	 */
+	private void create(int uiType, ModifyListener modifyListener,
+			SelectionListener selectionListener) {
+		targetLabel = new Label(getParent(), SWT.NONE);
+
+		if (uiType == TraceObjectPropertyDialog.SELECT_COMPONENT) {
+			targetCombo = new Combo(getParent(), SWT.READ_ONLY);
+		} else {
+			targetCombo = new Combo(getParent(), SWT.NONE);
+		}
+
+		int selid = 0;
+		String text;
+		if (uiType == TraceObjectPropertyDialog.SELECT_COMPONENT) {
+			text = Messages
+					.getString("PropertyDialogUI.SelectComponentNameLabel"); //$NON-NLS-1$	
+			Iterator<SoftwareComponent> components = TraceBuilderGlobals
+					.getSoftwareComponents();
+			while (components.hasNext()) {
+				SoftwareComponent component = components.next();
+				targetCombo.add(component.getName());
+			}
+		} else if (uiType == TraceObjectPropertyDialog.ADD_CONSTANT) {
+			text = Messages
+					.getString("PropertyDialogUITarget.AddConstantTargetLabel"); //$NON-NLS-1$
+			Iterator<TraceConstantTable> tables = TraceBuilderGlobals
+					.getTraceModel().getConstantTables();
+			while (tables.hasNext()) {
+				targetCombo.add(tables.next().getName());
+			}
+		} else {
+			text = Messages.getString("PropertyDialogUI.AddTraceTargetLabel"); //$NON-NLS-1$
+			Iterator<String> groups = FormattingUtils
+					.getGroupNames(TraceBuilderGlobals.getTraceModel());
+			while (groups.hasNext()) {
+				String group = groups.next();
+
+				// TRACE_STATE and TRACE_PERFORMACE group names are not added
+				// to combo, those can be used only via templates
+				GroupNameHandlerBase groupNameHandler = TraceBuilderGlobals.getGroupNameHandler();
+				String[] defaultGroups = groupNameHandler.getDefaultGroups();
+				if (group != defaultGroups[groupNameHandler.getStateGroupIdIndex()]
+						&& group != defaultGroups[groupNameHandler.getPerformanceGroupIdIndex()]) {
+					targetCombo.add(group);
+				}
+			}
+		}
+
+		targetLabel.setText(text);
+		targetCombo.select(selid);
+		targetCombo.addSelectionListener(selectionListener);
+		targetCombo.addModifyListener(modifyListener);
+		setFieldButtonLayoutData(targetCombo, null);
+	}
+
+	/**
+	 * Gets the target trace object
+	 * 
+	 * @return the target
+	 */
+	String getTarget() {
+		return targetCombo.getText();
+	}
+
+	/**
+	 * Sets the target object
+	 * 
+	 * @param target
+	 *            the new target
+	 */
+	void setTarget(String target) {
+		int found = -1;
+		for (int i = 0; i < targetCombo.getItemCount() && found == -1; i++) {
+			if (targetCombo.getItem(i).equals(target)) {
+				found = i;
+			}
+		}
+		int uiType = dialogUI.getUiType();
+		if (found >= 0) {
+			targetCombo.select(found);
+		} else if (uiType == TraceObjectPropertyDialog.ADD_PARAMETER
+				|| uiType == TraceObjectPropertyDialog.ADD_TRACE
+				|| uiType == TraceObjectPropertyDialog.INSTRUMENTER) {
+			int templateIndex = dialogUI.templateComposite.getTemplateIndex();
+			GroupNameHandlerBase groupNameHandler = TraceBuilderGlobals.getGroupNameHandler();
+			String[] defaultGroups = groupNameHandler.getDefaultGroups();
+			if (((!target
+					.equals(defaultGroups[groupNameHandler.getStateGroupIdIndex()]) && !target
+					.equals(defaultGroups[groupNameHandler.getPerformanceGroupIdIndex()])) && templateIndex == 0)
+					|| (target
+							.equals(defaultGroups[groupNameHandler.getStateGroupIdIndex()]) && templateIndex == RuleUtils.TYPE_STATE_TRACE + 1)
+					|| (target
+							.equals(defaultGroups[groupNameHandler.getPerformanceGroupIdIndex()]) && templateIndex == RuleUtils.TYPE_PERF_EVENT + 1)
+					|| (target
+							.equals(defaultGroups[groupNameHandler.getFlowGroupIdIndex()]) && templateIndex == RuleUtils.TYPE_ENTRY_EXIT + 1)) {
+				targetCombo.setText(target);
+			} else {
+				targetCombo.select(groupNameHandler.getNormalGroupIdIndex() - 1);
+			}
+		}
+	}
+
+	/**
+	 * Enables / disables the target field
+	 * 
+	 * @param flag
+	 *            new enabled state
+	 */
+	void setEnabled(boolean flag) {
+		targetCombo.setEnabled(flag);
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/PropertyDialogUITemplate.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,177 @@
+/*
+ * Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ * Composite for template label and combo box
+ *
+ */
+package com.nokia.tracebuilder.view;
+
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialog;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceObject;
+import com.nokia.tracebuilder.project.GroupNameHandlerBase;
+
+/**
+ * Composite for template label and combo box
+ * 
+ */
+final class PropertyDialogUITemplate extends PropertyDialogComposite {
+
+	/**
+	 * Number of visible templates when opening the combo box
+	 */
+	private static final int VISIBLE_TEMPLATES_COUNT = 8; // CodForChk_Dis_Magic
+
+	/**
+	 * Template label
+	 */
+	private Label templateLabel;
+
+	/**
+	 * Template selector
+	 */
+	private Combo templateCombo;
+
+	/**
+	 * List of templates
+	 */
+	private List<TraceObjectPropertyDialogTemplate> templates;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parent
+	 *            the parent composite
+	 * @param uiType
+	 *            the UI type
+	 * @param templateListener
+	 *            listener for template changes
+	 * @param templates
+	 *            the list of templates
+	 */
+	PropertyDialogUITemplate(Composite parent, int uiType,
+			SelectionListener templateListener,
+			List<TraceObjectPropertyDialogTemplate> templates) {
+		super(parent);
+		this.templates = templates;
+		create(uiType, templateListener);
+	}
+
+	/**
+	 * Creates the template combo box
+	 * 
+	 * @param uiType
+	 *            type of UI
+	 * @param templateListener
+	 *            listener for template changes
+	 */
+	private void create(int uiType, SelectionListener templateListener) {
+		templateLabel = new Label(getParent(), SWT.NONE);
+		templateLabel.setText(Messages
+				.getString("PropertyDialogUI.TemplatesLabel")); //$NON-NLS-1$
+		templateCombo = new Combo(getParent(), SWT.READ_ONLY);
+		templateCombo.add(Messages.getString("PropertyDialogUI.NoTemplate")); //$NON-NLS-1$
+		templateCombo.select(0);
+
+		// If selected trace is Performance trace and UI type is "Add parameter"
+		// no templates can be selected
+		if (templates != null
+				&& !(uiType == TraceObjectPropertyDialog.ADD_PARAMETER && isPerformaceTraceSelected())) {
+			for (int i = 0; i < templates.size(); i++) {
+				templateCombo.add(templates.get(i).getTitle());
+			}
+		}
+		templateCombo.addSelectionListener(templateListener);
+		templateCombo.setVisibleItemCount(VISIBLE_TEMPLATES_COUNT);
+		setFieldButtonLayoutData(templateCombo, null);
+	}
+
+	/**
+	 * Gets the index of the selected template. Note that index 0 means "No
+	 * template" and actual templates start from index 1
+	 * 
+	 * @return the index
+	 */
+	int getTemplateIndex() {
+		return templateCombo.getSelectionIndex();
+	}
+
+	/**
+	 * Gets the template at given index. Note that index 0 means "No template"
+	 * and actual templates start from index 1
+	 * 
+	 * @param index
+	 *            the index
+	 * @return the template
+	 */
+	TraceObjectPropertyDialogTemplate getTemplateAt(int index) {
+		return templates.get(index - 1);
+	}
+
+	/**
+	 * Selects the given template. Retuns the index to the selected template.
+	 * Note that index 0 means "No template" and actual templates start from
+	 * index 1
+	 * 
+	 * @param template
+	 *            the template to be selected
+	 * @return index of the selected template
+	 */
+	int selectTemplate(TraceObjectPropertyDialogTemplate template) {
+		int retval = -1;
+		if (template != null && templates != null) {
+			for (int i = 0; i < templates.size(); i++) {
+				if (templates.get(i) == template) {
+					templateCombo.select(i + 1);
+					retval = i + 1;
+					i = templates.size();
+				}
+			}
+		}
+		return retval;
+	}
+
+	/**
+	 * Check is Performance Event trace selected
+	 * 
+	 * @return true if Performance Event Trace is selected, otherwise false
+	 */
+	private boolean isPerformaceTraceSelected() {
+		boolean retval = false;
+
+		TraceObject selectedObject = TraceBuilderGlobals.getTraceBuilder()
+				.getSelectedObject();
+
+		if (selectedObject instanceof Trace) {
+			Trace trace = (Trace) selectedObject;
+			GroupNameHandlerBase groupNameHandler = TraceBuilderGlobals.getGroupNameHandler();
+			if (trace.getGroup().getName().equals(
+					groupNameHandler.getDefaultGroups()[groupNameHandler.getPerformanceGroupIdIndex()])) {
+				retval = true;
+			}
+		}
+		return retval;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/PropertyDialogUIType.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,239 @@
+/*
+ * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ * Composite for parameter type label, combo box and new type button
+ *
+ */
+package com.nokia.tracebuilder.view;
+
+import java.util.Iterator;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialog;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceConstantTable;
+import com.nokia.tracebuilder.model.TraceObject;
+import com.nokia.tracebuilder.project.GroupNameHandlerBase;
+
+/**
+ * Composite for parameter type label, combo box and new type button
+ * 
+ */
+final class PropertyDialogUIType extends PropertyDialogComposite {
+
+	/**
+	 * Parameter type label
+	 */
+	private Label typeLabel = null;
+
+	/**
+	 * Parameter type selector
+	 */
+	private Combo typeCombo = null;
+
+	/**
+	 * Limited Trace visible type item count
+	 */
+	private final int limitedTraceVisibleTypeItemCnt = 2; // CodForChk_Dis_Magic
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parent
+	 *            the parent composite
+	 * @param uiType
+	 *            the UI type
+	 * @param listener
+	 *            listener for type selection
+	 */
+	PropertyDialogUIType(Composite parent, int uiType,
+			SelectionListener listener) {
+		super(parent);
+		create(uiType, listener);
+	}
+
+	/**
+	 * Creates the parameter type combobox and associated label
+	 * 
+	 * @param uiType
+	 *            the type of UI
+	 * @param listener
+	 *            selection listener for combobox
+	 */
+	private void create(int uiType, SelectionListener listener) {
+		// Label is added to this composite
+		typeLabel = new Label(getParent(), SWT.NONE);
+		typeLabel.setText(getTypeLabel(uiType));
+		typeCombo = new Combo(getParent(), SWT.READ_ONLY);
+
+		// Adds parameter types to the selector
+		for (int i = 0; i < TraceViewMessages.PARAMETER_LABEL_MAP.length; i++) {
+			typeCombo.add(TraceViewMessages.PARAMETER_LABEL_MAP[i][1]);
+		}
+		// Adds constant table names after parameter types
+		Iterator<TraceConstantTable> tables = TraceBuilderGlobals
+				.getTraceModel().getConstantTables();
+		while (tables.hasNext()) {
+			typeCombo.add(tables.next().getName());
+		}
+
+		// If selected object is Performance or State trace, only Signed32 and
+		// Unsigned32 types are allowed -> First two types in
+		// TraceViewMessages.PARAMETER_LABEL_MAP. Also, disable the use of the
+		// "Array Parameter" checkbox
+		if (isPerformaceTraceSelected() || isStateTraceSelected()) {
+			typeCombo.remove(limitedTraceVisibleTypeItemCnt, typeCombo
+					.getItemCount() - 1);
+			typeCombo.setVisibleItemCount(limitedTraceVisibleTypeItemCnt);
+		} else {
+			typeCombo.setVisibleItemCount(typeCombo.getItemCount());
+		}
+
+		typeCombo.addSelectionListener(listener);
+		setFieldButtonLayoutData(typeCombo, null);
+	}
+
+	/**
+	 * Gets the label for type field
+	 * 
+	 * @param uiType
+	 *            the UI type
+	 * @return the label
+	 */
+	private String getTypeLabel(int uiType) {
+		String type;
+		switch (uiType) {
+		case TraceObjectPropertyDialog.ADD_PARAMETER:
+			type = Messages.getString("PropertyDialogUI.AddParameterTypeLabel"); //$NON-NLS-1$
+			break;
+		default:
+			type = ""; //$NON-NLS-1$
+			break;
+		}
+		return type;
+	}
+
+	/**
+	 * Check is Performance Event trace selected
+	 * 
+	 * @return true if Performance Event Trace is selected, otherwise false
+	 */
+	private boolean isPerformaceTraceSelected() {
+		boolean retval = false;
+
+		TraceObject selectedObject = TraceBuilderGlobals.getTraceBuilder()
+				.getSelectedObject();
+
+		if (selectedObject instanceof Trace) {
+			Trace trace = (Trace) selectedObject;
+			GroupNameHandlerBase groupNameHandler = TraceBuilderGlobals
+					.getGroupNameHandler();
+			if (trace.getGroup().getName().equals(
+					groupNameHandler.getDefaultGroups()[groupNameHandler
+							.getPerformanceGroupIdIndex()])) {
+				retval = true;
+			}
+		}
+		return retval;
+	}
+
+	/**
+	 * Check is State trace selected
+	 * 
+	 * @return true if State Trace is selected, otherwise false
+	 */
+	private boolean isStateTraceSelected() {
+		boolean retval = false;
+
+		TraceObject selectedObject = TraceBuilderGlobals.getTraceBuilder()
+				.getSelectedObject();
+
+		if (selectedObject instanceof Trace) {
+			Trace trace = (Trace) selectedObject;
+			GroupNameHandlerBase groupNameHandler = TraceBuilderGlobals
+					.getGroupNameHandler();
+			if (trace.getGroup().getName().equals(
+					groupNameHandler.getDefaultGroups()[groupNameHandler
+							.getStateGroupIdIndex()])) {
+				retval = true;
+			}
+		}
+		return retval;
+	}
+
+	/**
+	 * Gets the type selected from the combo box
+	 * 
+	 * @return the selected type
+	 */
+	String getSelectedType() {
+		String type;
+		int index = typeCombo.getSelectionIndex();
+		if (index >= TraceViewMessages.PARAMETER_LABEL_MAP.length) {
+			type = typeCombo.getText();
+		} else {
+			type = TraceViewMessages.PARAMETER_LABEL_MAP[index][0];
+		}
+		return type;
+	}
+
+	/**
+	 * Selects the type
+	 * 
+	 * @param type
+	 *            the type
+	 */
+	void setType(String type) {
+		boolean found = false;
+
+		// If selected object is Performance or State trace, only Signed32 and
+		// Unsigned32 types are allowed, so because it could be that previous
+		// type is not allowed, we always select Signed32 type as default in
+		// that case and previous type check is skipped.
+		if (!isPerformaceTraceSelected() && !isStateTraceSelected()) {
+			if (type != null && type.length() > 0) {
+				for (int i = 0; i < TraceViewMessages.PARAMETER_LABEL_MAP.length; i++) {
+					if (TraceViewMessages.PARAMETER_LABEL_MAP[i][0]
+							.equals(type)) {
+						typeCombo.select(i);
+						i = typeCombo.getItemCount();
+						found = true;
+						break;
+					}
+				}
+			}
+		}
+		if (!found) {
+			typeCombo.select(0);
+		}
+	}
+
+	/**
+	 * Enables / disables the type combo box
+	 * 
+	 * @param flag
+	 *            new enabled flag
+	 */
+	void setEnabled(boolean flag) {
+		typeCombo.setEnabled(flag);
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/PropertyDialogUIValue.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,153 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Composite for value label, field and tag button
+*
+*/
+package com.nokia.tracebuilder.view;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialog;
+
+/**
+ * Composite for value label, field and tag button
+ * 
+ */
+final class PropertyDialogUIValue extends PropertyDialogComposite {
+
+	/**
+	 * Each dialog has a different value label
+	 */
+	private Label valueLabel;
+
+	/**
+	 * Value field is mapped to trace text
+	 */
+	private Text valueField;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parent
+	 *            the parent composite
+	 * @param uiType
+	 *            the UI type
+	 * @param modifyListener
+	 *            text field modify listener
+	 */
+	PropertyDialogUIValue(Composite parent, int uiType,
+			ModifyListener modifyListener) {
+		super(parent);
+		create(uiType, modifyListener);
+	}
+
+	/**
+	 * Creates the value text field and associated label
+	 * 
+	 * @param uiType
+	 *            the UI type
+	 * @param modifyListener
+	 *            the text field modify listener
+	 */
+	private void create(int uiType, ModifyListener modifyListener) {
+		valueLabel = new Label(getParent(), SWT.NONE);
+		valueLabel.setText(getValueLabel(uiType));
+		valueField = new Text(getParent(), SWT.BORDER);
+		valueField.addModifyListener(modifyListener);
+		setFieldButtonLayoutData(valueField, null);
+	}
+
+	/**
+	 * Gets the label for value field
+	 * 
+	 * @param uiType
+	 *            the UI type
+	 * @return the label
+	 */
+	private String getValueLabel(int uiType) {
+		String value;
+		switch (uiType) {
+		case TraceObjectPropertyDialog.ADD_TRACE:
+			value = Messages.getString("PropertyDialogUI.AddTraceValueLabel"); //$NON-NLS-1$
+			break;
+		case TraceObjectPropertyDialog.EDIT_TRACE:
+			value = Messages.getString("PropertyDialogUI.EditTraceValueLabel"); //$NON-NLS-1$
+			break;
+		case TraceObjectPropertyDialog.INSTRUMENTER:
+			value = Messages.getString("PropertyDialogUI.TraceTextFormat"); //$NON-NLS-1$
+			break;
+		default:
+			value = ""; //$NON-NLS-1$
+			break;
+		}
+		return value;
+	}
+
+	/**
+	 * Gets the value field contents
+	 * 
+	 * @return the field contents
+	 */
+	String getValue() {
+		return valueField.getText();
+	}
+
+	/**
+	 * Sets the value field contents
+	 * 
+	 * @param value
+	 *            the new value
+	 */
+	void setValue(String value) {
+		valueField.setText(value);
+	}
+
+	/**
+	 * Enables / disables the value field and the tag button
+	 * 
+	 * @param flag
+	 *            new enabled state
+	 */
+	void setEnabled(boolean flag) {
+		valueField.setEnabled(flag);
+	}
+	
+	/**
+	 * Sets the label text
+	 * 
+	 * @param labelText
+	 *            the new label text
+	 */
+	void setLabel(String labelText) {
+		if (labelText != null) {
+			valueLabel.setText(labelText);
+		}
+	}
+	
+	/**
+	 * Get value label
+	 * 
+	 * @return the value label
+	 */
+	Label getValueLabel() {
+		return valueLabel;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/PropertyWrapper.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,153 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* UI for property dialogs
+*
+*/
+package com.nokia.tracebuilder.view;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+
+/**
+ * Wrapper for a trace object property
+ * 
+ */
+final class PropertyWrapper extends WrapperBase {
+
+	/**
+	 * The property
+	 */
+	private String property;
+
+	/**
+	 * Type of the property
+	 */
+	private String type;
+
+	/**
+	 * Creates a new property wrapper
+	 * 
+	 * @param type
+	 *            the property type
+	 * @param property
+	 *            the property
+	 * @param parent
+	 *            tree view parent
+	 * @param updater
+	 *            the update notifier
+	 */
+	PropertyWrapper(String type, String property, WrapperBase parent,
+			WrapperUpdater updater) {
+		super(parent, updater);
+		this.type = type;
+		this.property = property;
+	}
+
+	/**
+	 * Sets the property
+	 * 
+	 * @param property
+	 *            the new property
+	 */
+	void setProperty(String property) {
+		this.property = property;
+	}
+
+	/**
+	 * Sets the type
+	 * 
+	 * @param type
+	 *            the type
+	 */
+	void setType(String type) {
+		this.type = type;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.view.WrapperBase#getChildren()
+	 */
+	@Override
+	public Object[] getChildren() {
+		return new Object[0];
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.view.WrapperBase#hasChildren()
+	 */
+	@Override
+	public boolean hasChildren() {
+		return false;
+	}
+
+	/**
+	 * Returns the type. This never returns null
+	 * 
+	 * @return the property type
+	 */
+	String getType() {
+		String ret;
+		if (type == null) {
+			ret = ""; //$NON-NLS-1$
+		} else {
+			ret = type;
+		}
+		return ret;
+	}
+
+	/**
+	 * Returns the property. This never returns null
+	 * 
+	 * @return the property
+	 */
+	String getProperty() {
+		String ret;
+
+		if (type.equals(Messages.getString("TraceObjectWrapper.ModelID"))) { //$NON-NLS-1$
+			if (property == null || property.length() == 0
+					|| property.equals("0")) { //$NON-NLS-1$
+				if (TraceBuilderGlobals.getTraceModel().getName() == null
+						|| TraceBuilderGlobals.getTraceModel().getName()
+								.length() == 0) {
+					// TraceBuilder project is not open, show None as Project ID
+					// value.
+					String noProperty = Messages
+							.getString("PropertyWrapper.NoProperty"); //$NON-NLS-1$
+					ret = noProperty;
+				} else {
+					// If TraceBuilder project is open, but Project ID is, show
+					// Not available as Project ID value.
+					String notAvailable = Messages
+							.getString("PropertyWrapper.NotAvailable"); //$NON-NLS-1$
+					ret = notAvailable;
+				}
+
+			} else {
+				ret = property;
+			}
+		} else {
+			if (property == null || property.length() == 0) {
+				ret = Messages.getString("PropertyWrapper.NoProperty"); //$NON-NLS-1$
+			} else {
+				ret = property;
+			}
+		}
+
+		return ret;
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TemplateComboSelectionListener.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,258 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ * UI for property dialogs
+ *
+ */
+package com.nokia.tracebuilder.view;
+
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Combo;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialog;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate;
+import com.nokia.tracebuilder.engine.TraceParameterPropertyDialogTemplate;
+import com.nokia.tracebuilder.engine.TracePropertyDialogTemplate;
+import com.nokia.tracebuilder.engine.rules.PerformanceEventTemplate;
+import com.nokia.tracebuilder.engine.utils.TraceUtils;
+import com.nokia.tracebuilder.model.TraceModel;
+import com.nokia.tracebuilder.model.TraceObjectUtils;
+import com.nokia.tracebuilder.source.SourceContext;
+
+/**
+ * Selection listener for template combo box
+ * 
+ */
+final class TemplateComboSelectionListener implements SelectionListener {
+
+	/**
+	 * Dialog UI
+	 */
+	private final PropertyDialogUI dialogUI;
+
+	/**
+	 * Temporary storage for name
+	 */
+	private String tmpName;
+
+	/**
+	 * Temporary storage for value
+	 */
+	private String tmpValue;
+
+	/**
+	 * Temporary storage for target object
+	 */
+	private String tmpTarget;
+
+	/**
+	 * Temporary storage for type
+	 */
+	private String tmpType;
+
+	/**
+	 * Current selection
+	 */
+	private int selection = -1;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param dialogUI
+	 *            the dialog UI
+	 */
+	TemplateComboSelectionListener(PropertyDialogUI dialogUI) {
+		this.dialogUI = dialogUI;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.swt.events.SelectionListener#
+	 *      widgetSelected(org.eclipse.swt.events.SelectionEvent)
+	 */
+	public void widgetSelected(SelectionEvent e) {
+		templateSelected(((Combo) e.widget).getSelectionIndex());
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.swt.events.SelectionListener#
+	 *      widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
+	 */
+	public void widgetDefaultSelected(SelectionEvent e) {
+		widgetSelected(e);
+	}
+
+	/**
+	 * Selection event handler
+	 * 
+	 * @param newSelection
+	 *            the selected template index
+	 */
+	void templateSelected(int newSelection) {
+		int oldSelection = selection;
+		selection = newSelection;
+		if (selection != oldSelection) {
+			// User-defined values are stored
+			if (oldSelection == 0) {
+				storeSelection();
+			}
+			if (selection == 0) {
+				int dialogType = dialogUI.getUiType();
+				if (dialogType == TraceObjectPropertyDialog.ADD_TRACE) {
+					dialogUI.valueComposite.setLabel(Messages
+							.getString("PropertyDialogUI.AddTraceValueLabel")); //$NON-NLS-1$
+					dialogUI.valueComposite.getValueLabel().pack();
+				}
+				if (oldSelection >= 0) {
+					loadSelection();
+					dialogUI.notifyTemplateChanged(null);
+				}
+			} else {
+				TraceObjectPropertyDialogTemplate template = setFromTemplate();
+				dialogUI.notifyTemplateChanged(template);
+			}
+		} else {
+			// If same template is 'selected' the values are reset
+			if (selection > 0) {
+				setFromTemplate();
+			}
+		}
+	}
+
+	/**
+	 * Sets the values from selected template into the dialog
+	 * 
+	 * @return the selected template
+	 */
+	private TraceObjectPropertyDialogTemplate setFromTemplate() {
+		TraceObjectPropertyDialogTemplate template = dialogUI
+				.getTemplate(selection);
+		String name = template.getName();
+		if (name != null) {
+			dialogUI.setNameField(name);
+		}
+		int dialogType = dialogUI.getUiType();
+		if (dialogType == TraceObjectPropertyDialog.ADD_TRACE) {
+			if (template instanceof PerformanceEventTemplate) {
+				dialogUI.valueComposite.setLabel(Messages
+						.getString("PropertyDialogUI.AddTraceEventNameLabel")); //$NON-NLS-1$
+			} else {
+				dialogUI.valueComposite.setLabel(Messages
+						.getString("PropertyDialogUI.AddTraceValueLabel")); //$NON-NLS-1$
+			}
+			dialogUI.valueComposite.getValueLabel().pack();
+		}
+		if (template instanceof TraceParameterPropertyDialogTemplate) {
+			dialogUI.setType(((TraceParameterPropertyDialogTemplate) template)
+					.getType());
+		}
+		if (template instanceof TracePropertyDialogTemplate) {
+			// If the template is a trace property template, the target group
+			// name is passed to the template. The trace name is adjusted based
+			// on the target group
+			String groupName = ((TracePropertyDialogTemplate) template)
+					.getGroupName();
+			if (groupName == null) {
+				groupName = dialogUI.getTarget();
+			} else {
+				dialogUI.setTarget(groupName);
+			}
+			if (groupName != null) {
+				dialogUI.setValueField(((TracePropertyDialogTemplate) template)
+						.getText(groupName));
+			} else {
+				dialogUI.setValueField(template.getValue());
+			}
+		} else {
+			String value = template.getValue();
+			if (value != null) {
+				dialogUI.setValueField(value);
+			}
+		}
+		return template;
+	}
+
+	/**
+	 * Sets the values from the stored selection into the dialog
+	 */
+	private void loadSelection() {
+		String name = null;
+		String value = null;
+
+		// If tmpName or tmpValue is null and context is valid, the name and
+		// value proposal are based on context
+		if ((tmpName == null || tmpName == "") //$NON-NLS-1$
+				|| (tmpValue == null || tmpValue == "")) { //$NON-NLS-1$
+			SourceContext context = TraceBuilderGlobals
+					.getSourceContextManager().getContext();
+			if (context != null) {
+				String cname = context.getClassName();
+				String fname = context.getFunctionName();
+				name = TraceUtils.formatTrace(
+						TraceUtils.getDefaultNameFormat(), cname, fname);
+				TraceModel model = TraceBuilderGlobals.getTraceModel();
+				name = TraceObjectUtils.modifyDuplicateTraceName(model,
+						TraceUtils.convertName(name)).getData();
+				value = TraceUtils.formatTrace(TraceUtils
+						.getDefaultTraceFormat(), cname, fname);
+			}
+		}
+
+		if (tmpName != null && tmpName != "") { //$NON-NLS-1$
+			dialogUI.setNameField(tmpName);
+		} else {
+			if (name != null) {
+				dialogUI.setNameField(name);
+			} else {
+				dialogUI.setNameField(""); //$NON-NLS-1$
+			}
+		}
+		if (tmpValue != null && tmpValue != "") { //$NON-NLS-1$
+			dialogUI.setValueField(tmpValue);
+		} else {
+			if (value != null) {
+				dialogUI.setValueField(value);
+			} else {
+				dialogUI.setValueField(""); //$NON-NLS-1$
+			}
+		}
+		if (tmpType != null) {
+			dialogUI.setType(tmpType);
+		} else {
+			dialogUI.setType(""); //$NON-NLS-1$
+		}
+		if (tmpTarget != null) {
+			dialogUI.setTarget(tmpTarget);
+		} else {
+			dialogUI.setTarget(""); //$NON-NLS-1$
+		}
+	}
+
+	/**
+	 * Stores the current dialog values
+	 */
+	private void storeSelection() {
+		tmpTarget = dialogUI.getTarget();
+		tmpName = dialogUI.getNameField();
+		tmpValue = dialogUI.getValueField();
+		tmpType = dialogUI.getType();
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceContentProvider.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,399 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 tree viewer
+*
+*/
+package com.nokia.tracebuilder.view;
+
+import java.util.Iterator;
+
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+
+import com.nokia.tracebuilder.engine.LastKnownLocationList;
+import com.nokia.tracebuilder.engine.TraceBuilderConfiguration;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceLocationList;
+import com.nokia.tracebuilder.engine.TraceViewExtension;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceConstantTable;
+import com.nokia.tracebuilder.model.TraceConstantTableEntry;
+import com.nokia.tracebuilder.model.TraceGroup;
+import com.nokia.tracebuilder.model.TraceModel;
+import com.nokia.tracebuilder.model.TraceModelExtension;
+import com.nokia.tracebuilder.model.TraceModelExtensionListener;
+import com.nokia.tracebuilder.model.TraceModelListener;
+import com.nokia.tracebuilder.model.TraceModelResetListener;
+import com.nokia.tracebuilder.model.TraceObject;
+import com.nokia.tracebuilder.model.TraceParameter;
+import com.nokia.tracebuilder.rules.ArrayParameterRule;
+import com.nokia.tracebuilder.rules.HiddenTraceObjectRule;
+
+/**
+ * Content provider for tree viewer
+ * 
+ */
+final class TraceContentProvider implements ITreeContentProvider,
+		TraceModelListener, TraceModelResetListener,
+		TraceModelExtensionListener {
+
+	/**
+	 * Root wrapper for trace model
+	 */
+	private TraceModelWrapper modelWrapper;
+
+	/**
+	 * Thread that performs view updates
+	 */
+	private TraceViewUpdater updater;
+
+	/*
+	 * (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) {
+		// This is called when user navigates into a sub-tree of the viewer.
+		// However, the updater is created only once.
+		if (updater == null) {
+			TraceModel model = TraceBuilderGlobals.getTraceModel();
+			updater = new TraceViewUpdater((TreeViewer) viewer);
+			modelWrapper = new TraceModelWrapper(model, null, updater);
+			updater.setRoot(modelWrapper);
+			addListeners(model);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+	 */
+	public void dispose() {
+		if (updater != null) {
+			updater.stopUpdater();
+			updater = null;
+		}
+		if (modelWrapper != null) {
+			removeListeners();
+			modelWrapper.delete();
+			modelWrapper = null;
+		}
+	}
+
+	/**
+	 * Adds listeners to the model
+	 * 
+	 * @param model
+	 *            the model
+	 */
+	private void addListeners(TraceModel model) {
+		model.addModelListener(this);
+		model.addExtensionListener(this);
+		model.addResetListener(this);
+	}
+
+	/**
+	 * Removes the model listeners
+	 */
+	private void removeListeners() {
+		TraceModel model = (TraceModel) modelWrapper.getTraceObject();
+		model.removeModelListener(this);
+		model.removeExtensionListener(this);
+		model.removeResetListener(this);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
+	 */
+	public Object getParent(Object child) {
+		return ((WrapperBase) child).getParent();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
+	 */
+	public boolean hasChildren(Object parent) {
+		return ((WrapperBase) parent).hasChildren();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+	 */
+	public Object[] getElements(Object parent) {
+		Object[] ret;
+		// If the tree is navigated into a sub-element, the parent will be an
+		// instance of WrapperBase
+		if (parent instanceof WrapperBase) {
+			ret = getChildren(parent);
+		} else {
+			ret = modelWrapper.getChildren();
+		}
+		return ret;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
+	 */
+	public Object[] getChildren(Object parent) {
+		return ((WrapperBase) parent).getChildren();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelResetListener#modelResetting()
+	 */
+	public void modelResetting() {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelResetListener#modelReset()
+	 */
+	public void modelReset() {
+		modelWrapper.modelReset();
+		refreshView(modelWrapper);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelResetListener#modelValid(boolean)
+	 */
+	public void modelValid(boolean valid) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelListener#
+	 *      objectAdded(com.nokia.tracebuilder.model.TraceObject,
+	 *      com.nokia.tracebuilder.model.TraceObject)
+	 */
+	public void objectAdded(TraceObject owner, TraceObject object) {
+		WrapperBase wrapper = null;
+		if (object instanceof TraceGroup) {
+			wrapper = modelWrapper.addGroup((TraceGroup) object);
+		} else if (object instanceof Trace) {
+			TraceGroupWrapper groupWrapper = owner
+					.getExtension(TraceGroupWrapper.class);
+			wrapper = groupWrapper.addTrace((Trace) object);
+		} else if (object instanceof TraceParameter) {
+			TraceWrapper objectWrapper = owner.getExtension(TraceWrapper.class);
+			wrapper = objectWrapper.addParameter((TraceParameter) object);
+		} else if (object instanceof TraceConstantTable) {
+			// Constant tables are added to the model and to the parameters
+			// referencing the tables. The parameter wrapper takes care of the
+			// reference
+			wrapper = modelWrapper
+					.addConstantTable((TraceConstantTable) object);
+		} else if (object instanceof TraceConstantTableEntry) {
+			// Constant tables are referenced from multiple parameters and the
+			// list of constant tables stored into the model wrapper. Thus
+			// getExtensions needs to be used
+			Iterator<ConstantTableWrapper> itr = owner
+					.getExtensions(ConstantTableWrapper.class);
+			while (itr.hasNext()) {
+				refreshView(itr.next().addConstantTableEntry(
+						(TraceConstantTableEntry) object));
+			}
+		}
+		if (wrapper != null) {
+			refreshView(wrapper);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelListener#
+	 *      objectRemoved(com.nokia.tracebuilder.model.TraceObject,
+	 *      com.nokia.tracebuilder.model.TraceObject)
+	 */
+	public void objectRemoved(TraceObject owner, TraceObject object) {
+		WrapperBase wrapper = null;
+		if (object instanceof TraceGroup) {
+			wrapper = modelWrapper.removeGroup((TraceGroup) object);
+		} else if (object instanceof Trace) {
+			TraceGroupWrapper groupWrapper = owner
+					.getExtension(TraceGroupWrapper.class);
+			wrapper = groupWrapper.removeTrace((Trace) object);
+		} else if (object instanceof TraceParameter) {
+			TraceWrapper objectWrapper = owner.getExtension(TraceWrapper.class);
+			wrapper = objectWrapper.removeParameter((TraceParameter) object);
+		} else if (object instanceof TraceConstantTable) {
+			wrapper = modelWrapper
+					.removeConstantTable((TraceConstantTable) object);
+		} else if (object instanceof TraceConstantTableEntry) {
+			// Constant tables are referenced from multiple parameters and the
+			// list of constant tables stored into the model wrapper. Thus
+			// getExtensions needs to be used
+			Iterator<ConstantTableWrapper> itr = owner
+					.getExtensions(ConstantTableWrapper.class);
+			while (itr.hasNext()) {
+				refreshView(itr.next().removeConstantTableEntry(
+						(TraceConstantTableEntry) object));
+			}
+		}
+		if (wrapper != null) {
+			refreshView(wrapper);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelListener#
+	 *      objectCreationComplete(com.nokia.tracebuilder.model.TraceObject)
+	 */
+	public void objectCreationComplete(TraceObject object) {
+		// Not interested, since all individual additions and updates are
+		// monitored. TraceViewUpdater takes care of the optimizations if there
+		// are lots of sequential updates
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelListener#
+	 *      propertiesUpdated(com.nokia.tracebuilder.model.TraceObject)
+	 */
+	public void propertyUpdated(TraceObject object, int property) {
+		Iterator<TraceObjectWrapper> itr = object
+				.getExtensions(TraceObjectWrapper.class);
+		while (itr.hasNext()) {
+			refreshView(itr.next().refreshProperty(property));
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelExtensionListener#
+	 *      extensionAdded(com.nokia.tracebuilder.model.TraceObject,
+	 *      com.nokia.tracebuilder.model.TraceModelExtension)
+	 */
+	public void extensionAdded(TraceObject object, TraceModelExtension extension) {
+		// Location lists and locations have their own listeners, which are
+		// used for update notifications
+		if (extension instanceof TraceLocationList) {
+			if (object instanceof Trace) {
+				TraceWrapper traceWrapper = object
+						.getExtension(TraceWrapper.class);
+				refreshView(traceWrapper
+						.setLocationList((TraceLocationList) extension));
+			} else if (object instanceof TraceModel) {
+				refreshView(modelWrapper
+						.addLocationList((TraceLocationList) extension));
+			}
+		} else if (extension instanceof LastKnownLocationList) {
+			TraceWrapper traceWrapper = object.getExtension(TraceWrapper.class);
+			refreshView(traceWrapper
+					.setLastKnownLocationList((LastKnownLocationList) extension));
+		} else if (extension instanceof TraceViewExtension) {
+			TraceObjectWrapper objectWrapper = object
+					.getExtension(TraceObjectWrapper.class);
+			refreshView(objectWrapper
+					.addExtension((TraceViewExtension) extension));
+		} else if (extension instanceof HiddenTraceObjectRule) {
+			if (!TraceBuilderConfiguration.SHOW_HIDDEN_PARAMETERS_IN_VIEW) {
+				TraceObjectWrapper objectWrapper = object
+						.getExtension(TraceObjectWrapper.class);
+				refreshView(objectWrapper.hideFromView());
+			}
+		} else if (extension instanceof ArrayParameterRule) {
+			TraceObjectWrapper objectWrapper = object
+					.getExtension(TraceObjectWrapper.class);
+			if (objectWrapper instanceof TraceParameterWrapper) {
+				refreshView(((TraceParameterWrapper) objectWrapper)
+						.setArrayType(true));
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelExtensionListener#
+	 *      extensionRemoved(com.nokia.tracebuilder.model.TraceObject,
+	 *      com.nokia.tracebuilder.model.TraceModelExtension)
+	 */
+	public void extensionRemoved(TraceObject object,
+			TraceModelExtension extension) {
+		if (extension instanceof TraceLocationList) {
+			if (object instanceof Trace) {
+				TraceWrapper traceWrapper = object
+						.getExtension(TraceWrapper.class);
+				refreshView(traceWrapper.setLocationList(null));
+			} else if (object instanceof TraceModel) {
+				refreshView(modelWrapper
+						.removeLocationList((TraceLocationList) extension));
+			}
+		} else if (extension instanceof LastKnownLocationList) {
+			TraceWrapper traceWrapper = object.getExtension(TraceWrapper.class);
+			refreshView(traceWrapper.setLastKnownLocationList(null));
+		} else if (extension instanceof TraceViewExtension) {
+			TraceObjectWrapper objectWrapper = object
+					.getExtension(TraceObjectWrapper.class);
+			refreshView(objectWrapper
+					.removeExtension((TraceViewExtension) extension));
+		} else if (extension instanceof ArrayParameterRule) {
+			TraceObjectWrapper objectWrapper = object
+					.getExtension(TraceObjectWrapper.class);
+			if (objectWrapper instanceof TraceParameterWrapper) {
+				refreshView(((TraceParameterWrapper) objectWrapper)
+						.setArrayType(false));
+			}
+		}
+	}
+
+	/**
+	 * Refreshes the view
+	 * 
+	 * @param wrapper
+	 *            the wrapper that needs to be updated
+	 */
+	private void refreshView(WrapperBase wrapper) {
+		if (wrapper != null) {
+			updater.queueUpdate(wrapper);
+		}
+	}
+
+	/**
+	 * Dumps the model to System.out
+	 * 
+	 * @param labelProvider
+	 *            the label provider for objects
+	 */
+	void dumpToSystemOut(TraceLabelProvider labelProvider) {
+		if (TraceBuilderConfiguration.TRACE_VIEW_STATE) {
+			modelWrapper.dumpToSystemOut(0, labelProvider);
+		}
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceGroupListWrapper.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Wrapper for a list of trace groups
+*
+*/
+package com.nokia.tracebuilder.view;
+
+import com.nokia.tracebuilder.model.TraceGroup;
+import com.nokia.tracebuilder.model.TraceModel;
+
+/**
+ * Wrapper for a list of trace groups
+ * 
+ */
+final class TraceGroupListWrapper extends TraceObjectListWrapper {
+
+	/**
+	 * Creates a new wrapper
+	 * 
+	 * @param model
+	 *            trace model
+	 * @param parent
+	 *            parent wrapper
+	 * @param updater
+	 *            the update notifier
+	 */
+	TraceGroupListWrapper(TraceModel model, WrapperBase parent,
+			WrapperUpdater updater) {
+		super(parent, updater);
+		for (TraceGroup group : model) {
+			addGroup(group);
+		}
+	}
+
+	/**
+	 * Adds a new trace group
+	 * 
+	 * @param group
+	 *            the group to be added
+	 * @return the wrapper which needs to be refreshed
+	 */
+	WrapperBase addGroup(TraceGroup group) {
+		add(new TraceGroupWrapper(group, this, getUpdater()));
+		return this;
+	}
+
+	/**
+	 * Removes a trace group
+	 * 
+	 * @param group
+	 *            the group to be removed
+	 * @return the wrapper which needs to be refreshed
+	 */
+	WrapperBase removeGroup(TraceGroup group) {
+		remove(group.getExtension(TraceGroupWrapper.class));
+		return this;
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceGroupWrapper.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Wrapper for one trace group
+*
+*/
+package com.nokia.tracebuilder.view;
+
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceGroup;
+
+/**
+ * Wrapper for one trace group
+ * 
+ * @see com.nokia.tracebuilder.model.TraceGroup
+ */
+final class TraceGroupWrapper extends TraceObjectWrapper {
+
+	/**
+	 * List of traces
+	 */
+	private TraceListWrapper traceListWrapper;
+
+	/**
+	 * Wrapper constructor
+	 * 
+	 * @param group
+	 *            the trace group
+	 * @param parent
+	 *            parent wrapper
+	 * @param updater
+	 *            the update notifier
+	 */
+	public TraceGroupWrapper(TraceGroup group, WrapperBase parent,
+			WrapperUpdater updater) {
+		super(group, parent, updater);
+		traceListWrapper = new TraceListWrapper(group, this, updater);
+		if (traceListWrapper.hasChildren()) {
+			add(traceListWrapper);
+		}
+	}
+
+	/**
+	 * Adds a trace to this group
+	 * 
+	 * @param trace
+	 *            the trace to be added
+	 * @return the wrapper which needs to be refreshed
+	 */
+	public WrapperBase addTrace(Trace trace) {
+		WrapperBase wrapper;
+		if (traceListWrapper.hasChildren()) {
+			wrapper = traceListWrapper.addTrace(trace);
+		} else {
+			traceListWrapper.addTrace(trace);
+			add(traceListWrapper);
+			wrapper = this;
+		}
+		return wrapper;
+	}
+
+	/**
+	 * Removes a trace
+	 * 
+	 * @param trace
+	 *            the trace to be removed
+	 * @return the wrapper which needs to be refreshed
+	 */
+	public WrapperBase removeTrace(Trace trace) {
+		WrapperBase wrapper = traceListWrapper.removeTrace(trace);
+		if (!traceListWrapper.hasChildren()) {
+			hide(traceListWrapper);
+			wrapper = this;
+		}
+		return wrapper;
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceLabelProvider.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,712 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Converts tree model objects to strings to be displayed in the view
+*
+*/
+package com.nokia.tracebuilder.view;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin;
+import com.nokia.tracebuilder.engine.LastKnownLocation;
+import com.nokia.tracebuilder.engine.TraceBuilderConfiguration;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceLocation;
+import com.nokia.tracebuilder.engine.TraceLocationList;
+import com.nokia.tracebuilder.engine.TraceViewNameExtension;
+import com.nokia.tracebuilder.file.FileUtils;
+import com.nokia.tracebuilder.model.TraceConstantTableEntry;
+import com.nokia.tracebuilder.model.TraceObject;
+import com.nokia.tracebuilder.model.TraceParameter;
+
+/**
+ * Converts tree model objects to strings to be displayed in the view
+ * 
+ */
+final class TraceLabelProvider extends LabelProvider {
+
+	/**
+	 * Separator to component name and component id fields
+	 */
+	final String COMPONENT_SEPARATOR = ", "; //$NON-NLS-1$	
+
+	/**
+	 * Default tree node image
+	 */
+	private Image defaultImage;
+
+	/**
+	 * Image for trace
+	 */
+	private Image traceImage;
+
+	/**
+	 * Image for trace group
+	 */
+	private Image groupImage;
+
+	/**
+	 * Image for parameter
+	 */
+	private Image parameterImage;
+
+	/**
+	 * Image for property
+	 */
+	private Image propertyImage;
+
+	/**
+	 * Unrelated location icon
+	 */
+	private Image unrelatedLocationImage;
+
+	/**
+	 * Unrelated locations list icon
+	 */
+	private Image unrelatedLocationsImage;
+
+	/**
+	 * List navigator image
+	 */
+	private Image navigatorImage;
+
+	/**
+	 * Constructor
+	 */
+	public TraceLabelProvider() {
+		defaultImage = TraceViewPlugin.getImageDescriptor(
+				"icons/view/default.gif").createImage(); //$NON-NLS-1$
+		traceImage = TraceViewPlugin
+				.getImageDescriptor("icons/view/trace.gif").createImage(); //$NON-NLS-1$
+		groupImage = TraceViewPlugin
+				.getImageDescriptor("icons/view/group.gif").createImage(); //$NON-NLS-1$
+		parameterImage = TraceViewPlugin.getImageDescriptor(
+				"icons/view/parameter.gif").createImage(); //$NON-NLS-1$
+		propertyImage = TraceViewPlugin.getImageDescriptor(
+				"icons/view/property.gif").createImage(); //$NON-NLS-1$
+		unrelatedLocationImage = TraceViewPlugin.getImageDescriptor(
+				"icons/view/unrelated_location.gif").createImage(); //$NON-NLS-1$
+		unrelatedLocationsImage = TraceViewPlugin.getImageDescriptor(
+				"icons/view/unrelated_locations_list.gif").createImage(); //$NON-NLS-1$
+		navigatorImage = TraceViewPlugin.getImageDescriptor(
+				"icons/view/navigator.gif").createImage(); //$NON-NLS-1$
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
+	 */
+	@Override
+	public void dispose() {
+		defaultImage.dispose();
+		traceImage.dispose();
+		groupImage.dispose();
+		parameterImage.dispose();
+		propertyImage.dispose();
+		unrelatedLocationImage.dispose();
+		unrelatedLocationsImage.dispose();
+		navigatorImage.dispose();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
+	 */
+	@Override
+	public String getText(Object obj) {
+		String text;
+		if (obj instanceof TraceLocationWrapper) {
+			text = traceLocationWrapperToString((TraceLocationWrapper) obj);
+		} else if (obj instanceof PropertyWrapper) {
+			text = propertyWrapperToString((PropertyWrapper) obj);
+		} else if (obj instanceof TraceObjectWrapper) {
+			text = traceObjectWrapperToString((TraceObjectWrapper) obj);
+		} else if (obj instanceof LastKnownLocationWrapper) {
+			text = LastKnownLocationWrapperToString((LastKnownLocationWrapper) obj);
+		} else if (obj instanceof TraceLocationListWrapper) {
+			text = locationListWrapperToString((TraceLocationListWrapper) obj);
+		} else if (obj instanceof LastKnownLocationListWrapper) {
+			text = LastKnownLocationListWrapperToString((LastKnownLocationListWrapper) obj);
+		} else if (obj instanceof ObjectWrapper) {
+			text = ((ObjectWrapper) obj).getObject().toString();
+		} else if (obj instanceof ListNavigator) {
+			text = listNavigatorToString((ListNavigator) obj);
+		} else if (obj instanceof TraceViewExtensionWrapper) {
+			text = ((TraceViewExtensionWrapper) obj).getExtension().toString();
+		} else if (obj instanceof TraceParameterListWrapper) {
+			text = Messages.getString("TraceLabelProvider.Parameters"); //$NON-NLS-1$
+		} else if (obj instanceof TraceGroupListWrapper) {
+			text = Messages.getString("TraceLabelProvider.TraceGroups"); //$NON-NLS-1$
+		} else if (obj instanceof TraceListWrapper) {
+			text = Messages.getString("TraceLabelProvider.Traces"); //$NON-NLS-1$
+		} else if (obj instanceof ConstantTableListWrapper) {
+			text = Messages.getString("TraceLabelProvider.ConstantTables"); //$NON-NLS-1$
+		} else if (obj instanceof TraceLocationListsWrapper) {
+			text = Messages.getString("TraceLabelProvider.LocationListsTitle"); //$NON-NLS-1$
+		} else {
+			text = obj.toString();
+		}
+		return text;
+	}
+
+	/**
+	 * Converts the list navigator to string
+	 * 
+	 * @param navigator
+	 *            the list navigator
+	 * @return the string representation
+	 */
+	private String listNavigatorToString(ListNavigator navigator) {
+		StringBuffer text = new StringBuffer();
+		String start;
+		String end;
+		WrapperBase parent = navigator.getParent();
+		if (parent instanceof TraceListWrapper) {
+			start = Messages
+					.getString("TraceLabelProvider.NavigatorTitleStartTraces"); //$NON-NLS-1$
+			end = Messages
+					.getString("TraceLabelProvider.NavigatorTitleEndTraces"); //$NON-NLS-1$
+		} else if (parent instanceof TraceGroupListWrapper) {
+			start = Messages
+					.getString("TraceLabelProvider.NavigatorTitleStartGroups"); //$NON-NLS-1$
+			end = Messages
+					.getString("TraceLabelProvider.NavigatorTitleEndGroups"); //$NON-NLS-1$
+		} else if (parent instanceof TraceLocationListWrapper) {
+			start = Messages
+					.getString("TraceLabelProvider.NavigatorTitleStartLocations"); //$NON-NLS-1$
+			end = Messages
+					.getString("TraceLabelProvider.NavigatorTitleEndLocations"); //$NON-NLS-1$
+		} else {
+			start = null;
+			end = null;
+			text.append(Messages
+					.getString("TraceLabelProvider.NavigatorTitleInvalid")); //$NON-NLS-1$
+		}
+		if (start != null) {
+			String separator = Messages
+					.getString("TraceLabelProvider.NavigatorTitleValueSeparator"); //$NON-NLS-1$
+			text.append(start);
+			text.append(navigator.getStartIndex());
+			text.append(separator);
+			int max = navigator.getStartIndex() + navigator.getVisibleCount();
+			text.append(max);
+			separator = Messages
+					.getString("TraceLabelProvider.NavigatorTitleTotalCountSeparator"); //$NON-NLS-1$
+			text.append(separator);
+			text.append(navigator.getTotalCount());
+			text.append(end);
+		}
+		return text.toString();
+	}
+
+	/**
+	 * Converts a property wrapper to string
+	 * 
+	 * @param wrapper
+	 *            the property wrapper
+	 * @return the string representation
+	 */
+	private String propertyWrapperToString(PropertyWrapper wrapper) {
+		String text = null;
+		// Get component id's from mmp files
+		if (wrapper.getType().equals(
+				Messages.getString("TraceObjectWrapper.ModelID"))) { //$NON-NLS-1$
+			text = getComponentIdString(wrapper.getType());
+			// Get component names from mmp files
+		} else if (wrapper.getType().equals(
+				Messages.getString("TraceObjectWrapper.ModelName"))) { //$NON-NLS-1$
+			text = getComponentNameString(wrapper.getType());
+		} else {
+			text = wrapper.getType()
+					+ Messages
+							.getString("TraceLabelProvider.PropertySeparator") //$NON-NLS-1$
+					+ wrapper.getProperty();
+		}
+
+		return text;
+	}
+
+	/**
+	 * Get component name string
+	 * 
+	 * @param prefix
+	 *            prefix text
+	 * @return the component name string
+	 */
+	private String getComponentNameString(String prefix) {
+		IFile file = getActiveFile();
+		String propertySeparator = Messages
+				.getString("TraceLabelProvider.PropertySeparator"); //$NON-NLS-1$
+		
+		// Set default text in case that component name is not available
+		String text = prefix + propertySeparator
+		+ Messages.getString("PropertyWrapper.NoProperty"); //$NON-NLS-1$;
+		if (file != null) {
+			IProject project = file.getProject();
+
+			// Check that project is Carbide project
+			boolean isCarbideProject = CarbideBuilderPlugin.getBuildManager()
+					.isCarbideProject(project);
+			if (isCarbideProject) {
+
+				// Check if file is not source file
+				if (isSourceFile(file)) {
+					String componentNameString = TraceBuilderGlobals
+							.getCurrentSoftwareComponentName();
+					if (componentNameString != null) {
+						text = prefix + propertySeparator + componentNameString;
+					}
+				}
+
+				// Even file is source file it could be that we do know
+				// component name, because it could be that file is not included
+				// to MMP file
+				if (text == null) {
+					text = prefix
+							+ propertySeparator
+							+ Messages
+									.getString("PropertyWrapper.NotAvailable"); //$NON-NLS-1$;
+				}
+			}
+		}
+		return text;
+	}
+
+	/**
+	 * Get active file in editor
+	 * 
+	 * @return the active file in editor
+	 */
+	private IFile getActiveFile() {
+
+		IFile file = null;
+
+		IWorkbenchWindow window = PlatformUI.getWorkbench()
+				.getActiveWorkbenchWindow();
+		if (window != null) {
+			IWorkbenchPage page = window.getActivePage();
+			if (page != null) {
+				IEditorPart editor = page.getActiveEditor();
+				if (editor != null) {
+					IEditorInput input = editor.getEditorInput();
+					if (input instanceof IFileEditorInput) {
+						file = ((IFileEditorInput) input).getFile();
+					}
+				}
+			}
+		}
+
+		return file;
+	}
+
+	/**
+	 * Get component id string
+	 * 
+	 * @param prefix
+	 *            prefix text
+	 * @return the component id string
+	 */
+	private String getComponentIdString(String prefix) {
+		IFile file = getActiveFile();
+		String propertySeparator = Messages
+				.getString("TraceLabelProvider.PropertySeparator"); //$NON-NLS-1$
+
+		// Set default text in case that component ID is not available
+		String text = prefix + propertySeparator
+		+ Messages.getString("PropertyWrapper.NoProperty"); //$NON-NLS-1$;;		
+		
+		if (file != null) {
+			IProject project = file.getProject();
+
+			// Check that project is Carbide project
+			boolean isCarbideProject = CarbideBuilderPlugin.getBuildManager()
+					.isCarbideProject(project);
+			if (isCarbideProject) {
+
+				// Check if file is not source file
+				if (isSourceFile(file)) {
+					String uidString = TraceBuilderGlobals
+							.getCurrentSoftwareComponentId();
+					if (uidString != null) {
+						text = prefix + propertySeparator + uidString;
+					}
+				}
+
+				// Even file is source file it could be that we do know
+				// component id, because it could be that file is not included
+				// to MMP file
+				if (text == null) {
+					text = prefix
+							+ propertySeparator
+							+ Messages
+									.getString("PropertyWrapper.NotAvailable"); //$NON-NLS-1$;
+				}
+			}
+		}
+		
+		return text; // CodForChk_Dis_Exits
+	}
+
+	/**
+	 * Converts a trace object wrapper to string
+	 * 
+	 * @param obj
+	 *            the object wrapper
+	 * @return the string representation
+	 */
+	private String traceObjectWrapperToString(TraceObjectWrapper obj) {
+		String text;
+		if (obj instanceof ConstantTableWrapper) {
+			text = constantTableWrapperToString((ConstantTableWrapper) obj);
+		} else if (obj instanceof ConstantTableEntryWrapper) {
+			text = constantTableEntryWrapperToString((ConstantTableEntryWrapper) obj);
+		} else if (obj instanceof TraceParameterWrapper) {
+			text = traceParameterWrapperToString((TraceParameterWrapper) obj);
+		} else {
+			text = commonTraceObjectWrapperToString(obj);
+		}
+		return text;
+	}
+
+	/**
+	 * Converts a parameter wrapper to a string
+	 * 
+	 * @param wrapper
+	 *            the parameter wrapper
+	 * @return the string representation
+	 */
+	private String traceParameterWrapperToString(TraceParameterWrapper wrapper) {
+		String text = commonTraceObjectWrapperToString(wrapper);
+		text += Messages.getString("TraceLabelProvider.ParameterTypeSeparator") //$NON-NLS-1$
+				+ TraceViewMessages
+						.parameterTypeToString((TraceParameter) wrapper
+								.getTraceObject());
+		if (wrapper.isArrayType()) {
+			text += Messages.getString("TraceParameterWrapper.ArrayTag"); //$NON-NLS-1$
+		}
+		return text;
+	}
+
+	/**
+	 * Converts a trace object wrapper to string
+	 * 
+	 * @param wrapper
+	 *            the trace object wrapper
+	 * @return the string representation
+	 */
+	private String commonTraceObjectWrapperToString(TraceObjectWrapper wrapper) {
+		String text = null;
+		TraceObject object = wrapper.getTraceObject();
+		// If object is null, it has been deleted but view is not refreshed yet
+		if (object != null) {
+			String name = object.getName();
+			if (name.length() > 0) {
+				TraceViewNameExtension nameExt = wrapper.getTraceObject()
+						.getExtension(TraceViewNameExtension.class);
+				if (nameExt != null) {
+					text = nameExtensionToString(name, nameExt);
+				} else {
+					text = name;
+				}
+			}
+		}
+		if (text == null) {
+			text = Messages.getString("TraceLabelProvider.Unnamed"); //$NON-NLS-1$
+		}
+		return text;
+	}
+
+	/**
+	 * Merges a name and name extension together
+	 * 
+	 * @param name
+	 *            the object name
+	 * @param nameExt
+	 *            the name extension
+	 * @return the merged name
+	 */
+	private String nameExtensionToString(String name,
+			TraceViewNameExtension nameExt) {
+		StringBuffer text = new StringBuffer();
+		text.append(name);
+		text.append(Messages
+				.getString("TraceLabelProvider.NameExtensionPrefix")); //$NON-NLS-1$
+		text.append(nameExt.getNameExtension());
+		text.append(Messages
+				.getString("TraceLabelProvider.NameExtensionPostfix")); //$NON-NLS-1$
+		return text.toString();
+	}
+
+	/**
+	 * Converts a constant table entry wrapper to string
+	 * 
+	 * @param wrapper
+	 *            the constant table entry wrapper
+	 * @return the string representation
+	 */
+	private String constantTableEntryWrapperToString(
+			ConstantTableEntryWrapper wrapper) {
+		String text;
+		// Constant table entry wrappers extend TraceObjectWrapper, but
+		// representation is different
+		TraceConstantTableEntry entry = (TraceConstantTableEntry) wrapper
+				.getTraceObject();
+		if (entry != null) {
+			StringBuffer sb = new StringBuffer();
+			sb.append(entry.getID());
+			sb.append(Messages
+					.getString("TraceLabelProvider.ConstantValueSeparator")); //$NON-NLS-1$
+			sb.append(entry.getName());
+			text = sb.toString();
+		} else {
+			text = Messages.getString("TraceLabelProvider.Unnamed"); //$NON-NLS-1$
+		}
+		return text;
+	}
+
+	/**
+	 * Converts a constant table wrapper to string
+	 * 
+	 * @param wrapper
+	 *            the constant table wrapper
+	 * @return the string representation
+	 */
+	private String constantTableWrapperToString(ConstantTableWrapper wrapper) {
+		String text = null;
+		TraceObject object = wrapper.getTraceObject();
+		if (object != null) {
+			String name = object.getName();
+			if (name != null && name.length() > 0) {
+				text = createConstantTableName(wrapper, name);
+			}
+		}
+		if (text == null) {
+			text = Messages.getString("TraceLabelProvider.Unnamed"); //$NON-NLS-1$
+		}
+		return text;
+	}
+
+	/**
+	 * Creates a constant table name
+	 * 
+	 * @param wrapper
+	 *            the constant table
+	 * @param name
+	 *            the original table name
+	 * @return the name shown in view
+	 */
+	private String createConstantTableName(ConstantTableWrapper wrapper,
+			String name) {
+		String text;
+		StringBuffer sb = new StringBuffer();
+		// Constant tables in the model's list of tables do not need
+		// the "Type: " tag
+		if (!(wrapper.getParent() instanceof ConstantTableListWrapper)) {
+			sb.append(Messages
+					.getString("TraceLabelProvider.ConstantTableNameTypeTag")); //$NON-NLS-1$
+		}
+		sb.append(Messages
+				.getString("TraceLabelProvider.ConstantTableNamePrefix")); //$NON-NLS-1$
+		sb.append(name);
+		sb.append(Messages
+				.getString("TraceLabelProvider.ConstantTableNamePostfix")); //$NON-NLS-1$
+		text = sb.toString();
+		return text;
+	}
+
+	/**
+	 * Converts a location list wrapper to string
+	 * 
+	 * @param wrapper
+	 *            the location list wrapper
+	 * @return the string representation
+	 */
+	private String locationListWrapperToString(TraceLocationListWrapper wrapper) {
+		String text;
+		WrapperBase parent = wrapper.getParent();
+		if (parent instanceof TraceWrapper) {
+			text = Messages.getString("TraceLabelProvider.Locations"); //$NON-NLS-1$
+		} else {
+			text = wrapper.getLocationList().getListTitle();
+			if (text == null) {
+				text = Messages
+						.getString("TraceLabelProvider.UnrelatedLocations"); //$NON-NLS-1$
+			}
+		}
+		return text;
+	}
+
+	/**
+	 * Converts a last known location list wrapper to string
+	 * 
+	 * @param wrapper
+	 *            the location list wrapper
+	 * @return the string representation
+	 */
+	private String LastKnownLocationListWrapperToString(
+			LastKnownLocationListWrapper wrapper) {
+		return Messages.getString("TraceLabelProvider.LastKnownLocations"); //$NON-NLS-1$
+	}
+
+	/**
+	 * Converts a location wrapper to string
+	 * 
+	 * @param wrapper
+	 *            the location wrapper
+	 * @return the string representation
+	 */
+	private String traceLocationWrapperToString(TraceLocationWrapper wrapper) {
+		String text = null;
+		TraceLocation loc = wrapper.getLocation();
+		if (loc != null) {
+			StringBuffer sb = new StringBuffer();
+			if (loc.getTrace() == null) {
+				sb.append(loc.getFileName());
+				sb.append(Messages
+						.getString("TraceLabelProvider.FileLineSeparator")); //$NON-NLS-1$
+				sb.append(loc.getLineNumber());
+				sb.append(Messages
+						.getString("TraceLabelProvider.LocationNameStart")); //$NON-NLS-1$
+				sb.append(loc.getOriginalName());
+				sb.append(Messages
+						.getString("TraceLabelProvider.LocationNameEnd")); //$NON-NLS-1$
+			} else {
+				sb.append(loc.getFileName());
+				sb.append(Messages
+						.getString("TraceLabelProvider.FileLineSeparator")); //$NON-NLS-1$
+				sb.append(loc.getLineNumber());
+			}
+			if (TraceBuilderConfiguration.SHOW_LOCATION_TAG_IN_VIEW) {
+				sb.append(" ["); //$NON-NLS-1$
+				sb.append(loc.getTag());
+				sb.append("]"); //$NON-NLS-1$
+			}
+			text = sb.toString();
+		}
+		if (text == null) {
+			text = Messages.getString("TraceLabelProvider.Unnamed"); //$NON-NLS-1$
+		}
+		return text;
+	}
+
+	/**
+	 * Converts a last known location wrapper to string
+	 * 
+	 * @param wrapper
+	 *            the location wrapper
+	 * @return the string representation
+	 */
+	private String LastKnownLocationWrapperToString(
+			LastKnownLocationWrapper wrapper) {
+		String text = null;
+		LastKnownLocation loc = wrapper.getLocation();
+		if (loc != null) {
+			StringBuffer sb = new StringBuffer();
+			sb.append(loc.getFileName());
+			sb.append(Messages
+					.getString("TraceLabelProvider.FileLineSeparator")); //$NON-NLS-1$
+			sb.append(loc.getLineNumber());
+			String start = Messages
+					.getString("TraceLabelProvider.LocationNameSeparatorStart"); //$NON-NLS-1$
+			sb.append(start);
+			sb.append(loc.getFilePath());
+			sb.append(Messages
+					.getString("TraceLabelProvider.LocationNameSeparatorEnd")); //$NON-NLS-1$
+			text = sb.toString();
+		}
+		if (text == null) {
+			text = Messages.getString("TraceLabelProvider.Unnamed"); //$NON-NLS-1$
+		}
+		return text;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
+	 */
+	@Override
+	public Image getImage(Object element) {
+		Image retval = defaultImage;
+		if (element instanceof TraceLocationWrapper) {
+			TraceLocation loc = ((TraceLocationWrapper) element).getLocation();
+			if (loc != null && loc.getTrace() == null) {
+				TraceLocationList list = loc.getLocationList();
+				if (list != null) {
+					String text = list.getListTitle();
+					if (text == null) {
+						retval = unrelatedLocationImage;
+					}
+				}
+			}
+		} else if (element instanceof TraceLocationListWrapper) {
+			WrapperBase parent = ((WrapperBase) element).getParent();
+			if (!(parent instanceof TraceWrapper)) {
+				TraceLocationList list = ((TraceLocationListWrapper) element)
+						.getLocationList();
+				if (list != null) {
+					String text = list.getListTitle();
+					if (text == null) {
+						retval = unrelatedLocationsImage;
+					}
+				}
+			}
+		} else if (element instanceof TraceWrapper) {
+			retval = traceImage;
+		} else if (element instanceof TraceGroupWrapper) {
+			retval = groupImage;
+		} else if (element instanceof TraceParameterWrapper) {
+			retval = parameterImage;
+		} else if (element instanceof PropertyWrapper) {
+			retval = propertyImage;
+		} else if (element instanceof ListNavigator) {
+			retval = navigatorImage;
+		}
+		return retval;
+	}
+
+	/**
+	 * Check that is file source file
+	 * 
+	 * @param file
+	 *            file that need to be check
+	 * @return true if file is source file, false if not
+	 */
+	private boolean isSourceFile(IFile file) {
+		boolean retVal = false;
+
+		String extension = file.getFileExtension();
+
+		if (extension != null
+				&& (extension.equalsIgnoreCase(FileUtils.CPP_EXTENSION) || extension
+						.equalsIgnoreCase(FileUtils.C_EXTENSION))) {
+			retVal = true;
+		}
+		return retVal;
+	}	
+	
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceListWrapper.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,74 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Wrapper for list of traces
+*
+*/
+package com.nokia.tracebuilder.view;
+
+import java.util.Iterator;
+
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceGroup;
+
+/**
+ * Wrapper for list of traces
+ * 
+ */
+final class TraceListWrapper extends TraceObjectListWrapper {
+
+	/**
+	 * Constructor.
+	 * 
+	 * @param group
+	 *            the owning trace group
+	 * @param parent
+	 *            the parent wrapper
+	 * @param updater
+	 *            the update notifier
+	 */
+	TraceListWrapper(TraceGroup group, WrapperBase parent,
+			WrapperUpdater updater) {
+		super(parent, updater);
+		Iterator<Trace> itr = group.getTraces();
+		while (itr.hasNext()) {
+			addTrace(itr.next());
+		}
+	}
+
+	/**
+	 * Adds a new trace to this list
+	 * 
+	 * @param trace
+	 *            the new trace
+	 * @return the wrapper to be refreshed
+	 */
+	WrapperBase addTrace(Trace trace) {
+		add(new TraceWrapper(trace, this, getUpdater()));
+		return this;
+	}
+
+	/**
+	 * Removes a trace from this list.
+	 * 
+	 * @param trace
+	 *            the trace to be removed
+	 * @return the wrapper to be refreshed
+	 */
+	WrapperBase removeTrace(Trace trace) {
+		remove(trace.getExtension(TraceWrapper.class));
+		return this;
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceLocationListWrapper.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,178 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Wrapper for TraceLocationList
+*
+*/
+package com.nokia.tracebuilder.view;
+
+import java.util.Iterator;
+
+import com.nokia.tracebuilder.engine.LocationProperties;
+import com.nokia.tracebuilder.engine.TraceLocation;
+import com.nokia.tracebuilder.engine.TraceLocationList;
+import com.nokia.tracebuilder.engine.TraceLocationListListener;
+
+/**
+ * Wrapper for TraceLocationList
+ * 
+ */
+final class TraceLocationListWrapper extends ListWrapper implements
+		TraceLocationListListener {
+
+	/**
+	 * Location list
+	 */
+	private TraceLocationList locationList;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param list
+	 *            the location list
+	 * @param parent
+	 *            the parent wrapper
+	 * @param updater
+	 *            the update notifier
+	 */
+	TraceLocationListWrapper(TraceLocationList list, WrapperBase parent,
+			WrapperUpdater updater) {
+		super(parent, updater);
+		this.locationList = list;
+		createChildren();
+		locationList.addLocationListListener(this);
+	}
+
+	/**
+	 * Creates the location wrappers
+	 */
+	private void createChildren() {
+		for (LocationProperties loc : locationList) {
+			TraceLocationWrapper wrapper = new TraceLocationWrapper(
+					(TraceLocation) loc, this, getUpdater());
+			add(wrapper);
+		}
+	}
+
+	/**
+	 * Gets the location list
+	 * 
+	 * @return the location list
+	 */
+	TraceLocationList getLocationList() {
+		return locationList;
+	}
+
+	/**
+	 * Updates the location list
+	 * 
+	 * @param list
+	 *            the new location list
+	 */
+	void updateLocationList(TraceLocationList list) {
+		if (locationList != null) {
+			locationList.removeLocationListListener(this);
+		}
+		clear();
+		locationList = list;
+		if (locationList != null) {
+			locationList.addLocationListListener(this);
+			createChildren();
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.view.ListWrapper#delete()
+	 */
+	@Override
+	void delete() {
+		super.delete();
+		if (locationList != null) {
+			locationList.removeLocationListListener(this);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceLocationListListener#
+	 *      locationAdded(com.nokia.tracebuilder.engine.TraceLocation)
+	 */
+	public void locationAdded(TraceLocation location) {
+		TraceLocationWrapper wrapper = new TraceLocationWrapper(location, this,
+				getUpdater());
+		boolean inView = false;
+		boolean hidden = false;
+		if (!hasChildren()) {
+			hidden = true;
+		}
+		// If one of the existing locations is shown in view, or there are no
+		// existing locations the new one is also marked as shown in view
+		if (isInView()) {
+			if (hasChildren()) {
+				Iterator<WrapperBase> itr = getVisibleWrappers();
+				if (itr.next().isInView()) {
+					inView = true;
+				}
+			} else {
+				inView = true;
+			}
+		}
+		add(wrapper);
+		wrapper.setInView(inView);
+		if (hidden) {
+			WrapperBase parent = getParent();
+			if (parent instanceof TraceWrapper) {
+				((TraceWrapper) parent).showLocationList();
+				getUpdater().queueUpdate(parent);
+			} else if (parent instanceof TraceLocationListsWrapper) {
+				WrapperBase update = ((TraceLocationListsWrapper) parent)
+						.showLocationList(this);
+				getUpdater().queueUpdate(update);
+			}
+		} else {
+			getUpdater().queueUpdate(this);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceLocationListListener#
+	 *      locationRemoved(com.nokia.tracebuilder.engine.TraceLocation)
+	 */
+	public void locationRemoved(TraceLocation location) {
+		TraceLocationWrapper wrapper = (TraceLocationWrapper) location
+				.getProperties().getViewReference();
+		remove(wrapper);
+		// Forces a full validity check
+		if (!hasChildren()) {
+			WrapperBase parent = getParent();
+			if (parent instanceof TraceWrapper) {
+				((TraceWrapper) parent).hideLocationList();
+				getUpdater().queueUpdate(parent);
+			} else if (parent instanceof TraceLocationListsWrapper) {
+				WrapperBase update = ((TraceLocationListsWrapper) parent)
+						.hideLocationList(this);
+				getUpdater().queueUpdate(update);
+			}
+		} else {
+			getUpdater().queueUpdate(this);
+		}
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceLocationListsWrapper.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,163 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* List of location lists
+*
+*/
+package com.nokia.tracebuilder.view;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import com.nokia.tracebuilder.engine.TraceLocationList;
+import com.nokia.tracebuilder.model.TraceModel;
+
+/**
+ * List of location lists
+ * 
+ */
+final class TraceLocationListsWrapper extends ListWrapper {
+
+	/**
+	 * Location lists that are not visible
+	 */
+	private ArrayList<TraceLocationListWrapper> hiddenWrappers = new ArrayList<TraceLocationListWrapper>();
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            the trace model
+	 * @param parent
+	 *            the parent wrapper
+	 * @param updater
+	 *            the updater
+	 */
+	TraceLocationListsWrapper(TraceModel model, WrapperBase parent,
+			WrapperUpdater updater) {
+		super(parent, updater);
+		Iterator<TraceLocationList> itr = model
+				.getExtensions(TraceLocationList.class);
+		while (itr.hasNext()) {
+			addLocationList(itr.next());
+		}
+	}
+
+	/**
+	 * Adds a location list to this wrapper
+	 * 
+	 * @param list
+	 *            the list
+	 * @return the wrapper to be updated
+	 */
+	WrapperBase addLocationList(TraceLocationList list) {
+		TraceLocationListWrapper wrapper = new TraceLocationListWrapper(list,
+				this, getUpdater());
+		if (list.hasLocations()) {
+			add(wrapper);
+		} else {
+			hiddenWrappers.add(wrapper);
+		}
+		return this;
+	}
+
+	/**
+	 * Removes a location list from this wrapper
+	 * 
+	 * @param list
+	 *            the list to be removed
+	 * @return the wrapper to be updated
+	 */
+	WrapperBase removeLocationList(TraceLocationList list) {
+		Iterator<WrapperBase> itr = getVisibleWrappers();
+		WrapperBase found = null;
+		while (itr.hasNext() && found == null) {
+			TraceLocationListWrapper wrapper = (TraceLocationListWrapper) itr
+					.next();
+			if (wrapper.getLocationList() == list) {
+				found = wrapper;
+			}
+		}
+		if (found == null) {
+			for (TraceLocationListWrapper wrapper : hiddenWrappers) {
+				if (wrapper.getLocationList() == list) {
+					found = wrapper;
+					break;
+				}
+			}
+		}
+		if (found != null) {
+			remove(found);
+		}
+		return this;
+	}
+
+	/**
+	 * Shows the given location list wrapper
+	 * 
+	 * @param wrapper
+	 *            the wrapper to be shown
+	 * @return the wrapper to be updated
+	 */
+	WrapperBase showLocationList(TraceLocationListWrapper wrapper) {
+		hiddenWrappers.remove(wrapper);
+		add(wrapper);
+		WrapperBase retval;
+		TraceModelWrapper parent = (TraceModelWrapper) getParent();
+		if (!parent.contains(this)) {
+			parent.add(this);
+			retval = parent;
+		} else {
+			retval = this;
+		}
+		return retval;
+	}
+
+	/**
+	 * Hides the given location list wrapper
+	 * 
+	 * @param wrapper
+	 *            the wrapper to be hidden
+	 * @return the wrapper to be updated
+	 */
+	WrapperBase hideLocationList(TraceLocationListWrapper wrapper) {
+		hiddenWrappers.add(wrapper);
+		hide(wrapper);
+		WrapperBase retval;
+		TraceModelWrapper parent = (TraceModelWrapper) getParent();
+		if (!hasChildren()) {
+			parent.hide(this);
+			retval = parent;
+		} else {
+			retval = this;
+		}
+		return retval;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.view.TraceObjectWrapper#delete()
+	 */
+	@Override
+	void delete() {
+		Iterator<TraceLocationListWrapper> itr = hiddenWrappers.iterator();
+		while (itr.hasNext()) {
+			itr.next().delete();
+		}
+		super.delete();
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceLocationWrapper.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,159 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Wrapper for TraceLocation
+*
+*/
+package com.nokia.tracebuilder.view;
+
+import com.nokia.tracebuilder.engine.TraceLocation;
+import com.nokia.tracebuilder.engine.TraceLocationListener;
+import com.nokia.tracebuilder.source.SourceLocation;
+
+/**
+ * Wrapper for TraceLocation
+ * 
+ */
+final class TraceLocationWrapper extends WrapperBase implements
+		TraceLocationListener {
+
+	/**
+	 * The trace location
+	 */
+	private TraceLocation location;
+
+	/**
+	 * Filters out notifications where line was not changed
+	 */
+	private int lastNotifiedLineNumber;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param location
+	 *            the trace location
+	 * @param parent
+	 *            the parent wrapper
+	 * @param updater
+	 *            the update notifier
+	 */
+	TraceLocationWrapper(TraceLocation location, WrapperBase parent,
+			WrapperUpdater updater) {
+		super(parent, updater);
+		this.location = location;
+		location.getProperties().setViewReference(this);
+		location.addLocationListener(this);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.view.WrapperBase#getChildren()
+	 */
+	@Override
+	Object[] getChildren() {
+		return new Object[0];
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.view.WrapperBase#hasChildren()
+	 */
+	@Override
+	boolean hasChildren() {
+		return false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.view.WrapperBase#delete()
+	 */
+	@Override
+	void delete() {
+		super.delete();
+		location.removeLocationListener(this);
+		location.getProperties().setViewReference(null);
+		location = null;
+	}
+
+	/**
+	 * Gets the wrapped location
+	 * 
+	 * @return the location
+	 */
+	TraceLocation getLocation() {
+		return location;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceLocationListener#
+	 *      locationValidityChanged(com.nokia.tracebuilder.engine.TraceLocation)
+	 */
+	public void locationValidityChanged(TraceLocation location) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceLocationListener#
+	 *      locationDeleted(com.nokia.tracebuilder.source.SourceLocation)
+	 */
+	public void locationDeleted(SourceLocation location) {
+		// Processed in location list wrapper when location is removed from
+		// location list
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceLocationListener#locationContentChanged()
+	 */
+	public void locationContentChanged(TraceLocation location) {
+		// Name update
+		if (isInView()) {
+			getUpdater().queueUpdate(this);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceLocationListener#locationChanged()
+	 */
+	public void locationChanged(SourceLocation location) {
+		int line = location.getLineNumber();
+		if (line != lastNotifiedLineNumber) {
+			lastNotifiedLineNumber = line;
+			if (isInView()) {
+				getUpdater().queueUpdate(this);
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString() {
+		return location.getFileName() + ", " + location.getLineNumber(); //$NON-NLS-1$
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceModelWrapper.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,259 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Wrapper for the TraceModel object
+*
+*/
+package com.nokia.tracebuilder.view;
+
+import java.util.Iterator;
+
+import com.nokia.tracebuilder.engine.TraceLocationList;
+import com.nokia.tracebuilder.model.TraceConstantTable;
+import com.nokia.tracebuilder.model.TraceGroup;
+import com.nokia.tracebuilder.model.TraceModel;
+
+/**
+ * Wrapper for the TraceModel object
+ * 
+ */
+final class TraceModelWrapper extends TraceObjectWrapper {
+
+	/**
+	 * Trace groups list
+	 */
+	private TraceGroupListWrapper traceGroupListWrapper;
+
+	/**
+	 * Constant tables list
+	 */
+	private ConstantTableListWrapper traceConstantTableListWrapper;
+
+	/**
+	 * List of location lists
+	 */
+	private TraceLocationListsWrapper traceLocationListsWrapper;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            the trace model
+	 * @param parent
+	 *            parent wrapper
+	 * @param updater
+	 *            the update notifier
+	 */
+	TraceModelWrapper(TraceModel model, WrapperBase parent,
+			WrapperUpdater updater) {
+		super(model, parent, updater);
+		addGroups();
+		addTables();
+		addLocationLists();
+	}
+
+	/**
+	 * Adds a new trace group
+	 * 
+	 * @param group
+	 *            the trace group
+	 * @return the wrapper which needs to be refreshed
+	 */
+	WrapperBase addGroup(TraceGroup group) {
+		WrapperBase wrapper;
+		if (traceGroupListWrapper.hasChildren()) {
+			wrapper = traceGroupListWrapper.addGroup(group);
+		} else {
+			traceGroupListWrapper.addGroup(group);
+			add(traceGroupListWrapper);
+			wrapper = this;
+		}
+		return wrapper;
+	}
+
+	/**
+	 * Removes a trace group
+	 * 
+	 * @param group
+	 *            the group to be removed
+	 * @return the wrapper which needs to be refreshed
+	 */
+	WrapperBase removeGroup(TraceGroup group) {
+		WrapperBase wrapper = traceGroupListWrapper.removeGroup(group);
+		if (!traceGroupListWrapper.hasChildren()) {
+			hide(traceGroupListWrapper);
+			wrapper = this;
+		}
+		return wrapper;
+	}
+
+	/**
+	 * Adds a new constant table
+	 * 
+	 * @param table
+	 *            the constant table
+	 * @return the wrapper which needs to be refreshed
+	 */
+	WrapperBase addConstantTable(TraceConstantTable table) {
+		WrapperBase wrapper;
+		if (traceConstantTableListWrapper.hasChildren()) {
+			wrapper = traceConstantTableListWrapper.addConstantTable(table);
+		} else {
+			traceConstantTableListWrapper.addConstantTable(table);
+			add(traceConstantTableListWrapper);
+			wrapper = this;
+		}
+		return wrapper;
+	}
+
+	/**
+	 * Removes a constant table
+	 * 
+	 * @param table
+	 *            the constant table to be removed
+	 * @return the wrapper which needs to be refreshed
+	 */
+	WrapperBase removeConstantTable(TraceConstantTable table) {
+		WrapperBase wrapper = traceConstantTableListWrapper
+				.removeConstantTable(table);
+		if (!traceConstantTableListWrapper.hasChildren()) {
+			hide(traceConstantTableListWrapper);
+			wrapper = this;
+		}
+		return wrapper;
+	}
+
+	/**
+	 * Adds a location list
+	 * 
+	 * @param list
+	 *            the location list
+	 * @return the wrapper to be updated
+	 */
+	WrapperBase addLocationList(TraceLocationList list) {
+		WrapperBase retval = traceLocationListsWrapper.addLocationList(list);
+		if (!contains(traceLocationListsWrapper) && list.hasLocations()) {
+			add(traceLocationListsWrapper);
+			retval = this;
+		}
+		return retval;
+	}
+
+	/**
+	 * Removes a location list
+	 * 
+	 * @param list
+	 *            the list to be removed
+	 * @return the wrapper to be updated
+	 */
+	WrapperBase removeLocationList(TraceLocationList list) {
+		WrapperBase retval = traceLocationListsWrapper.removeLocationList(list);
+		if (!hasEntries((TraceModel) getTraceObject())) {
+			hide(traceLocationListsWrapper);
+			retval = this;
+		}
+		return retval;
+	}
+
+	/**
+	 * Called when model is reset
+	 */
+	void modelReset() {
+		// Locations lists may be hidden
+		if (!contains(traceLocationListsWrapper)) {
+			traceLocationListsWrapper.delete();
+		}
+		clear();
+		// New list objects need to be created since clear deletes them
+		addGroups();
+		addTables();
+		addExtensions();
+		addProperties();
+		addLocationLists();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.view.TraceObjectWrapper#delete()
+	 */
+	@Override
+	void delete() {
+		if (!contains(traceLocationListsWrapper)) {
+			traceLocationListsWrapper.delete();
+		}
+		if (!contains(traceConstantTableListWrapper)) {
+			traceConstantTableListWrapper.delete();
+		}
+		if (!contains(traceGroupListWrapper)) {
+			traceGroupListWrapper.delete();
+		}
+		super.delete();
+	}
+
+	/**
+	 * Adds the trace groups list
+	 */
+	private void addGroups() {
+		TraceModel model = (TraceModel) getTraceObject();
+		traceGroupListWrapper = new TraceGroupListWrapper(model, this,
+				getUpdater());
+		if (model.hasGroups()) {
+			add(traceGroupListWrapper);
+		}
+	}
+
+	/**
+	 * Adds the constant tables list
+	 */
+	private void addTables() {
+		TraceModel model = (TraceModel) getTraceObject();
+		traceConstantTableListWrapper = new ConstantTableListWrapper(model,
+				this, getUpdater());
+		if (model.hasConstantTables()) {
+			add(traceConstantTableListWrapper);
+		}
+	}
+
+	/**
+	 * Adds the locations lists list
+	 */
+	private void addLocationLists() {
+		TraceModel model = (TraceModel) getTraceObject();
+		traceLocationListsWrapper = new TraceLocationListsWrapper(model, this,
+				getUpdater());
+		if (hasEntries(model)) {
+			add(traceLocationListsWrapper);
+		}
+	}
+
+	/**
+	 * Checks if the sub-lists have entries
+	 * 
+	 * @param model
+	 *            the model
+	 * @return true if there are entries, false if not
+	 */
+	private boolean hasEntries(TraceModel model) {
+		Iterator<TraceLocationList> itr = model
+				.getExtensions(TraceLocationList.class);
+		boolean hasEntries = false;
+		while (itr.hasNext() && !hasEntries) {
+			hasEntries = itr.next().hasLocations();
+		}
+		return hasEntries;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceNameSorter.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,228 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 view sorter implementation
+*
+*/
+package com.nokia.tracebuilder.view;
+
+import java.util.Arrays;
+import java.util.Comparator;
+
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerSorter;
+
+import com.nokia.tracebuilder.engine.TraceLocation;
+import com.nokia.tracebuilder.model.TraceObject;
+
+/**
+ * Tree view sorter implementation
+ * 
+ */
+final class TraceNameSorter extends ViewerSorter {
+
+	/**
+	 * Comparator for trace object names
+	 * 
+	 */
+	final class NameSorter implements Comparator<Object> {
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+		 */
+		public int compare(Object o1, Object o2) {
+			int res;
+			if (o1 != null && o2 != null) {
+				if (o1 instanceof TraceObjectWrapper
+						&& o2 instanceof TraceObjectWrapper) {
+					TraceObject obj1 = ((TraceObjectWrapper) o1)
+							.getTraceObject();
+					TraceObject obj2 = ((TraceObjectWrapper) o2)
+							.getTraceObject();
+					if (obj1 != null && obj2 != null) {
+						res = obj1.getName().compareTo(obj2.getName());
+					} else {
+						res = 0;
+					}
+				} else if (o1 instanceof ListNavigator) {
+					res = -1;
+				} else if (o2 instanceof ListNavigator) {
+					res = 1;
+				} else {
+					res = 0;
+				}
+			} else {
+				res = 0;
+			}
+			return res;
+		}
+
+	}
+
+	/**
+	 * Generic comparator for wrappers
+	 * 
+	 */
+	private class WrapperComparator implements Comparator<Object> {
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+		 */
+		public int compare(Object arg0, Object arg1) {
+			int res;
+			// List navigator is always last element
+			if (arg0 instanceof ListNavigator) {
+				res = 1;
+			} else if (arg1 instanceof ListNavigator) {
+				res = -1;
+			} else {
+				// Properties are always first
+				if (arg0 instanceof PropertyWrapper) {
+					res = -1;
+				} else if (arg1 instanceof PropertyWrapper) {
+					res = 1;
+				} else {
+					// Extensions after properties
+					if (arg0 instanceof TraceViewExtensionWrapper) {
+						res = -1;
+					} else if (arg1 instanceof TraceViewExtensionWrapper) {
+						res = 1;
+					} else {
+						res = 0;
+					}
+				}
+			}
+			return res;
+		}
+	}
+
+	/**
+	 * Comparator for trace locations
+	 * 
+	 */
+	private final class LineNumberComparator implements Comparator<Object> {
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+		 */
+		public int compare(Object arg0, Object arg1) {
+			int res;
+			// List navigator is always last element
+			if (arg0 instanceof ListNavigator) {
+				res = 1;
+			} else if (arg1 instanceof ListNavigator) {
+				res = -1;
+			} else {
+				TraceLocation loc0 = ((TraceLocationWrapper) arg0)
+						.getLocation();
+				TraceLocation loc1 = ((TraceLocationWrapper) arg1)
+						.getLocation();
+				if (loc0 != null && loc1 != null) {
+					String file0 = loc0.getFileName();
+					String file1 = loc1.getFileName();
+					if (file0 != null && file1 != null) {
+						res = file0.compareTo(file1);
+						if (res == 0) {
+							int pos0 = loc0.getLineNumber();
+							int pos1 = loc1.getLineNumber();
+							res = pos0 > pos1 ? 1 : pos0 < pos1 ? -1 : 0;
+						}
+					} else {
+						res = 0;
+					}
+				} else {
+					res = 0;
+				}
+			}
+			return res;
+		}
+	}
+
+	/**
+	 * Comparator for trace model
+	 * 
+	 */
+	private final class ModelSorter extends WrapperComparator {
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see com.nokia.tracebuilder.view.TraceNameSorter.WrapperComparator#
+		 *      compare(java.lang.Object, java.lang.Object)
+		 */
+		@Override
+		public int compare(Object o1, Object o2) {
+			int res;
+			if (o1 instanceof TraceLocationListsWrapper) {
+				res = 1;
+			} else if (o2 instanceof TraceLocationListsWrapper) {
+				res = -1;
+			} else {
+				res = super.compare(o1, o2);
+			}
+			return res;
+		}
+	}
+
+	/**
+	 * Comparator used when sorting locations
+	 */
+	private Comparator<Object> lineNumberSorter = new LineNumberComparator();
+
+	/**
+	 * Comparator used when sorting wrapper objects
+	 */
+	private Comparator<Object> wrapperSorter = new WrapperComparator();
+
+	/**
+	 * Comparator used when sorting model elements
+	 */
+	private Comparator<Object> modelSorter = new ModelSorter();
+
+	/**
+	 * Comparator for traces and groups
+	 */
+	private Comparator<Object> nameSorter = new NameSorter();
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.viewers.ViewerSorter#sort(org.eclipse.jface.viewers.Viewer,
+	 *      java.lang.Object[])
+	 */
+	@Override
+	public void sort(Viewer viewer, Object[] elements) {
+		if (elements != null && elements.length > 0) {
+			if (elements[0] instanceof TraceParameterWrapper) {
+			} else if (elements[0] instanceof TraceWrapper
+					|| elements[0] instanceof TraceGroupWrapper) {
+				Arrays.sort(elements, nameSorter);
+			} else if (elements[0] instanceof TraceLocationWrapper) {
+				Arrays.sort(elements, lineNumberSorter);
+			} else if (((WrapperBase) elements[0]).getParent() instanceof TraceModelWrapper) {
+				Arrays.sort(elements, modelSorter);
+			} else {
+				Arrays.sort(elements, wrapperSorter);
+			}
+		}
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceObjectListWrapper.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Wrapper for list of TraceObject instances
+*
+*/
+package com.nokia.tracebuilder.view;
+
+/**
+ * Wrapper for list of TraceObject instances
+ * 
+ */
+abstract class TraceObjectListWrapper extends ListWrapper {
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parent
+	 *            parent wrapper
+	 * @param updater
+	 *            the update notifier
+	 */
+	TraceObjectListWrapper(WrapperBase parent, WrapperUpdater updater) {
+		super(parent, updater);
+	}
+
+	/**
+	 * Hides this object from view
+	 * 
+	 * @return the wrapper that needs to be refreshed
+	 */
+	WrapperBase hideFromView() {
+		WrapperBase parent = getParent();
+		if (parent instanceof TraceObjectWrapper) {
+			((TraceObjectWrapper) parent).hide(this);
+		}
+		return parent;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceObjectWrapper.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,318 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 view elements containing a TraceObject
+*
+*/
+package com.nokia.tracebuilder.view;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import com.nokia.tracebuilder.engine.TraceViewExtension;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceModel;
+import com.nokia.tracebuilder.model.TraceModelExtension;
+import com.nokia.tracebuilder.model.TraceModelListener;
+import com.nokia.tracebuilder.model.TraceObject;
+
+/**
+ * Base class for tree view elements containing a TraceObject
+ * 
+ * @see com.nokia.tracebuilder.model.TraceObject
+ */
+abstract class TraceObjectWrapper extends ListWrapper implements
+		TraceModelExtension {
+
+	/**
+	 * The trace object
+	 */
+	private TraceObject object;
+
+	/**
+	 * ID property
+	 */
+	protected PropertyWrapper id;
+
+	/**
+	 * Value property
+	 */
+	protected PropertyWrapper value;
+
+	/**
+	 * Extensions that are not visible
+	 */
+	private ArrayList<TraceViewExtensionWrapper> hiddenExtensions;
+
+	/**
+	 * Constructor adds property list, parameter list and extensions to the list
+	 * of sub-wrappers.
+	 * 
+	 * @param object
+	 *            the trace object
+	 * @param parent
+	 *            the parent wrapper
+	 * @param updater
+	 *            the update notifier
+	 */
+	TraceObjectWrapper(TraceObject object, WrapperBase parent,
+			WrapperUpdater updater) {
+		super(parent, updater);
+		this.object = object;
+		// This wrapper is stored into the trace object for quick access
+		object.addExtension(this);
+		addExtensions();
+		addProperties();
+	}
+
+	/**
+	 * Adds an extension
+	 * 
+	 * @param extension
+	 *            the extension to be added
+	 * @return the wrapper which needs to be refreshed
+	 */
+	WrapperBase addExtension(TraceViewExtension extension) {
+		TraceViewExtensionWrapper wrapper = new TraceViewExtensionWrapper(
+				extension, this, getUpdater());
+		if (extension.hasChildren() || !extension.hideWhenEmpty()) {
+			add(wrapper);
+		} else {
+			if (hiddenExtensions == null) {
+				hiddenExtensions = new ArrayList<TraceViewExtensionWrapper>();
+			}
+			hiddenExtensions.add(wrapper);
+		}
+		return this;
+	}
+
+	/**
+	 * Removes an extension.
+	 * 
+	 * @param extension
+	 *            the extension to be removed
+	 * @return the wrapper which needs to be refreshed
+	 */
+	WrapperBase removeExtension(TraceViewExtension extension) {
+		TraceViewExtensionWrapper wrapper = (TraceViewExtensionWrapper) extension
+				.getViewReference();
+		remove(wrapper);
+		if (hiddenExtensions != null) {
+			hiddenExtensions.remove(wrapper);
+		}
+		return this;
+	}
+
+	/**
+	 * Gets the wrapped trace object
+	 * 
+	 * @return the trace object
+	 */
+	TraceObject getTraceObject() {
+		return object;
+	}
+
+	/**
+	 * Refreshes the value of given property
+	 * 
+	 * @param property
+	 *            the property type
+	 * @return the wrapper which needs to be refreshed
+	 */
+	WrapperBase refreshProperty(int property) {
+		WrapperBase retval;
+		if (object instanceof Trace) {
+			retval = refreshTraceProperty(property);
+		} else if (object instanceof TraceModel) {
+			retval = refreshModelProperty(property);
+		} else {
+			retval = this;
+		}
+		return retval;
+	}
+
+	/**
+	 * Refreshes a trace model property
+	 * 
+	 * @param property
+	 *            the property to be refreshed
+	 * @return the wrapper that was affected
+	 */
+	private WrapperBase refreshModelProperty(int property) {
+		WrapperBase retval = null;
+		if (property == TraceModelListener.ID) {
+			retval = updateID();
+		} else if (property == TraceModelListener.NAME) {
+			value.setProperty(((TraceModel) object).getName());
+			retval = value;
+		}
+		return retval;
+	}
+
+	/**
+	 * Refreshes a trace property
+	 * 
+	 * @param property
+	 *            the property to be refreshed
+	 * @return the wrapper that was affected
+	 */
+	private WrapperBase refreshTraceProperty(int property) {
+		WrapperBase retval = null;
+		if (property == TraceModelListener.TRACE) {
+			value.setProperty(((Trace) object).getTrace());
+			retval = value;
+		}
+		return retval;
+	}
+
+	/**
+	 * Updates the ID property
+	 * 
+	 * @return the ID property wrapper
+	 */
+	private WrapperBase updateID() {
+		id.setProperty(Messages.getString("TraceObjectWrapper.HexPrefix") //$NON-NLS-1$
+				+ Integer.toHexString(object.getID())
+				+ Messages.getString("TraceObjectWrapper.HexPostfix")); //$NON-NLS-1$
+		return id;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.view.WrapperBase#delete()
+	 */
+	@Override
+	void delete() {
+		object.removeExtension(this);
+		object = null;
+		if (hiddenExtensions != null) {
+			Iterator<TraceViewExtensionWrapper> itr = hiddenExtensions
+					.iterator();
+			while (itr.hasNext()) {
+				itr.next().delete();
+			}
+		}
+		super.delete();
+	}
+
+	/**
+	 * Extension update hides the extension if it becomes empty and has the
+	 * hideWhenEmpty flag. Also shows if the extension is no longer empty.
+	 * 
+	 * @param extension
+	 *            the extension
+	 * @return the wrapper that needs to be refreshed
+	 */
+	WrapperBase updateExtension(TraceViewExtension extension) {
+		TraceViewExtensionWrapper wrapper = (TraceViewExtensionWrapper) extension
+				.getViewReference();
+		WrapperBase retval = null;
+		if (contains(wrapper)) {
+			if (!extension.hasChildren() && extension.hideWhenEmpty()) {
+				hide(wrapper);
+				if (hiddenExtensions == null) {
+					hiddenExtensions = new ArrayList<TraceViewExtensionWrapper>();
+				}
+				hiddenExtensions.add(wrapper);
+				retval = this;
+			}
+		} else {
+			if (extension.hasChildren() || !extension.hideWhenEmpty()) {
+				if (hiddenExtensions != null) {
+					hiddenExtensions.remove(wrapper);
+				}
+				add(wrapper);
+				retval = this;
+			}
+		}
+		if (retval == null) {
+			retval = wrapper;
+		}
+		return retval;
+	}
+
+	/**
+	 * Hides this object from the view
+	 * 
+	 * @return the object that needs to be refreshed
+	 */
+	WrapperBase hideFromView() {
+		TraceObjectListWrapper parent = (TraceObjectListWrapper) getParent();
+		parent.hide(this);
+		WrapperBase retval;
+		if (parent.hasChildren()) {
+			retval = parent;
+		} else {
+			retval = parent.hideFromView();
+		}
+		return retval;
+	}
+
+	/**
+	 * Adds the extensions to the list
+	 */
+	void addExtensions() {
+		// Extensions are added directly under the object
+		Iterator<TraceViewExtension> itr = object
+				.getExtensions(TraceViewExtension.class);
+		while (itr.hasNext()) {
+			addExtension(itr.next());
+		}
+	}
+
+	/**
+	 * Creates and adds the properties
+	 */
+	void addProperties() {
+		if (object instanceof Trace) {
+			value = new PropertyWrapper(Messages
+					.getString("TraceObjectWrapper.Trace"), //$NON-NLS-1$
+					((Trace) object).getTrace(), this, getUpdater());
+			add(value);
+		} else if (object instanceof TraceModel) {
+			// Property is not needed, because component id's will be read from mmp files
+			id = new PropertyWrapper(Messages
+					.getString("TraceObjectWrapper.ModelID"), //$NON-NLS-1$
+					"", this, getUpdater()); //$NON-NLS-1$
+			add(id);
+			// Property is not needed, because component names will be read from mmp files
+			value = new PropertyWrapper(Messages
+					.getString("TraceObjectWrapper.ModelName"), //$NON-NLS-1$
+					"", this, getUpdater()); //$NON-NLS-1$
+			add(value);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelExtension#
+	 *      setOwner(com.nokia.tracebuilder.model.TraceObject)
+	 */
+	public void setOwner(TraceObject owner) {
+		// Already set in constructor
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelExtension#getOwner()
+	 */
+	public TraceObject getOwner() {
+		return object;
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceParameterListWrapper.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Wrapper for parameter list
+*
+*/
+package com.nokia.tracebuilder.view;
+
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceParameter;
+
+/**
+ * Wrapper for parameter list
+ * 
+ */
+final class TraceParameterListWrapper extends TraceObjectListWrapper {
+
+	/**
+	 * Constructor adds the parameters of the trace object to the list
+	 * 
+	 * @param owner
+	 *            the trace
+	 * @param parent
+	 *            parent wrapper
+	 * @param updater
+	 *            the update notifier
+	 */
+	TraceParameterListWrapper(Trace owner, WrapperBase parent,
+			WrapperUpdater updater) {
+		super(parent, updater);
+		for (TraceParameter param : owner) {
+			addParameter(param);
+		}
+	}
+
+	/**
+	 * Adds a new parameter to the list
+	 * 
+	 * @param parameter
+	 *            the parameter
+	 * @return the wrapper to be refreshed
+	 */
+	WrapperBase addParameter(TraceParameter parameter) {
+		add(new TraceParameterWrapper(parameter, this, getUpdater()));
+		return this;
+	}
+
+	/**
+	 * Removes a parameter from this list
+	 * 
+	 * @param parameter
+	 *            the parameter to be removed
+	 * @return the wrapper to be refreshed
+	 */
+	WrapperBase removeParameter(TraceParameter parameter) {
+		remove(parameter.getExtension(TraceParameterWrapper.class));
+		return this;
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceParameterWrapper.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Wrapper for a trace parameter
+*
+*/
+package com.nokia.tracebuilder.view;
+
+import com.nokia.tracebuilder.model.TraceModelListener;
+import com.nokia.tracebuilder.model.TraceParameter;
+import com.nokia.tracebuilder.rules.ArrayParameterRule;
+
+/**
+ * Wrapper for a trace parameter
+ * 
+ */
+final class TraceParameterWrapper extends TraceObjectWrapper {
+
+	/**
+	 * Array type flag
+	 */
+	private boolean isArray;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parameter
+	 *            the parameter
+	 * @param parent
+	 *            the parent wrapper
+	 * @param updater
+	 *            the update notifier
+	 */
+	TraceParameterWrapper(TraceParameter parameter, WrapperBase parent,
+			WrapperUpdater updater) {
+		super(parameter, parent, updater);
+		isArray = parameter.getExtension(ArrayParameterRule.class) != null;
+	}
+
+	/**
+	 * Gets the array type flag
+	 * 
+	 * @return the array flag
+	 */
+	boolean isArrayType() {
+		return isArray;
+	}
+
+	/**
+	 * Sets the array type flag
+	 * 
+	 * @param array
+	 *            the array flag
+	 * @return the wrapper that needs to be refreshed
+	 */
+	WrapperBase setArrayType(boolean array) {
+		isArray = array;
+		return refreshProperty(TraceModelListener.TYPE);
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceView.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,387 @@
+/*
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies 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 Builder view implementation
+ *
+ */
+package com.nokia.tracebuilder.view;
+
+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.viewers.TreeViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.part.ViewPart;
+
+import com.nokia.carbide.cpp.internal.featureTracker.FeatureUseTrackerConsts;
+import com.nokia.carbide.cpp.internal.featureTracker.FeatureUseTrackerPlugin;
+import com.nokia.tracebuilder.action.ActionFactory;
+import com.nokia.tracebuilder.action.TraceViewActions;
+import com.nokia.tracebuilder.engine.TraceBuilderActions;
+import com.nokia.tracebuilder.engine.TraceBuilderConfiguration;
+import com.nokia.tracebuilder.engine.TraceBuilderDialogs;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceBuilderView;
+import com.nokia.tracebuilder.engine.TraceLocation;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialog;
+import com.nokia.tracebuilder.model.TraceObject;
+import com.nokia.tracebuilder.preferences.ConfigurationImpl;
+
+/**
+ * Trace Builder view implementation
+ * 
+ */
+public final class TraceView extends ViewPart implements TraceBuilderView {
+
+	/**
+	 * Trace Groups branch text
+	 */
+	private static final String TRACE_GROUPS_BRANCH_TEXT = "Trace Groups"; //$NON-NLS-1$
+
+	/**
+	 * Tree viewer widget
+	 */
+	private TreeViewer viewer;
+
+	/**
+	 * Tree view selection listener
+	 */
+	private TraceViewSelectionListener selectionListener;
+
+	/**
+	 * Tree view expansion listener
+	 */
+	private TraceViewTreeListener treeListener;
+
+	/**
+	 * Dialog interface implementation
+	 */
+	private TraceViewDialogs dialogs;
+
+	/**
+	 * Action factory
+	 */
+	private TraceViewActions actions;
+
+	/**
+	 * Configuration
+	 */
+	private TraceBuilderConfiguration configuration;
+
+	/**
+	 * Help listener
+	 */
+	private TraceViewHelpListener helpListener;
+
+	/**
+	 * Property dialog properties
+	 */
+	private PropertyDialogProperties propertyDialog;
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets
+	 * .Composite)
+	 */
+	@Override
+	public void createPartControl(Composite parent) {
+		actions = new ActionFactory();
+		configuration = new ConfigurationImpl();
+		selectionListener = new TraceViewSelectionListener(actions);
+		// Creates the tree viewer
+		viewer = new TreeViewer(parent, SWT.SINGLE | SWT.H_SCROLL
+				| SWT.V_SCROLL);
+		TraceContentProvider contentProvider = new TraceContentProvider();
+		TraceLabelProvider labelProvider = new TraceLabelProvider();
+		TraceNameSorter nameSorter = new TraceNameSorter();
+		viewer.setContentProvider(contentProvider);
+		viewer.setLabelProvider(labelProvider);
+		viewer.setSorter(nameSorter);
+		// Content provider creates the viewer updater. The updater needs the
+		// display reference in order to create asynchronous callbacks to the UI
+		// thread.
+		viewer.setInput(getViewSite().getShell().getDisplay());
+		treeListener = new TraceViewTreeListener(viewer);
+		helpListener = new TraceViewHelpListener();
+		viewer.addSelectionChangedListener(selectionListener);
+		viewer.addDoubleClickListener(selectionListener);
+		viewer.addHelpListener(helpListener);
+		viewer.addTreeListener(treeListener);
+
+		// Hooks actions to menus
+		hookContextMenu();
+		fillMenuAndToolBar();
+
+		// Start using feature
+		FeatureUseTrackerPlugin.getFeatureUseProxy().startUsingFeature(
+				FeatureUseTrackerConsts.CARBIDE_OST_TRACE);
+
+		// Sets the view reference to trace builder engine
+		TraceBuilderGlobals.setView(this);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ui.part.WorkbenchPart#dispose()
+	 */
+	@Override
+	public void dispose() {
+		TraceBuilderGlobals.setView(null);
+		viewer.removeTreeListener(treeListener);
+		viewer.removeSelectionChangedListener(selectionListener);
+		viewer.removeHelpListener(helpListener);
+
+		// Stop using feature
+		FeatureUseTrackerPlugin.getFeatureUseProxy().stopUsingFeature(
+				FeatureUseTrackerConsts.CARBIDE_OST_TRACE);
+
+		super.dispose();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ui.IWorkbenchPart#setFocus()
+	 */
+	@Override
+	public void setFocus() {
+		viewer.getControl().setFocus();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderView#hasFocus()
+	 */
+	public boolean hasFocus() {
+		return viewer.getControl().isFocusControl();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderView#
+	 * selectObject(com.nokia.tracebuilder.model.TraceObject)
+	 */
+	public void selectObject(TraceObject object) {
+		TraceObjectWrapper wrapper = object
+				.getExtension(TraceObjectWrapper.class);
+		// Wrapper is null if user makes a selection before view is updated
+		if (wrapper != null) {
+			revealSelectedObject(wrapper);
+			actions.enableActions(object);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderView#
+	 * selectLocation(com.nokia.tracebuilder.engine.TraceLocation)
+	 */
+	public void selectLocation(TraceLocation location) {
+		TraceLocationWrapper wrapper = (TraceLocationWrapper) location
+				.getProperties().getViewReference();
+		// Wrapper is null if user makes a selection before view is updated
+		if (wrapper != null) {
+			revealSelectedObject(wrapper);
+			actions.enableActions(location);
+		}
+	}
+
+	/**
+	 * Reveals the given wrapper
+	 * 
+	 * @param wrapper
+	 *            the wrapper to be revealed
+	 */
+	private void revealSelectedObject(WrapperBase wrapper) {
+		ListWrapper parent = (ListWrapper) wrapper.getParent();
+		WrapperBase updated = parent.moveChildToView(wrapper);
+		if (updated != null) {
+			viewer.removeSelectionChangedListener(selectionListener);
+			updated.getUpdater().update(updated);
+			viewer.addSelectionChangedListener(selectionListener);
+		}
+		wrapper.getUpdater().queueSelection(wrapper);
+	}
+
+	/**
+	 * Gets the view shell
+	 * 
+	 * @return the shell of the tree viewer
+	 */
+	Shell getShell() {
+		Shell retval = null;
+		if (viewer != null) {
+			retval = viewer.getControl().getShell();
+			if (retval != null && retval.isDisposed()) {
+				retval = null;
+			}
+		}
+		return retval;
+	}
+
+	/**
+	 * Adds menu listener to popup menu
+	 */
+	private void hookContextMenu() {
+		MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
+		menuMgr.setRemoveAllWhenShown(true);
+		menuMgr.addMenuListener(new IMenuListener() {
+			public void menuAboutToShow(IMenuManager manager) {
+				fillContextMenu(manager);
+			}
+		});
+		Menu menu = menuMgr.createContextMenu(viewer.getControl());
+		viewer.getControl().setMenu(menu);
+		getSite().registerContextMenu(menuMgr, viewer);
+	}
+
+	/**
+	 * Adds action items to menu and toolbar
+	 */
+	private void fillMenuAndToolBar() {
+		IActionBars bars = getViewSite().getActionBars();
+		fillMenu(bars.getMenuManager());
+		fillToolBar(bars.getToolBarManager());
+	}
+
+	/**
+	 * Adds menu items to view pull-down menu
+	 * 
+	 * @param manager
+	 *            the menu to be filled
+	 */
+	private void fillMenu(IMenuManager manager) {
+		actions.fillMenu(manager);
+		manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+	}
+
+	/**
+	 * Adds actions to tool bar
+	 * 
+	 * @param manager
+	 *            the tool bar
+	 */
+	private void fillToolBar(IToolBarManager manager) {
+		actions.fillToolBar(manager);
+		manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+	}
+
+	/**
+	 * Called prior to showing the context menu
+	 * 
+	 * @param manager
+	 *            the menu to be filled
+	 */
+	private void fillContextMenu(IMenuManager manager) {
+		actions.fillContextMenu(manager);
+		manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderView#getDialogs()
+	 */
+	public TraceBuilderDialogs getDialogs() {
+		if (dialogs == null) {
+			dialogs = new TraceViewDialogs(this);
+		}
+		return dialogs;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderView#getPropertyDialog()
+	 */
+	public TraceObjectPropertyDialog getPropertyDialog() {
+		if (propertyDialog == null) {
+			propertyDialog = new PropertyDialogProperties(this);
+		}
+		return propertyDialog;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderView#getActions()
+	 */
+	public TraceBuilderActions getActions() {
+		return actions;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderView#getConfiguration()
+	 */
+	public TraceBuilderConfiguration getConfiguration() {
+		return configuration;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderView#
+	 * runAsyncOperation(java.lang.Runnable)
+	 */
+	public void runAsyncOperation(Runnable runnable) {
+		Shell shell = getShell();
+		if (shell != null) {
+			shell.getDisplay().asyncExec(runnable);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderView# refresh()
+	 */
+	public void refresh() {
+		viewer.refresh();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.tracebuilder.engine.TraceBuilderView#expandTraceGroupsBranch()
+	 */
+	public void expandTraceGroupsBranch() {
+		TreeItem[] items = viewer.getTree().getItems();
+		if (items != null) {
+			for (TreeItem item : items) {
+				if (item.getText().equals(TRACE_GROUPS_BRANCH_TEXT)) {
+					item.setExpanded(true);
+					break;
+				}
+			}
+		}
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceViewDialogs.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,192 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Dialog interface implementation
+*
+*/
+package com.nokia.tracebuilder.view;
+
+import java.io.File;
+
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Shell;
+
+import com.nokia.tracebuilder.engine.TraceBuilderDialogs;
+
+/**
+ * Dialog interface implementation
+ * 
+ */
+final class TraceViewDialogs implements TraceBuilderDialogs {
+
+	/**
+	 * Trace view
+	 */
+	private TraceView view;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param view
+	 *            trace view
+	 */
+	TraceViewDialogs(TraceView view) {
+		this.view = view;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderDialogs#
+	 *      showConfirmationQuery(com.nokia.tracebuilder.engine.TraceBuilderDialogs.QueryDialogParameters)
+	 */
+	public int showConfirmationQuery(QueryDialogParameters parameters) {
+		Shell shell = view.getShell();
+		int ret = CANCEL;
+		if (shell != null) {
+			if (parameters instanceof DirectoryDialogQueryParameters) {
+				ret = showDirectoryQuery((DirectoryDialogQueryParameters) parameters);
+			} else if (parameters instanceof FileDialogQueryParameters) {
+				ret = showFileQuery((FileDialogQueryParameters) parameters);
+			} else if (parameters instanceof ExtendedQueryParameters) {
+				ret = showExtendedQueryDialog(parameters, shell);
+			} else {
+				if (MessageDialog.openQuestion(shell, Messages
+						.getString("TraceView.TraceBuilder"), //$NON-NLS-1$
+						TraceViewMessages.getConfirmationQueryText(parameters))) {
+					ret = OK;
+				}
+			}
+		}
+		return ret;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderDialogs#
+	 *      showErrorMessage(java.lang.String)
+	 */
+	public void showErrorMessage(String message) {
+		Shell shell = view.getShell();
+		if (shell != null) {
+			shell.getDisplay().asyncExec(
+					new MessageDialogRunnable(shell, message));
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderDialogs#
+	 *      showCheckList(com.nokia.tracebuilder.engine.TraceBuilderDialogs.CheckListDialogType,
+	 *      java.util.List, java.util.List)
+	 */
+	public int showCheckList(CheckListDialogParameters parameters) {
+		Shell shell = view.getShell();
+		int ret = CANCEL;
+		if (shell != null) {
+			CheckListSelectionDialog dlg = new CheckListSelectionDialog(shell,
+					parameters);
+			int result = dlg.open();
+			if (result == IDialogConstants.OK_ID
+					|| result == IDialogConstants.YES_ID) {
+				ret = OK;
+			}
+		}
+		return ret;
+	}
+
+	/**
+	 * Shows a directory query
+	 * 
+	 * @param parameters
+	 *            the query parameters
+	 * @return OK / CANCEL
+	 */
+	private int showDirectoryQuery(DirectoryDialogQueryParameters parameters) {
+		Shell shell = view.getShell();
+		int ret = CANCEL;
+		if (shell != null) {
+			DirectoryDialog dd = new DirectoryDialog(shell);
+			dd.setMessage(TraceViewMessages
+					.getConfirmationQueryText(parameters));
+			String res = dd.open();
+			if (res != null) {
+				parameters.path = res;
+				ret = OK;
+			}
+		}
+		return ret;
+	}
+
+	/**
+	 * Shows file selection dialog
+	 * 
+	 * @param parameters
+	 *            the parameters
+	 * @return OK / CANCEL
+	 */
+	private int showFileQuery(FileDialogQueryParameters parameters) {
+		Shell shell = view.getShell();
+		int ret = CANCEL;
+		if (shell != null) {
+			FileDialog fd = new FileDialog(shell, SWT.SINGLE | SWT.OPEN);
+			File f = new File(parameters.path);
+			if (f.isDirectory()) {
+				fd.setFilterPath(f.getPath());
+			} else {
+				fd.setFilterPath(f.getParent());
+			}
+			if (parameters.filters != null) {
+				fd.setFilterNames(parameters.filterTitles);
+				fd.setFilterExtensions(parameters.filters);
+			}
+			fd.setText(TraceViewMessages.getConfirmationQueryText(parameters));
+			String res = fd.open();
+			if (res != null) {
+				parameters.path = res;
+				ret = OK;
+			}
+		}
+		return ret;
+	}
+
+	/**
+	 * Shows a query dialog, where the buttons have been defined by client
+	 * 
+	 * @param parameters
+	 *            the dialog parameters
+	 * @param shell
+	 *            the parent shell
+	 * @return the index of the selected button
+	 */
+	private int showExtendedQueryDialog(QueryDialogParameters parameters,
+			Shell shell) {
+		MessageDialog md = new MessageDialog(
+				shell,
+				Messages.getString("TraceView.TraceBuilder"), //$NON-NLS-1$
+				null, ((ExtendedQueryParameters) parameters).message,
+				MessageDialog.QUESTION,
+				((ExtendedQueryParameters) parameters).buttonTitles, 0);
+		// Returns the index of the button defined in extended query parameters
+		return md.open();
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceViewExtensionWrapper.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,103 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Wrapper for a trace view extension
+*
+*/
+package com.nokia.tracebuilder.view;
+
+import java.util.Iterator;
+
+import com.nokia.tracebuilder.engine.TraceViewExtension;
+import com.nokia.tracebuilder.model.TraceModelExtensionUpdateListener;
+
+/**
+ * Wrapper for a trace view extension
+ * 
+ */
+final class TraceViewExtensionWrapper extends ListWrapper implements
+		TraceModelExtensionUpdateListener {
+
+	/**
+	 * The wrapped extension
+	 */
+	private TraceViewExtension extension;
+
+	/**
+	 * Creates a new extension wrapper.
+	 * 
+	 * @param extension
+	 *            the extension to be shown in the view
+	 * @param parent
+	 *            parent wrapper
+	 * @param updater
+	 *            the update notifier
+	 */
+	TraceViewExtensionWrapper(TraceViewExtension extension, WrapperBase parent,
+			WrapperUpdater updater) {
+		super(parent, updater);
+		this.extension = extension;
+		extension.addUpdateListener(this);
+		extension.setViewReference(this);
+		createChildren();
+	}
+
+	/**
+	 * Returns the wrapped extension
+	 * 
+	 * @return the extension
+	 */
+	TraceViewExtension getExtension() {
+		return extension;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.view.ListWrapper#delete()
+	 */
+	@Override
+	void delete() {
+		extension.setViewReference(null);
+		extension.removeUpdateListener(this);
+		extension = null;
+		super.delete();
+	}
+
+	/**
+	 * Creates the child wrappers
+	 */
+	private void createChildren() {
+		Iterator<?> itr = extension.getChildren();
+		while (itr.hasNext()) {
+			ObjectWrapper wrapper = new ObjectWrapper(itr.next(), this,
+					getUpdater());
+			add(wrapper);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelExtensionUpdateListener#extensionUpdated()
+	 */
+	public void extensionUpdated() {
+		clear();
+		createChildren();
+		getUpdater().update(
+				((TraceObjectWrapper) getParent()).updateExtension(extension));
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceViewHelp.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,128 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Help context builder for view
+*
+*/
+package com.nokia.tracebuilder.view;
+
+import com.nokia.tracebuilder.engine.TraceBuilderHelp;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialog;
+import com.nokia.tracebuilder.engine.TraceBuilderDialogs.CheckListDialogType;
+
+/**
+ * Help context builder for view
+ * 
+ */
+public final class TraceViewHelp {
+
+	/**
+	 * Prevents construction
+	 */
+	private TraceViewHelp() {
+	}
+
+	/**
+	 * Gets a context name based on property dialog type
+	 * 
+	 * @param dialogType
+	 *            the dialog type
+	 * @return the context name
+	 */
+	static String getPropertyDialogContext(int dialogType) {
+		return TraceBuilderHelp.HELP_CONTEXT_BASE
+				+ getPropertyDialogTypeContext(dialogType);
+	}
+
+	/**
+	 * Gets the context name based on check list dialog type
+	 * 
+	 * @param dialogType
+	 *            the dialog type
+	 * @return the context name
+	 */
+	static String getCheckListDialogContext(CheckListDialogType dialogType) {
+		return TraceBuilderHelp.HELP_CONTEXT_BASE
+				+ getCheckListDialogTypeContext(dialogType);
+	}
+
+	/**
+	 * Gets context name based on property dialog type
+	 * 
+	 * @param dialogType
+	 *            the type of the property dialog
+	 * @return the context identifier
+	 */
+	private static String getPropertyDialogTypeContext(int dialogType) {
+		String retval;
+		switch (dialogType) {
+		case TraceObjectPropertyDialog.ADD_TRACE:
+			retval = TraceBuilderHelp.ADD_TRACE_HELP_CONTEXT;
+			break;
+		case TraceObjectPropertyDialog.ADD_PARAMETER:
+			retval = TraceBuilderHelp.ADD_PARAMETER_HELP_CONTEXT;
+			break;
+		case TraceObjectPropertyDialog.SELECT_COMPONENT:
+			retval = TraceBuilderHelp.SELECT_COMPONENT_HELP_CONTEXT;
+			break;
+		case TraceObjectPropertyDialog.EDIT_GROUP:
+			retval = TraceBuilderHelp.EDIT_PROPERTIES_HELP_CONTEXT;
+			break;
+		case TraceObjectPropertyDialog.EDIT_TRACE:
+			retval = TraceBuilderHelp.EDIT_PROPERTIES_HELP_CONTEXT;
+			break;
+		case TraceObjectPropertyDialog.ADD_CONSTANT:
+			retval = TraceBuilderHelp.ADD_ENUM_HELP_CONTEXT;
+			break;
+		case TraceObjectPropertyDialog.EDIT_CONSTANT:
+			retval = TraceBuilderHelp.EDIT_PROPERTIES_HELP_CONTEXT;
+			break;
+		case TraceObjectPropertyDialog.EDIT_CONSTANT_TABLE:
+			retval = TraceBuilderHelp.EDIT_PROPERTIES_HELP_CONTEXT;
+			break;
+		case TraceObjectPropertyDialog.INSTRUMENTER:
+			retval = TraceBuilderHelp.INSTRUMENTER_HELP_CONTEXT;
+			break;
+		default:
+			retval = null;
+			break;
+		}
+		return retval;
+	}
+
+	/**
+	 * Gets context name based on check list dialog type
+	 * 
+	 * @param dialogType
+	 *            the type of the check list dialog
+	 * @return the context identifier
+	 */
+	private static String getCheckListDialogTypeContext(
+			CheckListDialogType dialogType) {
+		String retval;
+		switch (dialogType) {
+		case DELETE_TRACES:
+			retval = TraceBuilderHelp.DELETE_TRACES_HELP_CONTEXT;
+			break;
+		case INSTRUMENT_FILES:
+			retval = TraceBuilderHelp.INSTRUMENTER_HELP_CONTEXT;
+			break;
+		default:
+			retval = null;
+			break;
+		}
+		return retval;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceViewHelpListener.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 viewer help listener
+*
+*/
+package com.nokia.tracebuilder.view;
+
+import org.eclipse.swt.events.HelpEvent;
+import org.eclipse.swt.events.HelpListener;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.tracebuilder.engine.TraceBuilderHelp;
+
+/**
+ * Tree viewer help listener
+ * 
+ */
+final class TraceViewHelpListener implements HelpListener {
+
+	/**
+	 * Constructor
+	 * 
+	 */
+	TraceViewHelpListener() {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.swt.events.HelpListener#
+	 * helpRequested(org.eclipse.swt.events.HelpEvent)
+	 */
+	public void helpRequested(HelpEvent e) {
+		PlatformUI.getWorkbench().getHelpSystem().displayHelp(
+				TraceBuilderHelp.HELP_CONTEXT_BASE
+						+ TraceBuilderHelp.TREE_VIEWER_HELP_CONTEXT);
+
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceViewMessages.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,415 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* UI message builder
+*
+*/
+package com.nokia.tracebuilder.view;
+
+import com.nokia.tracebuilder.engine.TraceBuilderErrorMessages;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialog;
+import com.nokia.tracebuilder.engine.TraceBuilderDialogs.CheckListDialogType;
+import com.nokia.tracebuilder.engine.TraceBuilderDialogs.DeleteObjectQueryParameters;
+import com.nokia.tracebuilder.engine.TraceBuilderDialogs.FileQueryParameters;
+import com.nokia.tracebuilder.engine.TraceBuilderDialogs.QueryDialogParameters;
+import com.nokia.tracebuilder.model.TraceParameter;
+
+/**
+ * UI message builder
+ * 
+ */
+class TraceViewMessages {
+
+	/**
+	 * Maximum length for a name in property dialog UI
+	 */
+	private static final int MAX_NAME_LENGTH = 36; // CodForChk_Dis_Magic
+
+	/**
+	 * Mappings from parameter types to labels
+	 */
+	static final String[][] PARAMETER_LABEL_MAP = {
+			// Order of two first parameter types is important, so do not change
+			// order of those, because it affect to implementation of
+			// PropertyDialogUIType class.
+			{ TraceParameter.SDEC32,
+					Messages.getString("TraceViewMessages.Signed32") }, //$NON-NLS-1$
+			{ TraceParameter.UDEC32,
+					Messages.getString("TraceViewMessages.Unsigned32") }, //$NON-NLS-1$
+			{ TraceParameter.OCT32,
+					Messages.getString("TraceViewMessages.Octal32") }, //$NON-NLS-1$	
+			{ TraceParameter.HEX32,
+					Messages.getString("TraceViewMessages.Hex32") }, //$NON-NLS-1$
+			{ TraceParameter.HEX16,
+					Messages.getString("TraceViewMessages.Hex16") }, //$NON-NLS-1$
+			{ TraceParameter.SDEC16,
+					Messages.getString("TraceViewMessages.Signed16") }, //$NON-NLS-1$
+			{ TraceParameter.UDEC16,
+					Messages.getString("TraceViewMessages.Unsigned16") }, //$NON-NLS-1$
+			{ TraceParameter.OCT16,
+					Messages.getString("TraceViewMessages.Octal16") }, //$NON-NLS-1$					
+			{ TraceParameter.HEX8, Messages.getString("TraceViewMessages.Hex8") }, //$NON-NLS-1$
+			{ TraceParameter.SDEC8,
+					Messages.getString("TraceViewMessages.Signed8") }, //$NON-NLS-1$
+			{ TraceParameter.UDEC8,
+					Messages.getString("TraceViewMessages.Unsigned8") },//$NON-NLS-1$
+			{ TraceParameter.OCT8,
+					Messages.getString("TraceViewMessages.Octal8") },//$NON-NLS-1$					
+			{ TraceParameter.HEX64,
+					Messages.getString("TraceViewMessages.Hex64") }, //$NON-NLS-1$
+			{ TraceParameter.SDEC64,
+					Messages.getString("TraceViewMessages.Signed64") }, //$NON-NLS-1$
+			{ TraceParameter.UDEC64,
+					Messages.getString("TraceViewMessages.Unsigned64") }, //$NON-NLS-1$
+			{ TraceParameter.OCT64,
+					Messages.getString("TraceViewMessages.Octal64") }, //$NON-NLS-1$
+			{ TraceParameter.FLOAT_FIX,
+					Messages.getString("TraceViewMessages.FloatFix") }, //$NON-NLS-1$
+			{ TraceParameter.FLOAT_EXP,
+					Messages.getString("TraceViewMessages.FloatExp") }, //$NON-NLS-1$
+			{ TraceParameter.FLOAT_OPT,
+					Messages.getString("TraceViewMessages.FloatOpt") }, //$NON-NLS-1$
+			{ TraceParameter.ASCII,
+					Messages.getString("TraceViewMessages.Ascii") }, //$NON-NLS-1$
+			{ TraceParameter.UNICODE,
+					Messages.getString("TraceViewMessages.Unicode") }, //$NON-NLS-1$
+			{ TraceParameter.POINTER,
+					Messages.getString("TraceViewMessages.Pointer") }, //$NON-NLS-1$					
+	};
+
+	/**
+	 * Not constructed
+	 */
+	private TraceViewMessages() {
+	}
+
+	/**
+	 * Gets confirmation query text
+	 * 
+	 * @param parameters
+	 *            parameters for the query
+	 * @return the query text
+	 */
+	static String getConfirmationQueryText(QueryDialogParameters parameters) {
+		StringBuffer sb = new StringBuffer();
+		String s;
+		switch (parameters.dialogType) {
+		case DELETE_GROUP:
+			sb.append(Messages
+					.getString("TraceViewMessages.DeleteTraceGroupPrefix")); //$NON-NLS-1$
+			sb.append(((DeleteObjectQueryParameters) parameters).objectName);
+			sb.append(Messages
+					.getString("TraceViewMessages.DeleteTraceGroupPostfix")); //$NON-NLS-1$
+			break;
+		case DELETE_TRACE:
+			s = Messages.getString("TraceViewMessages.DeleteTracePrefix"); //$NON-NLS-1$
+			sb.append(s);
+			sb.append(((DeleteObjectQueryParameters) parameters).objectName);
+			s = Messages.getString("TraceViewMessages.DeleteTraceMiddle"); //$NON-NLS-1$
+			sb.append(s);
+			sb.append(((DeleteObjectQueryParameters) parameters).ownerName);
+			sb.append(Messages
+					.getString("TraceViewMessages.DeleteTracePostfix")); //$NON-NLS-1$
+			break;
+		case DELETE_PARAMETER:
+			sb.append(Messages
+					.getString("TraceViewMessages.DeleteParameterPrefix")); //$NON-NLS-1$
+			sb.append(((DeleteObjectQueryParameters) parameters).objectName);
+			sb.append(Messages
+					.getString("TraceViewMessages.DeleteParameterMiddle")); //$NON-NLS-1$
+			sb.append(((DeleteObjectQueryParameters) parameters).ownerName);
+			sb.append(Messages
+					.getString("TraceViewMessages.DeleteParameterPostfix")); //$NON-NLS-1$
+			break;
+		case DELETE_CONSTANT_TABLE:
+			sb.append(Messages
+					.getString("TraceViewMessages.DeleteConstTablePrefix")); //$NON-NLS-1$
+			sb.append(((DeleteObjectQueryParameters) parameters).objectName);
+			sb.append(Messages
+					.getString("TraceViewMessages.DeleteConstTablePostfix")); //$NON-NLS-1$
+			break;
+		case DELETE_CONSTANT:
+			sb.append(Messages
+					.getString("TraceViewMessages.DeleteConstantPrefix")); //$NON-NLS-1$
+			sb.append(((DeleteObjectQueryParameters) parameters).objectName);
+			sb.append(Messages
+					.getString("TraceViewMessages.DeleteConstantMiddle")); //$NON-NLS-1$
+			sb.append(((DeleteObjectQueryParameters) parameters).ownerName);
+			sb.append(Messages
+					.getString("TraceViewMessages.DeleteConstantPostfix")); //$NON-NLS-1$
+			break;
+		case UPDATE_WHEN_SOURCE_NOT_OPEN:
+			sb.append(Messages
+					.getString("TraceViewMessages.UpdateWhenSourceNotOpen")); //$NON-NLS-1$
+			break;
+		case REPLACE_FILE:
+			s = Messages.getString("TraceViewMessages.ReplaceFilePrefix"); //$NON-NLS-1$
+			sb.append(s);
+			sb.append(TraceBuilderErrorMessages
+					.convertPath(((FileQueryParameters) parameters).path));
+			sb.append(Messages
+					.getString("TraceViewMessages.ReplaceFilePostfix")); //$NON-NLS-1$
+			break;
+		case IMPORT_TRACE_PROJECT:
+			s = Messages.getString("TraceViewMessages.ImportTraceProjectText"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case SELECT_TARGET_ENVIRONMENT:
+			s = Messages
+					.getString("TraceViewMessages.SelectEnvironmentDialogTitle"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		default:
+			break;
+		}
+		return sb.toString();
+	}
+
+	/**
+	 * Gets the title for the checklist
+	 * 
+	 * @param type
+	 *            the check list type
+	 * @return the message
+	 */
+	static String getCheckListTitle(CheckListDialogType type) {
+		String retval;
+		switch (type) {
+		case DELETE_TRACES:
+			retval = Messages.getString("TraceViewMessages.DeleteTracesTitle"); //$NON-NLS-1$
+			break;
+		case INSTRUMENT_FILES:
+			retval = Messages
+					.getString("TraceViewMessages.InstrumentFilesTitle"); //$NON-NLS-1$
+			break;
+		default:
+			retval = ""; //$NON-NLS-1$
+			break;
+		}
+		return retval;
+	}
+
+	/**
+	 * Gets the message for the checklist
+	 * 
+	 * @param type
+	 *            the check list type
+	 * @return the message
+	 */
+	static String getCheckListText(CheckListDialogType type) {
+		String retval;
+		switch (type) {
+		case DELETE_TRACES:
+			retval = Messages.getString("TraceViewMessages.DeleteTracesHint"); //$NON-NLS-1$
+			break;
+		case INSTRUMENT_FILES:
+			retval = Messages
+					.getString("TraceViewMessages.InstrumentFilesHint"); //$NON-NLS-1$
+			break;
+		default:
+			retval = ""; //$NON-NLS-1$
+			break;
+		}
+		return retval;
+	}
+
+	/**
+	 * Maps parameter type to string
+	 * 
+	 * @param parameter
+	 *            the parameter
+	 * @return the type as string
+	 */
+	static String parameterTypeToString(TraceParameter parameter) {
+		String ret = null;
+		String type = parameter.getType();
+		if (type != null) {
+			for (int i = 0; i < PARAMETER_LABEL_MAP.length; i++) {
+				if (parameter.getType().equals(PARAMETER_LABEL_MAP[i][0])) {
+					ret = PARAMETER_LABEL_MAP[i][1];
+				}
+			}
+			if (ret == null) {
+				ret = parameter.getType();
+			}
+		} else {
+			ret = Messages.getString("TraceViewMessages.UnknownType"); //$NON-NLS-1$
+		}
+		return ret;
+	}
+
+	/**
+	 * Gets the property dialog title based on dialog type
+	 * 
+	 * @param dialogType
+	 *            the dialog type
+	 * @return the dialog title
+	 */
+	static String getPropertyDialogTitle(int dialogType) {
+		return getPropertyDialogCaption(dialogType);
+	}
+
+	/**
+	 * Gets the dialog caption based on dialog type
+	 * 
+	 * @param dialogType
+	 *            the dialog type
+	 * @return the caption
+	 */
+	static String getPropertyDialogCaption(int dialogType) {
+		String caption;
+		switch (dialogType) {
+		case TraceObjectPropertyDialog.EDIT_GROUP:
+			caption = Messages.getString("PropertyDialog.EditGroupCaption"); //$NON-NLS-1$
+			break;
+		case TraceObjectPropertyDialog.ADD_TRACE:
+			caption = Messages.getString("PropertyDialog.AddTraceCaption"); //$NON-NLS-1$
+			break;
+		case TraceObjectPropertyDialog.EDIT_TRACE:
+			caption = Messages.getString("PropertyDialog.EditTraceCaption"); //$NON-NLS-1$
+			break;
+		case TraceObjectPropertyDialog.ADD_PARAMETER:
+			caption = Messages.getString("PropertyDialog.AddParameterCaption"); //$NON-NLS-1$
+			break;
+		case TraceObjectPropertyDialog.SELECT_COMPONENT:
+			caption = Messages
+					.getString("TraceViewMessages.SelectComponentCaption"); //$NON-NLS-1$
+			break;
+		case TraceObjectPropertyDialog.ADD_CONSTANT:
+			caption = Messages.getString("PropertyDialog.AddConstantCaption"); //$NON-NLS-1$
+			break;
+		case TraceObjectPropertyDialog.EDIT_CONSTANT:
+			caption = Messages.getString("PropertyDialog.EditConstantCaption"); //$NON-NLS-1$
+			break;
+		case TraceObjectPropertyDialog.EDIT_CONSTANT_TABLE:
+			caption = Messages
+					.getString("PropertyDialog.EditConstantTableCaption"); //$NON-NLS-1$
+			break;
+		case TraceObjectPropertyDialog.INSTRUMENTER:
+			caption = Messages.getString("TraceViewMessages.InstrumentCaption"); //$NON-NLS-1$
+			break;
+		default:
+			caption = ""; //$NON-NLS-1$
+			break;
+		}
+		return caption;
+	}
+
+	/**
+	 * Gets the property dialog message
+	 * 
+	 * @param dialogType
+	 *            the type of the property dialog
+	 * @param target
+	 *            the target object of the property dialog
+	 * @return the dialog message
+	 */
+	static String getPropertyDialogMessage(int dialogType, String target) {
+		String hint;
+		StringBuffer sb;
+		switch (dialogType) {
+		case TraceObjectPropertyDialog.EDIT_GROUP:
+			sb = new StringBuffer();
+			sb.append(Messages.getString("PropertyDialog.EditGroupHintPrefix")); //$NON-NLS-1$
+			hint = Messages.getString("PropertyDialog.EditGroupHintPostfix"); //$NON-NLS-1$
+			sb.append(getName(target, hint));
+			sb.append(hint);
+			hint = sb.toString();
+			break;
+		case TraceObjectPropertyDialog.ADD_TRACE:
+			hint = Messages.getString("PropertyDialog.AddTraceHint"); //$NON-NLS-1$
+			break;
+		case TraceObjectPropertyDialog.EDIT_TRACE:
+			sb = new StringBuffer();
+			sb.append(Messages.getString("PropertyDialog.EditTraceHintPrefix")); //$NON-NLS-1$
+			hint = Messages.getString("PropertyDialog.EditTraceHintPostfix"); //$NON-NLS-1$
+			sb.append(getName(target, hint));
+			sb.append(hint);
+			hint = sb.toString();
+			break;
+		case TraceObjectPropertyDialog.ADD_PARAMETER:
+			sb = new StringBuffer();
+			sb.append(Messages
+					.getString("PropertyDialog.AddTraceParameterHintPrefix")); //$NON-NLS-1$
+			hint = Messages
+					.getString("PropertyDialog.AddTraceParameterHintPostfix"); //$NON-NLS-1$
+			sb.append(getName(target, hint));
+			sb.append(hint);
+			hint = sb.toString();
+			break;
+		case TraceObjectPropertyDialog.SELECT_COMPONENT:
+			sb = new StringBuffer();
+			sb.append(Messages
+					.getString("PropertyDialog.SelectComponentHintPrefix")); //$NON-NLS-1$
+			sb.append(Messages
+					.getString("PropertyDialog.SelectComponentHintPostfix")); //$NON-NLS-1$
+			hint = sb.toString();
+			break;
+		case TraceObjectPropertyDialog.ADD_CONSTANT:
+			hint = Messages.getString("PropertyDialog.AddConstantHint"); //$NON-NLS-1$
+			break;
+		case TraceObjectPropertyDialog.EDIT_CONSTANT:
+			sb = new StringBuffer();
+			sb.append(Messages
+					.getString("PropertyDialog.EditConstantHintPrefix")); //$NON-NLS-1$
+			hint = Messages.getString("PropertyDialog.EditConstantHintPostfix"); //$NON-NLS-1$
+			sb.append(getName(target, hint));
+			sb.append(hint);
+			hint = sb.toString();
+			break;
+
+		case TraceObjectPropertyDialog.EDIT_CONSTANT_TABLE:
+			sb = new StringBuffer();
+			sb.append(Messages
+					.getString("PropertyDialog.EditConstantTableHintPrefix")); //$NON-NLS-1$
+			hint = Messages
+					.getString("PropertyDialog.EditConstantTableHintPostfix"); //$NON-NLS-1$
+			sb.append(getName(target, hint));
+			sb.append(hint);
+			hint = sb.toString();
+			break;
+		case TraceObjectPropertyDialog.INSTRUMENTER:
+			hint = Messages.getString("PropertyDialog.InstrumenterHint"); //$NON-NLS-1$
+			break;
+		default:
+			hint = ""; //$NON-NLS-1$
+			break;
+		}
+		return hint;
+	}
+
+	/**
+	 * Gets the name of the object and truncates if too long
+	 * 
+	 * @param target
+	 *            the target object
+	 * @param postfix
+	 *            the postfix
+	 * @return the name
+	 */
+	private static String getName(String target, String postfix) {
+		String retval = target;
+		if (retval.length() > MAX_NAME_LENGTH) {
+			String str;
+			if (postfix.startsWith(".")) { //$NON-NLS-1$
+				str = ".."; //$NON-NLS-1$
+			} else {
+				str = "..."; //$NON-NLS-1$
+			}
+			retval = retval.substring(0, MAX_NAME_LENGTH - str.length()) + str;
+		}
+		return retval;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceViewPlugin.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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.tracebuilder.view;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class TraceViewPlugin extends AbstractUIPlugin {
+
+	/**
+	 * The plug-in ID
+	 */
+	public static final String PLUGIN_ID = "com.nokia.tracebuilder.view"; //$NON-NLS-1$
+
+	/**
+	 * The shared instance
+	 */
+	private static TraceViewPlugin plugin;
+
+	/**
+	 * The constructor
+	 */
+	public TraceViewPlugin() {
+		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 an image descriptor for the image file at the given plug-in
+	 * relative path.
+	 * 
+	 * @param path
+	 *            the path
+	 * @return the image descriptor
+	 */
+	public static ImageDescriptor getImageDescriptor(String path) {
+		return AbstractUIPlugin.imageDescriptorFromPlugin(
+				"com.nokia.tracebuilder.view", path); //$NON-NLS-1$		
+	}
+
+	/**
+	 * Returns the shared instance
+	 * 
+	 * @return the shared instance
+	 */
+	public static TraceViewPlugin getDefault() {
+		return plugin;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceViewSelectionListener.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,204 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 listener for tree viewer
+*
+*/
+package com.nokia.tracebuilder.view;
+
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+
+import com.nokia.tracebuilder.engine.LastKnownLocation;
+import com.nokia.tracebuilder.engine.TraceBuilderActions;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceLocation;
+import com.nokia.tracebuilder.engine.TraceLocationList;
+import com.nokia.tracebuilder.engine.TraceViewExtension;
+import com.nokia.tracebuilder.model.TraceObject;
+
+/**
+ * Selection listener for tree viewer. Updates the active object of TraceBuilder
+ * 
+ */
+final class TraceViewSelectionListener implements ISelectionChangedListener,
+		IDoubleClickListener {
+
+	/**
+	 * TraceBuilder actions interface
+	 */
+	private TraceBuilderActions actions;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param actions
+	 *            TraceBuilder actions interface
+	 */
+	TraceViewSelectionListener(TraceBuilderActions actions) {
+		this.actions = actions;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.viewers.ISelectionChangedListener#
+	 *      selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
+	 */
+	public void selectionChanged(SelectionChangedEvent event) {
+		ISelection selection = event.getSelection();
+		selectionChanged(selection, false);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.viewers.IDoubleClickListener#
+	 *      doubleClick(org.eclipse.jface.viewers.DoubleClickEvent)
+	 */
+	public void doubleClick(DoubleClickEvent event) {
+		ISelection selection = event.getSelection();
+		selectionChanged(selection, true);
+	}
+
+	/**
+	 * Selection change processor
+	 * 
+	 * @param selection
+	 *            the new selection
+	 * @param doubleClick
+	 *            true if selection was made by double-click
+	 */
+	private void selectionChanged(ISelection selection, boolean doubleClick) {
+		TraceObject object = null;
+		TraceLocation location = null;
+		TraceLocationList locationList = null;
+		LastKnownLocation LastKnownLocation = null;
+		TraceViewExtension extension = null;
+		if (!selection.isEmpty() && selection instanceof IStructuredSelection) {
+			Object element = ((IStructuredSelection) selection)
+					.getFirstElement();
+			boolean rootFound = false;
+			boolean elementFound;
+			do {
+				elementFound = false;
+				// Selects the closest TraceObject parent of the selected
+				// element
+				if (element instanceof TraceObjectWrapper) {
+					// Activates the trace object.
+					object = ((TraceObjectWrapper) element).getTraceObject();
+					elementFound = true;
+				} else if (element instanceof TraceLocationWrapper) {
+					TraceLocationWrapper locationWrapper = (TraceLocationWrapper) element;
+					TraceLocationListWrapper listWrapper = (TraceLocationListWrapper) locationWrapper
+							.getParent();
+					// Activates the location
+					location = locationWrapper.getLocation();
+					if (location != null) {
+						locationList = listWrapper.getLocationList();
+					}
+					elementFound = true;
+				} else if (element instanceof TraceLocationListWrapper) {
+					locationList = ((TraceLocationListWrapper) element)
+							.getLocationList();
+					elementFound = true;
+				} else if (element instanceof LastKnownLocationWrapper) {
+					LastKnownLocationWrapper locationWrapper = (LastKnownLocationWrapper) element;
+					LastKnownLocation = locationWrapper.getLocation();
+					elementFound = true;
+				} else if (element instanceof TraceViewExtensionWrapper) {
+					TraceViewExtensionWrapper wrapper = (TraceViewExtensionWrapper) element;
+					extension = wrapper.getExtension();
+					object = ((TraceObjectWrapper) wrapper.getParent())
+							.getTraceObject();
+					elementFound = true;
+				} else if (element instanceof ListNavigator) {
+					extension = ((ListNavigator) element).getActionProvider();
+					elementFound = true;
+				} else if (element instanceof WrapperBase) {
+					// If selection was not supported, the parent is tried
+					element = ((WrapperBase) element).getParent();
+				} else {
+					rootFound = true;
+				}
+				// If the wrapper element was found but object does not exist,
+				// the object has been deleted, but view is not yet updated
+				// -> Parent is selected
+				if (elementFound && object == null && locationList == null
+						&& location == null && extension == null
+						&& LastKnownLocation == null) {
+					element = ((WrapperBase) element).getParent();
+				}
+			} while (object == null && locationList == null && location == null
+					&& extension == null && LastKnownLocation == null
+					&& !rootFound);
+		}
+		notifySelection(object, location, locationList, LastKnownLocation,
+				extension, doubleClick);
+	}
+
+	/**
+	 * Notification about selected object
+	 * 
+	 * @param object
+	 *            trace object
+	 * @param location
+	 *            trace location
+	 * @param locationList
+	 *            trace location list
+	 * @param LastKnownLocation
+	 *            last known location
+	 * @param extension
+	 *            extension
+	 * @param doubleClick
+	 *            double click flag
+	 */
+	private void notifySelection(TraceObject object, TraceLocation location,
+			TraceLocationList locationList,
+			LastKnownLocation LastKnownLocation,
+			TraceViewExtension extension, boolean doubleClick) {
+		if (extension != null) {
+			// Enables the actions based on the selected extension, but passes
+			// the TraceObject to TraceBuilder
+			TraceBuilderGlobals.getTraceBuilder().traceObjectSelected(object,
+					false, false);
+			actions.enableActions(extension);
+		} else if (object != null) {
+			// Selection and actions are based on the TraceObject
+			TraceBuilderGlobals.getTraceBuilder().traceObjectSelected(object,
+					false, false);
+			actions.enableActions(object);
+		} else if (location != null) {
+			// Selection and actions are based on the TraceLocation
+			TraceBuilderGlobals.getTraceBuilder().locationSelected(
+					locationList, location, false);
+			actions.enableActions(location);
+		} else if (locationList != null) {
+			// Selection and actions are based on the TraceLocationList
+			TraceBuilderGlobals.getTraceBuilder().locationSelected(
+					locationList, null, false);
+			actions.enableActions(locationList);
+		} else if (LastKnownLocation != null) {
+			TraceBuilderGlobals.getTraceBuilder().traceObjectSelected(
+					LastKnownLocation.getTrace(), false, false);
+			actions.enableActions(LastKnownLocation);
+		}
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceViewTreeListener.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,104 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 listener for tree viewer
+*
+*/
+package com.nokia.tracebuilder.view;
+
+import java.util.Iterator;
+
+import org.eclipse.jface.viewers.ITreeViewerListener;
+import org.eclipse.jface.viewers.TreeExpansionEvent;
+import org.eclipse.jface.viewers.TreeViewer;
+
+import com.nokia.tracebuilder.engine.TraceBuilderConfiguration;
+
+/**
+ * Tree expansion listener
+ * 
+ */
+final class TraceViewTreeListener implements ITreeViewerListener {
+
+	/**
+	 * The tree viewer
+	 */
+	private TreeViewer viewer;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param viewer
+	 *            the tree viewer
+	 */
+	TraceViewTreeListener(TreeViewer viewer) {
+		this.viewer = viewer;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.viewers.ITreeViewerListener#
+	 *      treeCollapsed(org.eclipse.jface.viewers.TreeExpansionEvent)
+	 */
+	public void treeCollapsed(TreeExpansionEvent event) {
+		ListWrapper wrapper = (ListWrapper) event.getElement();
+		// The visible child wrappers of the collapsed wrapper are marked with
+		// the "restore into view" flag. When the wrapper is re-opened, its
+		// visible children are also re-opened
+		Iterator<WrapperBase> itr = wrapper.getVisibleWrappers();
+		while (itr.hasNext()) {
+			itr.next().setRestoreIntoView(true);
+		}
+		// Children of collapsed wrapper are no longer in view
+		wrapper.setChildrenInView(false);
+		if (TraceBuilderConfiguration.TRACE_VIEW_STATE) {
+			((TraceContentProvider) viewer.getContentProvider())
+					.dumpToSystemOut(((TraceLabelProvider) viewer
+							.getLabelProvider()));
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.viewers.ITreeViewerListener#
+	 *      treeExpanded(org.eclipse.jface.viewers.TreeExpansionEvent)
+	 */
+	public void treeExpanded(TreeExpansionEvent event) {
+		final ListWrapper wrapper = (ListWrapper) event.getElement();
+		if (wrapper instanceof TraceWrapper
+				|| wrapper instanceof TraceGroupWrapper) {
+			// Collapses other wrappers and marks them as not shown in
+			// view -> Optimizes the location list updates
+			wrapper.collapseSiblings(viewer);
+		}
+		// The child wrappers of the expanded wrapper are now in view
+		Iterator<WrapperBase> itr = wrapper.getVisibleWrappers();
+		while (itr.hasNext()) {
+			WrapperBase child = itr.next();
+			child.setInView(true);
+			// The children of the expanded wrapper are updated since they might
+			// have been changed while hidden
+			child.getUpdater().queueUpdate(child);
+		}
+		if (TraceBuilderConfiguration.TRACE_VIEW_STATE) {
+			((TraceContentProvider) viewer.getContentProvider())
+					.dumpToSystemOut(((TraceLabelProvider) viewer
+							.getLabelProvider()));
+		}
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceViewUpdater.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,136 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Background thread that schedules tree view refreshes
+*
+*/
+package com.nokia.tracebuilder.view;
+
+import org.eclipse.jface.viewers.TreeViewer;
+
+/**
+ * Background thread that schedules tree view refreshes
+ * 
+ */
+final class TraceViewUpdater extends Thread implements WrapperUpdater {
+
+	/**
+	 * View refresh timeout
+	 */
+	private final static int VIEW_REFRESH_TIMEOUT = 50; // CodForChk_Dis_Magic
+
+	/**
+	 * Running flag
+	 */
+	private boolean running;
+
+	/**
+	 * Async refresher timeout
+	 */
+	private long timeout;
+
+	/**
+	 * The view updater process
+	 */
+	private TraceViewUpdaterRunnable updaterRunnable;
+
+	/**
+	 * Tree viewer
+	 */
+	private TreeViewer viewer;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param viewer
+	 *            the viewer to be refreshed
+	 */
+	TraceViewUpdater(TreeViewer viewer) {
+		this.viewer = viewer;
+		updaterRunnable = new TraceViewUpdaterRunnable(viewer);
+		timeout = VIEW_REFRESH_TIMEOUT;
+		running = true;
+		start();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Runnable#run()
+	 */
+	@Override
+	public void run() {
+		while (running) {
+			try {
+				if (running && !updaterRunnable.hasUpdates()) {
+					Thread.sleep(timeout);
+				}
+				if (running && updaterRunnable.hasUpdates()) {
+					// Updates one viewer element
+					viewer.getControl().getDisplay().syncExec(updaterRunnable);
+				}
+			} catch (Exception e) {
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.view.WrapperUpdater#
+	 *      queueUpdate(com.nokia.tracebuilder.view.WrapperBase)
+	 */
+	public void queueUpdate(WrapperBase wrapper) {
+		updaterRunnable.queueUpdate(wrapper);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.view.WrapperUpdater#
+	 *      queueSelection(com.nokia.tracebuilder.view.WrapperBase)
+	 */
+	public void queueSelection(WrapperBase wrapper) {
+		updaterRunnable.queueSelection(wrapper);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.view.WrapperUpdater#
+	 *      update(com.nokia.tracebuilder.view.WrapperBase)
+	 */
+	public void update(WrapperBase wrapper) {
+		viewer.refresh(wrapper);
+	}
+
+	/**
+	 * Stops the thread
+	 */
+	void stopUpdater() {
+		running = false;
+	}
+
+	/**
+	 * Sets the root wrapper
+	 * 
+	 * @param modelWrapper
+	 *            the root wrapper
+	 */
+	void setRoot(TraceModelWrapper modelWrapper) {
+		updaterRunnable.setRoot(modelWrapper);
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceViewUpdaterRunnable.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,173 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 runnable that is passed to Display#syncExec when refreshing the view
+*
+*/
+package com.nokia.tracebuilder.view;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+
+/**
+ * A runnable that is passed to Display#syncExec when refreshing the view
+ * 
+ */
+final class TraceViewUpdaterRunnable implements Runnable {
+
+	/**
+	 * Tree viewer
+	 */
+	private TreeViewer viewer;
+
+	/**
+	 * Root element of the tree
+	 */
+	private WrapperBase root;
+
+	/**
+	 * List of elements to be refreshed
+	 */
+	private ArrayList<WrapperBase> updateList;
+
+	/**
+	 * Object to be selected after all updates have been run
+	 */
+	private WrapperBase selection;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param viewer
+	 *            tree viewer
+	 */
+	TraceViewUpdaterRunnable(TreeViewer viewer) {
+		this.viewer = viewer;
+		updateList = new ArrayList<WrapperBase>();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Runnable#run()
+	 */
+	public void run() {
+		if (!viewer.getControl().isDisposed()) {
+			// long time = System.currentTimeMillis();
+			Iterator<WrapperBase> itr = updateList.iterator();
+			if (itr.hasNext()) {
+				WrapperBase wrapper = itr.next();
+				if (wrapper == root) {
+					viewer.refresh();
+				} else {
+					viewer.refresh(wrapper);
+				}
+				itr.remove();
+			} else if (selection != null) {
+				viewer.setSelection(new StructuredSelection(selection), true);
+				selection = null;
+			}
+		}
+	}
+
+	/**
+	 * Adds a wrapper to the list of elements to be updated
+	 * 
+	 * @param wrapper
+	 *            the wrapper to be updated
+	 */
+	void queueUpdate(WrapperBase wrapper) {
+		// Adds the element to the update list if it or one of its parents
+		// if not already there
+		boolean parentFound = false;
+		boolean childFound = false;
+		Iterator<WrapperBase> itr = updateList.iterator();
+		while (itr.hasNext() && !parentFound) {
+			WrapperBase existing = itr.next();
+			// If a parent is found from the list, the new element is not
+			// added to it. If a child is found, it is removed and the new
+			// element is added. Loop is not terminated if child is found,
+			// since there might be other children to be removed.
+			if (!childFound && isParent(existing, wrapper)) {
+				parentFound = true;
+			} else if (isParent(wrapper, existing)) {
+				childFound = true;
+				itr.remove();
+			}
+		}
+		// If the wrapper or one of its parents was already in the list, it
+		// is not added
+		if (!parentFound) {
+			updateList.add(wrapper);
+		}
+	}
+
+	/**
+	 * Queues a selection operation. The selection is done after all updates and
+	 * if there was an existing selection operation, it is replaced with the new
+	 * one.
+	 * 
+	 * @param wrapper
+	 *            the wrapper to be selected
+	 */
+	void queueSelection(WrapperBase wrapper) {
+		selection = wrapper;
+	}
+
+	/**
+	 * Checks if existing is the same or the parent of wrapper.
+	 * 
+	 * @param existing
+	 *            the possible parent
+	 * @param wrapper
+	 *            the new wrapper
+	 * @return true if existing is parent or the same as wrapper
+	 */
+	private boolean isParent(WrapperBase existing, WrapperBase wrapper) {
+		WrapperBase parent = wrapper;
+		boolean found = false;
+		while (!found && parent != null) {
+			if (parent == existing) {
+				found = true;
+			} else {
+				parent = parent.getParent();
+			}
+		}
+		return found;
+	}
+
+	/**
+	 * This function is called from the updater background thread and thus the
+	 * list is accessed from both threads
+	 * 
+	 * @return true
+	 */
+	boolean hasUpdates() {
+		return !updateList.isEmpty() || selection != null;
+	}
+
+	/**
+	 * Sets the root wrapper
+	 * 
+	 * @param root
+	 *            the root wrapper
+	 */
+	void setRoot(WrapperBase root) {
+		this.root = root;
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/TraceWrapper.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,231 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Wrapper for one trace object
+*
+*/
+package com.nokia.tracebuilder.view;
+
+import com.nokia.tracebuilder.engine.LastKnownLocationList;
+import com.nokia.tracebuilder.engine.TraceLocationList;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceParameter;
+
+/**
+ * Wrapper for one trace object
+ * 
+ * @see com.nokia.tracebuilder.model.Trace
+ */
+final class TraceWrapper extends TraceObjectWrapper {
+
+	/**
+	 * Last known location list wrapper
+	 */
+	private LastKnownLocationListWrapper LastKnownLocationListWrapper;
+
+	/**
+	 * List of object parameters
+	 */
+	private TraceParameterListWrapper parameterListWrapper;
+
+	/**
+	 * Location list wrapper
+	 */
+	private TraceLocationListWrapper locationListWrapper;
+
+	/**
+	 * Default constructor
+	 * 
+	 * @param trace
+	 *            the trace
+	 * @param parent
+	 *            parent wrapper
+	 * @param updater
+	 *            the update notifier
+	 */
+	TraceWrapper(Trace trace, WrapperBase parent, WrapperUpdater updater) {
+		super(trace, parent, updater);
+		addParameterList();
+		TraceLocationList list = trace.getExtension(TraceLocationList.class);
+		if (list != null) {
+			setLocationList(list);
+		}
+		LastKnownLocationList plist = trace
+				.getExtension(LastKnownLocationList.class);
+		if (plist != null) {
+			setLastKnownLocationList(plist);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.view.TraceObjectWrapper#delete()
+	 */
+	@Override
+	void delete() {
+		if (locationListWrapper != null && !contains(locationListWrapper)) {
+			locationListWrapper.delete();
+		}
+		if (LastKnownLocationListWrapper != null
+				&& !contains(LastKnownLocationListWrapper)) {
+			LastKnownLocationListWrapper.delete();
+		}
+		super.delete();
+	}
+
+	/**
+	 * Creates and adds the parameter list
+	 */
+	void addParameterList() {
+		Trace trace = (Trace) getTraceObject();
+		parameterListWrapper = new TraceParameterListWrapper(trace, this,
+				getUpdater());
+		if (trace.hasParameters()) {
+			add(parameterListWrapper);
+		}
+	}
+
+	/**
+	 * Adds a parameter to the parameter list
+	 * 
+	 * @param parameter
+	 *            the parameter to be added
+	 * @return the wrapper which needs to be refreshed
+	 */
+	WrapperBase addParameter(TraceParameter parameter) {
+		if (parameterListWrapper.hasChildren()) {
+			// If parameters already exist, the parameter list is updated
+			parameterListWrapper.addParameter(parameter);
+		} else {
+			// If not, the parameter list is added
+			parameterListWrapper.addParameter(parameter);
+			add(parameterListWrapper);
+		}
+		return this;
+	}
+
+	/**
+	 * Removes a parameter
+	 * 
+	 * @param parameter
+	 *            the parameter to be removed
+	 * @return the wrapper which needs to be refreshed
+	 */
+	WrapperBase removeParameter(TraceParameter parameter) {
+		parameterListWrapper.removeParameter(parameter);
+		// If the parameter list no longer contains elements, it is removed
+		if (!parameterListWrapper.hasChildren()) {
+			hide(parameterListWrapper);
+		}
+		return this;
+	}
+
+	/**
+	 * Sets the last known location list to this object
+	 * 
+	 * @param list
+	 *            the location list
+	 * @return the wrapper to be updated
+	 */
+	WrapperBase setLastKnownLocationList(LastKnownLocationList list) {
+		if (list != null) {
+			if (LastKnownLocationListWrapper == null) {
+				LastKnownLocationListWrapper = new LastKnownLocationListWrapper(
+						list, this, getUpdater());
+				if (LastKnownLocationListWrapper.hasChildren()) {
+					add(LastKnownLocationListWrapper);
+				}
+			} else {
+				if (LastKnownLocationListWrapper.getLocationList() != list) {
+					LastKnownLocationListWrapper.updateLocationList(list);
+				}
+			}
+		} else {
+			if (LastKnownLocationListWrapper != null) {
+				LastKnownLocationListWrapper.updateLocationList(null);
+				hide(LastKnownLocationListWrapper);
+			}
+		}
+		return this;
+	}
+
+	/**
+	 * Shows the last known locations list
+	 */
+	void showLastKnownLocationList() {
+		add(LastKnownLocationListWrapper);
+	}
+
+	/**
+	 * Hides the last known locations list
+	 */
+	void hideLastKnownLocationList() {
+		hide(LastKnownLocationListWrapper);
+	}
+
+	/**
+	 * Sets the location list to this object
+	 * 
+	 * @param list
+	 *            the location list
+	 * @return the wrapper to be updated
+	 */
+	WrapperBase setLocationList(TraceLocationList list) {
+		if (list != null) {
+			if (locationListWrapper == null) {
+				locationListWrapper = new TraceLocationListWrapper(list, this,
+						getUpdater());
+				if (locationListWrapper.hasChildren()) {
+					add(locationListWrapper);
+				}
+			} else {
+				if (locationListWrapper.getLocationList() != list) {
+					locationListWrapper.updateLocationList(list);
+				}
+			}
+		} else {
+			if (locationListWrapper != null) {
+				locationListWrapper.updateLocationList(null);
+				hide(locationListWrapper);
+			}
+		}
+		return this;
+	}
+
+	/**
+	 * Shows the location list
+	 */
+	void showLocationList() {
+		add(locationListWrapper);
+	}
+
+	/**
+	 * Hides the location list
+	 */
+	void hideLocationList() {
+		hide(locationListWrapper);
+	}
+
+	/**
+	 * Gets the location list wrapper
+	 * 
+	 * @return the list wrapper
+	 */
+	TraceLocationListWrapper getLocationListWrapper() {
+		return locationListWrapper;
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/WrapperBase.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,222 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 view elements
+*
+*/
+package com.nokia.tracebuilder.view;
+
+import java.util.Iterator;
+
+import org.eclipse.jface.viewers.AbstractTreeViewer;
+import org.eclipse.jface.viewers.TreeViewer;
+
+import com.nokia.tracebuilder.engine.TraceBuilderConfiguration;
+
+/**
+ * Base class for tree view elements
+ * 
+ */
+abstract class WrapperBase {
+
+	/**
+	 * Parent wrapper
+	 */
+	private WrapperBase parent;
+
+	/**
+	 * Visibility flag, used to optimize view updates
+	 */
+	private boolean isInView;
+
+	/**
+	 * Restore visibility flag. When a tree element is expanded, the children of
+	 * children that have this flag are marked as visible
+	 */
+	private boolean restoreIntoView;
+
+	/**
+	 * View updater
+	 */
+	private WrapperUpdater updater;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parent
+	 *            the parent wrapper
+	 * @param updater
+	 *            the wrapper updater
+	 */
+	WrapperBase(WrapperBase parent, WrapperUpdater updater) {
+		this.parent = parent;
+		this.updater = updater;
+	}
+
+	/**
+	 * Gets the children
+	 * 
+	 * @return the children of this wrapper
+	 */
+	abstract Object[] getChildren();
+
+	/**
+	 * Checks if this wrapper has children
+	 * 
+	 * @return true if there are children
+	 */
+	abstract boolean hasChildren();
+
+	/**
+	 * Gets the parent
+	 * 
+	 * @return parent wrapper
+	 */
+	WrapperBase getParent() {
+		return parent;
+	}
+
+	/**
+	 * Clears the contents of this wrapper. Wrapper cannot be used after delete
+	 */
+	void delete() {
+		parent = null;
+	}
+
+	/**
+	 * Sets the shown in view flag
+	 * 
+	 * @param isInView
+	 *            the new flag value
+	 */
+	void setInView(boolean isInView) {
+		this.isInView = isInView;
+		if (parent != null && isInView) {
+			parent.setChildInView();
+		}
+	}
+
+	/**
+	 * Returns true if this wrapper is shown in the view
+	 * 
+	 * @return the shown in view flag
+	 */
+	boolean isInView() {
+		return isInView;
+	}
+
+	/**
+	 * Collapses the sibling wrappers of this wrapper
+	 * 
+	 * @param viewer
+	 *            the tree viewer
+	 */
+	void collapseSiblings(TreeViewer viewer) {
+		Iterator<WrapperBase> itr = ((ListWrapper) getParent())
+				.getVisibleWrappers();
+		while (itr.hasNext()) {
+			WrapperBase child = itr.next();
+			// The siblings are shown in view
+			child.setInView(true);
+			if (child != this && child instanceof ListWrapper) {
+				collapseSiblings(viewer, (ListWrapper) child);
+			}
+		}
+	}
+
+	/**
+	 * Collapses the sibling wrappers of this wrapper
+	 * 
+	 * @param viewer
+	 *            the viewer
+	 * @param child
+	 *            the child
+	 */
+	private void collapseSiblings(TreeViewer viewer, ListWrapper child) {
+		// The collapsed wrapper is shown in view, but it
+		// children are hidden
+		// If a sibling is shown, it is collapsed
+		boolean needsCollapse = child.hasChildren()
+				&& child.getVisibleWrappers().next().isInView();
+		if (needsCollapse) {
+			child.setChildrenInView(false);
+			viewer.collapseToLevel(child, AbstractTreeViewer.ALL_LEVELS);
+		}
+	}
+
+	/**
+	 * Dumps this object to System.out
+	 * 
+	 * @param indentLevel
+	 *            the indent level
+	 * @param provider
+	 *            the label provider
+	 */
+	void dumpToSystemOut(int indentLevel, TraceLabelProvider provider) {
+		if (TraceBuilderConfiguration.TRACE_VIEW_STATE) {
+			StringBuffer sb = new StringBuffer();
+			for (int i = 0; i < indentLevel; i++) {
+				sb.append("  "); //$NON-NLS-1$
+			}
+			sb.append(provider.getText(this));
+			System.out.println(sb);
+		}
+	}
+
+	/**
+	 * Gets the view update notifier
+	 * 
+	 * @return the update notifier
+	 */
+	WrapperUpdater getUpdater() {
+		return updater;
+	}
+
+	/**
+	 * Recursively flags the parents as in view
+	 */
+	private void setChildInView() {
+		isInView = true;
+		if (parent != null) {
+			parent.setChildInView();
+		}
+	}
+
+	/**
+	 * Sets restore into view flag. When a tree element is expanded, the child
+	 * elements that have this flag are marked as "in view"
+	 * 
+	 * @param flag
+	 *            the new flag value. This changes to true only if this wrapper
+	 *            is already visible
+	 */
+	void setRestoreIntoView(boolean flag) {
+		if (flag && isInView()) {
+			restoreIntoView = true;
+		} else {
+			restoreIntoView = false;
+		}
+	}
+
+	/**
+	 * Gets the restore into view flag
+	 * 
+	 * @return the flag
+	 */
+	boolean isRestoredIntoView() {
+		return restoreIntoView;
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/WrapperUpdater.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Updater interface for trace model wrappers
+*
+*/
+package com.nokia.tracebuilder.view;
+
+/**
+ * Updater interface for trace model wrappers
+ * 
+ */
+interface WrapperUpdater {
+
+	/**
+	 * Updates the given wrapper
+	 * 
+	 * @param wrapper
+	 *            the wrapper to be updated
+	 */
+	void update(WrapperBase wrapper);
+
+	/**
+	 * Queues an asynchronous update
+	 * 
+	 * @param wrapper
+	 *            the wrapper to be updated
+	 */
+	void queueUpdate(WrapperBase wrapper);
+
+	/**
+	 * Queues a selection action. Selection is done after all updates and only
+	 * the latest selection is effective.
+	 * 
+	 * @param wrapper
+	 *            the wrapper to be selected
+	 */
+	void queueSelection(WrapperBase wrapper);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/messages.properties	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,134 @@
+PropertyDialog.AddParameterCaption=Add Parameter
+PropertyDialog.AddTraceCaption=Add Trace
+PropertyDialog.AddConstantCaption=Add Enum / Constant to Enum
+TraceViewMessages.SelectComponentCaption=Select component
+PropertyDialog.EditGroupCaption=Trace Group Properties
+PropertyDialog.EditTraceCaption=Trace Properties
+PropertyDialog.EditConstantCaption=Enum Constant Properties
+PropertyDialog.EditConstantTableCaption=Enum Properties
+PropertyDialog.AddTraceHint=Adds a new trace to the group selected from or written to the 'Trace Group' list.\nThe trace is inserted to source at cursor location.
+PropertyDialog.InstrumenterHint=Instruments the open source files using group selected from 'Trace Group' list.
+PropertyDialog.AddTraceParameterHintPrefix=Adds a new parameter to trace 
+PropertyDialog.AddTraceParameterHintPostfix=.\nThe source file where the trace is used is updated.
+PropertyDialog.SelectComponentHintPrefix=Source file is used in more than one component.\n
+PropertyDialog.SelectComponentHintPostfix=Select component that you want to use.\n
+PropertyDialog.AddConstantHint=Adds a new constant to the enum selected from or written to the 'Enum' list. If enum does not exist,\nit will be also added. The property file is automatically updated to reflect the change.
+PropertyDialog.EditGroupHintPrefix=Modifies the properties of group 
+PropertyDialog.EditGroupHintPostfix=.
+PropertyDialog.EditTraceHintPrefix=Modifies the properties of trace 
+PropertyDialog.EditTraceHintPostfix=.\nThe source file where the trace is used is updated.
+PropertyDialog.EditConstantHintPrefix=Modifies the properties of enum constant 
+PropertyDialog.EditConstantHintPostfix=.\nThe property file is automatically updated to reflect the change.
+PropertyDialog.EditConstantTableHintPrefix=Modifies the properties of enum 
+PropertyDialog.EditConstantTableHintPostfix=.\nThe property file is automatically updated to reflect the change.
+PropertyDialog.InvalidId=Invalid ID
+PropertyWrapper.NoProperty=None
+PropertyWrapper.NotAvailable=Not available
+PropertyDialogUI.HexPrefix=0x
+PropertyDialogUI.AddParameterNameLabel=Parameter Name:
+PropertyDialogUI.EditGroupNameLabel=Group Name:
+PropertyDialogUI.AddTraceNameLabel=Trace Name:
+PropertyDialogUI.EditTraceNameLabel=Trace Name:
+PropertyDialogUI.TemplatesLabel=Templates:
+PropertyDialogUI.TraceNameFormat=Name Format:
+PropertyDialogUI.TraceTextFormat=Text Format:
+PropertyDialogUI.AddTraceTargetLabel=Trace Group:
+PropertyDialogUI.AddTraceEventNameLabel=Event Name:
+PropertyDialogUI.AddTraceValueLabel=Trace Text:
+PropertyDialogUI.EditTraceValueLabel=Trace Text:
+PropertyDialogUI.AddParameterTypeLabel=Parameter Type:
+PropertyDialogUI.AddConstantNameLabel=Constant Name:
+PropertyDialogUI.NoTemplate=No Template
+PropertyDialogUI.SelectComponentNameLabel=Component Name:
+PropertyDialogUI.EditConstantTableNameLabel=Enum Name:
+PropertyDialogUITarget.AddConstantTargetLabel=Enum Name:
+PropertyDialogUI.EditConstantNameLabel=Constant Name:
+PropertyDialogUI.AddConstantIDLabel=Constant Value:
+PropertyDialogUI.HexButtonTitle=Hex ID
+PropertyDialogUI.EditConstantIDLabel=Constant Value:
+TraceView.TraceBuilder=Trace Builder
+TraceLabelProvider.UnrelatedLocations=Unrelated Locations
+TraceLabelProvider.NameExtensionPrefix=\ (
+TraceLabelProvider.Locations=Location
+TraceLabelProvider.LastKnownLocations=Last Known Location
+TraceLabelProvider.LocationNameEnd=)
+TraceLabelProvider.FileLineSeparator=, line: 
+TraceLabelProvider.Parameters=Parameters
+TraceLabelProvider.Unnamed=<unnamed>
+TraceLabelProvider.PropertySeparator=: 
+TraceLabelProvider.LocationNameStart=\ (
+TraceLabelProvider.LocationListsTitle=Locations
+TraceLabelProvider.LocationNameSeparatorStart=\ (
+TraceLabelProvider.LocationNameSeparatorEnd=)
+TraceLabelProvider.TraceGroups=Trace Groups
+TraceLabelProvider.Traces=Traces
+TraceLabelProvider.ConstantTables=Parameter Types
+TraceLabelProvider.ConstantValueSeparator=\ -> 
+TraceLabelProvider.ParameterTypeSeparator=, 
+TraceLabelProvider.NameExtensionPostfix=)
+TraceLabelProvider.NavigatorTitleInvalid=<Invalid>
+TraceLabelProvider.ConstantTableNameTypeTag=Type: 
+TraceLabelProvider.ConstantTableNamePrefix=
+TraceLabelProvider.NavigatorTitleEndTraces=. Right-click to change
+TraceLabelProvider.NavigatorTitleEndGroups=. Right-click to change
+TraceLabelProvider.ConstantTableNamePostfix=\ (enum)
+TraceLabelProvider.NavigatorTitleValueSeparator=\ - 
+TraceLabelProvider.NavigatorTitleTotalCountSeparator=\ out of 
+TraceLabelProvider.NavigatorTitleStartTraces=Viewing traces 
+TraceLabelProvider.NavigatorTitleStartGroups=Viewing groups 
+TraceLabelProvider.NavigatorTitleStartLocations=Viewing locations 
+TraceLabelProvider.NavigatorTitleEndLocations=. Right-click to change
+TraceObjectWrapper.HexPrefix=0x
+TraceObjectWrapper.ModelName=Component Name
+TraceObjectWrapper.HexPostfix=
+TraceObjectWrapper.ModelID=Component ID
+TraceParameterWrapper.ArrayTag=, Array
+TraceObjectWrapper.Trace=Trace
+ListNavigatorActionProvider.Next=Next
+ListNavigatorActionProvider.Previous=Previous
+TraceViewMessages.DeleteTracePrefix=Do you really want to delete trace 
+TraceViewMessages.DeleteTraceMiddle=\ from group 
+TraceViewMessages.DeleteTracePostfix=?
+TraceViewMessages.DeleteTraceGroupPrefix=Do you really want to delete group 
+TraceViewMessages.DeleteTraceGroupPostfix=?
+TraceViewMessages.UpdateWhenSourceNotOpen=This would not affect a source file that is currently not open and thus cannot be updated. Would you like to continue?
+TraceViewMessages.DeleteConstTablePrefix=Do you really want to delete enum 
+TraceViewMessages.DeleteConstTablePostfix=?
+TraceViewMessages.DeleteConstantPrefix=Do you really want to delete enum value 
+TraceViewMessages.DeleteConstantMiddle=\ from enum 
+TraceViewMessages.DeleteConstantPostfix=?
+TraceViewMessages.DeleteParameterPrefix=Do you really want to delete parameter 
+TraceViewMessages.DeleteParameterMiddle=\ from 
+TraceViewMessages.DeleteParameterPostfix=?
+TraceViewMessages.InstrumentCaption=Instrument Code
+TraceViewMessages.DeleteTracesTitle=Delete Traces
+TraceViewMessages.InstrumentFilesTitle=Instrument Files
+TraceViewMessages.InstrumentFilesHint=Instruments the selected functions
+TraceViewMessages.DeleteTracesHint=Deletes the selected traces from source files that are currently open
+TraceViewMessages.Pointer=Pointer, 32-bit
+TraceViewMessages.Unicode=Text, 16-bit
+TraceViewMessages.Ascii=Text, 8-bit
+TraceViewMessages.Hex32=Hex, 32-bit
+TraceViewMessages.Signed32=Signed, 32-bit
+TraceViewMessages.Unsigned32=Unsigned, 32-bit
+TraceViewMessages.Octal32=Octal, 32-bit
+TraceViewMessages.Hex64=Hex, 64-bit
+TraceViewMessages.Signed64=Signed, 64-bit
+TraceViewMessages.Unsigned64=Unsigned, 64-bit
+TraceViewMessages.Octal64=Octal, 64-bit
+TraceViewMessages.Hex16=Hex, 16-bit
+TraceViewMessages.Signed16=Signed, 16-bit
+TraceViewMessages.Unsigned16=Unsigned, 16-bit
+TraceViewMessages.Octal16=Octal, 16-bit
+TraceViewMessages.Hex8=Hex, 8-bit
+TraceViewMessages.Signed8=Signed, 8-bit
+TraceViewMessages.Unsigned8=Unsigned, 8-bit
+TraceViewMessages.Octal8=Octal, 8-bit
+TraceViewMessages.FloatFix=Float, 64-bit, Fixed
+TraceViewMessages.FloatExp=Float, 64-bit, Exponent
+TraceViewMessages.FloatOpt=Float, 64-bit
+TraceViewMessages.UnknownType=Unknown type
+TraceViewMessages.ReplaceFilePrefix=
+TraceViewMessages.ReplaceFilePostfix=\ already exists. Would you like to replace it?
+TraceViewMessages.ImportTraceProjectText=Select a project file to import
+TraceViewMessages.SelectEnvironmentDialogTitle=Select the root directory of target environment. This can be later changed from TraceBuilder preferences.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder.view/src/com/nokia/tracebuilder/view/package.html	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,3 @@
+<html><body>
+Implements Trace Builder view and query dialogs.
+</body></html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/.classpath	Wed Jun 23 14:35:40 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/tracebuilder/com.nokia.tracebuilder/.settings/org.eclipse.core.resources.prefs	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,6 @@
+#Mon Sep 14 09:23:50 EEST 2009
+eclipse.preferences.version=1
+encoding//src/com/nokia/tracebuilder/engine/messages.properties=8859_1
+encoding//src/com/nokia/tracebuilder/engine/project/messages.properties=8859_1
+encoding//src/com/nokia/tracebuilder/engine/rules/messages.properties=8859_1
+encoding//src/com/nokia/tracebuilder/engine/rules/printf/messages.properties=8859_1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/.settings/org.eclipse.jdt.core.prefs	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,8 @@
+#Mon Oct 05 10:52:10 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/tracebuilder/com.nokia.tracebuilder/META-INF/MANIFEST.MF	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,27 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Carbide.c++ Extensions - Trace Builder
+Bundle-SymbolicName: com.nokia.tracebuilder; singleton:=true
+Bundle-Version: 2.4.0
+Bundle-Activator: com.nokia.tracebuilder.TracebuilderPlugin
+Bundle-Vendor: Nokia
+Require-Bundle: org.eclipse.core.runtime,
+ com.nokia.trace.eventrouter
+Bundle-ActivationPolicy: lazy
+Export-Package: com.nokia.tracebuilder.engine,
+ com.nokia.tracebuilder.engine.project,
+ com.nokia.tracebuilder.engine.propertydialog,
+ com.nokia.tracebuilder.engine.propertyfile,
+ com.nokia.tracebuilder.engine.rules,
+ com.nokia.tracebuilder.engine.rules.osttrace,
+ com.nokia.tracebuilder.engine.source,
+ com.nokia.tracebuilder.engine.utils,
+ com.nokia.tracebuilder.file,
+ com.nokia.tracebuilder.model,
+ com.nokia.tracebuilder.plugin,
+ com.nokia.tracebuilder.project,
+ com.nokia.tracebuilder.rules,
+ com.nokia.tracebuilder.source,
+ com.nokia.tracebuilder.utils
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Import-Package: com.nokia.carbide.cdt.builder
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/about.html	Wed Jun 23 14:35:40 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 9, 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 the License "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/tracebuilder/com.nokia.tracebuilder/about.ini	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,42 @@
+# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). 
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# which accompanies 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/tracebuilder/com.nokia.tracebuilder/about.mappings	Wed Jun 23 14:35:40 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/tracebuilder/com.nokia.tracebuilder/about.properties	Wed Jun 23 14:35:40 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 - Trace Builder \n\
+\n\
+Version: 2.4.0\n\
+Build id: {0}\n\
+\n\
+\n\
+Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).\n\
+All rights reserved. License: http://www.eclipse.org/legal/epl-v10.html.\n\
+\n\
+This product includes software developed by Eclipse Project\n\
+(http://www.eclipse.org/).
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/build.properties	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,11 @@
+source.. = src/
+output.. = bin/
+bin.includes = .,\
+               META-INF/,\
+               about.html,\
+               about.ini,\
+               about.mappings,\
+               about.properties,\
+               plugin.properties,\
+               plugin.xml
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/plugin.properties	Wed Jun 23 14:35:40 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:
+#
+#
+# plugin.properties
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# Plugin properties for Trace Builder
+# This file should be translated.
+view.Label=Trace Builder
+view.Tooltip=Trace Builder
+productBlurb=Carbide.c++ Extensions - Trace Builder \n\
+\n\
+Version: 2.4.0\n\
+Build id: {0}\n\
+\n\
+\n\
+Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).\n\
+All rights reserved. License: http://www.eclipse.org/legal/epl-v10.html.\n\
+\n\
+This product includes software developed by Eclipse Project\n\
+(http://www.eclipse.org/).
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/plugin.xml	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+
+  <extension
+    point="org.eclipse.core.runtime.products"
+    id="product">      
+      <product name="Trace Builder" application="org.eclipse.ui.ide.workbench"> 
+        <property name="appName" value="Carbide.c++ Extensions - Trace Builder"/> 
+      </product> 
+  </extension>
+  	
+</plugin>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/TracebuilderPlugin.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,75 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 main plugin class
+*
+*/
+package com.nokia.tracebuilder;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+
+/**
+ * The main plugin class
+ * 
+ */
+public class TracebuilderPlugin extends Plugin {
+
+	/**
+	 * The shared instance.
+	 */
+	private static TracebuilderPlugin plugin;
+
+	/**
+	 * The constructor.
+	 */
+	public TracebuilderPlugin() {
+		plugin = this;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+	 */
+	@Override
+	public void start(BundleContext context) throws Exception {
+		super.start(context);
+		TraceBuilderGlobals.start();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+	 */
+	@Override
+	public void stop(BundleContext context) throws Exception {
+		TraceBuilderGlobals.shutdown();
+		super.stop(context);
+		plugin = null;
+	}
+
+	/**
+	 * Returns the shared plug-in instance.
+	 * 
+	 * @return the plug-in instance
+	 */
+	public static TracebuilderPlugin getDefault() {
+		return plugin;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/ActionsAdapter.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Actions adapter
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+/**
+ * Actions adapter implements the view actions interface
+ * 
+ */
+public class ActionsAdapter implements TraceBuilderActions {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderActions#
+	 *      enableActions(java.lang.Object)
+	 */
+	public void enableActions(Object object) {
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/CheckListDialogEntry.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,195 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Check list dialog entry
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * Check list dialog entry
+ * 
+ */
+public class CheckListDialogEntry implements Iterable<CheckListDialogEntry> {
+
+	/**
+	 * The object
+	 */
+	private Object object;
+
+	/**
+	 * Checked flag for the object
+	 */
+	private boolean isChecked;
+
+	/**
+	 * Children of this entry
+	 */
+	private List<CheckListDialogEntry> children;
+
+	/**
+	 * Parent entry
+	 */
+	private CheckListDialogEntry parent;
+
+	/**
+	 * Partially checked flag is set if some of the children are checked and
+	 * some are not
+	 */
+	private boolean partiallyChecked;
+
+	/**
+	 * Gets the parent of this entry
+	 * 
+	 * @return the parent entry
+	 */
+	public CheckListDialogEntry getParent() {
+		return parent;
+	}
+
+	/**
+	 * Gets the checked flag
+	 * 
+	 * @return the flag
+	 */
+	public boolean isChecked() {
+		return isChecked;
+	}
+
+	/**
+	 * Sets the checked flag
+	 * 
+	 * @param isChecked
+	 *            the new flag value
+	 */
+	public void setChecked(boolean isChecked) {
+		this.isChecked = isChecked;
+	}
+
+	/**
+	 * Gets the object
+	 * 
+	 * @return the object
+	 */
+	public Object getObject() {
+		return object;
+	}
+
+	/**
+	 * Sets the object
+	 * 
+	 * @param object
+	 *            the object to set
+	 */
+	public void setObject(Object object) {
+		this.object = object;
+	}
+
+	/**
+	 * Adds a child entry
+	 * 
+	 * @param child
+	 *            the child entry to be added
+	 */
+	public void addChild(CheckListDialogEntry child) {
+		if (children == null) {
+			children = new ArrayList<CheckListDialogEntry>();
+		}
+		children.add(child);
+		child.parent = this;
+	}
+
+	/**
+	 * Gets the child entries
+	 * 
+	 * @return the children
+	 */
+	public Iterator<CheckListDialogEntry> getChildren() {
+		List<CheckListDialogEntry> list;
+		if (children != null) {
+			list = children;
+		} else {
+			list = Collections.emptyList();
+		}
+		return list.iterator();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Iterable#iterator()
+	 */
+	public Iterator<CheckListDialogEntry> iterator() {
+		return getChildren();
+	}
+
+	/**
+	 * Checks if this entry has children
+	 * 
+	 * @return true if there are children
+	 */
+	public boolean hasChildren() {
+		return children != null && !children.isEmpty();
+	}
+
+	/**
+	 * Converts the children to array
+	 * 
+	 * @return the children as array
+	 */
+	public Object[] childrenToArray() {
+		Object[] retval;
+		if (children != null) {
+			retval = children.toArray();
+		} else {
+			retval = new Object[0];
+		}
+		return retval;
+	}
+
+	/**
+	 * Gets the number of child elements
+	 * 
+	 * @return the child count
+	 */
+	public int getChildCount() {
+		return children != null ? children.size() : 0;
+	}
+
+	/**
+	 * Partially checked flag
+	 * 
+	 * @return true if some of the children is checked and some are not
+	 */
+	public boolean isPartiallyChecked() {
+		return partiallyChecked;
+	}
+
+	/**
+	 * Sets the partially checked flag
+	 * 
+	 * @param checked
+	 *            the flag value
+	 */
+	public void setPartiallyChecked(boolean checked) {
+		partiallyChecked = checked;
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/ConfigurationDelegate.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,204 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Delegate to configuration of the view
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+import java.util.ArrayList;
+
+/**
+ * Delegate to configuration of the view
+ * 
+ */
+final class ConfigurationDelegate implements TraceBuilderConfiguration {
+
+	/**
+	 * Configuration from view
+	 */
+	private TraceBuilderConfiguration configuration;
+
+	/**
+	 * Temporary list of configuration listeners
+	 */
+	private ArrayList<TraceBuilderConfigurationListener> tempListeners;
+
+	/**
+	 * Sets the configuration delegate
+	 * 
+	 * @param configuration
+	 *            the configuration
+	 */
+	void setConfiguration(TraceBuilderConfiguration configuration) {
+		this.configuration = configuration;
+		if (configuration != null && tempListeners != null) {
+			for (int i = 0; i < tempListeners.size(); i++) {
+				TraceBuilderConfigurationListener listener = tempListeners
+						.get(i);
+				configuration.addConfigurationListener(listener);
+				listener.configurationCreated();
+			}
+			tempListeners.clear();
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderConfiguration#isAvailable()
+	 */
+	public boolean isAvailable() {
+		boolean retval;
+		if (configuration != null) {
+			retval = configuration.isAvailable();
+		} else {
+			retval = false;
+		}
+		return retval;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderConfiguration#
+	 *      addConfigurationListener(com.nokia.tracebuilder.engine.TraceBuilderConfigurationListener)
+	 */
+	public void addConfigurationListener(
+			TraceBuilderConfigurationListener configurationListener) {
+		if (configuration != null) {
+			configuration.addConfigurationListener(configurationListener);
+		} else {
+			if (tempListeners == null) {
+				tempListeners = new ArrayList<TraceBuilderConfigurationListener>();
+			}
+			tempListeners.add(configurationListener);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderConfiguration#
+	 *      removeConfigurationListener(com.nokia.tracebuilder.engine.TraceBuilderConfigurationListener)
+	 */
+	public void removeConfigurationListener(
+			TraceBuilderConfigurationListener configurationListener) {
+		if (configuration != null) {
+			configuration.removeConfigurationListener(configurationListener);
+		} else {
+			if (tempListeners != null) {
+				tempListeners.remove(configurationListener);
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderConfiguration#getFlag(java.lang.String)
+	 */
+	public boolean getFlag(String flagName) {
+		boolean retval;
+		if (configuration != null) {
+			retval = configuration.getFlag(flagName);
+		} else {
+			retval = false;
+		}
+		return retval;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderConfiguration#getText(java.lang.String)
+	 */
+	public String getText(String textName) {
+		String retval;
+		if (configuration != null) {
+			retval = configuration.getText(textName);
+		} else {
+			retval = ""; //$NON-NLS-1$
+		}
+		return retval;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderConfiguration#getValue(java.lang.String)
+	 */
+	public int getValue(String valueName) {
+		int retval;
+		if (configuration != null) {
+			retval = configuration.getValue(valueName);
+		} else {
+			retval = 0;
+		}
+		return retval;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderConfiguration#hasEntry(java.lang.String)
+	 */
+	public boolean hasEntry(String entryName) {
+		boolean retval;
+		if (configuration != null) {
+			retval = configuration.hasEntry(entryName);
+		} else {
+			retval = false;
+		}
+		return retval;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderConfiguration#
+	 *      setFlag(java.lang.String, boolean)
+	 */
+	public void setFlag(String flagName, boolean flag) {
+		if (configuration != null) {
+			configuration.setFlag(flagName, flag);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderConfiguration#
+	 *      setText(java.lang.String, java.lang.String)
+	 */
+	public void setText(String textName, String text) {
+		if (configuration != null) {
+			configuration.setText(textName, text);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderConfiguration#setValue(java.lang.String,
+	 *      int)
+	 */
+	public void setValue(String valueName, int value) {
+		if (configuration != null) {
+			configuration.setValue(valueName, value);
+		}
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/DialogsAdapter.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Dialog interface adapter
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+/**
+ * Dialog interface adapter
+ * 
+ */
+public class DialogsAdapter implements TraceBuilderDialogs {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderDialogs#
+	 *      showCheckList(com.nokia.tracebuilder.engine.TraceBuilderDialogs.CheckListDialogParameters)
+	 */
+	public int showCheckList(CheckListDialogParameters parameters) {
+		return CANCEL;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderDialogs#
+	 *      showConfirmationQuery(com.nokia.tracebuilder.engine.TraceBuilderDialogs.QueryDialogParameters)
+	 */
+	public int showConfirmationQuery(QueryDialogParameters parameters) {
+		return CANCEL;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderDialogs#
+	 *      showErrorMessage(java.lang.String)
+	 */
+	public void showErrorMessage(String message) {
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/LastKnownLocation.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,188 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Last known  location represents the last known position of a trace
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceObject;
+import com.nokia.tracebuilder.source.SourceConstants;
+
+/**
+ * Last known  location represents the last known position of a trace
+ * 
+ */
+public final class LastKnownLocation implements LocationProperties {
+
+	/**
+	 * Location list owning this location
+	 */
+	private LastKnownLocationList list;
+
+	/**
+	 * Path of the source file
+	 */
+	private String path;
+
+	/**
+	 * Source file name
+	 */
+	private String file;
+
+	/**
+	 * Line number
+	 */
+	private int line;
+
+	/**
+	 * View reference, used by view for quick access
+	 */
+	private Object viewReference;
+
+	/**
+	 * Name of the class where the trace belongs to
+	 */
+	private String className;
+
+	/**
+	 * Name of the function where the trace belongs to
+	 */
+	private String functionName;
+
+	/**
+	 * Creates a new last known  location
+	 * 
+	 * @param path
+	 *            file path
+	 * @param file
+	 *            file name
+	 * @param line
+	 *            line number
+	 * @param className
+	 *            the name of the class
+	 * @param functionName
+	 *            the name of the function
+	 */
+	public LastKnownLocation(String path, String file, int line,
+			String className, String functionName) {
+		if (path != null && path.length() > 0) {
+			path = path.replace(SourceConstants.BACKSLASH_CHAR,
+					SourceConstants.FORWARD_SLASH_CHAR);
+			if (path.charAt(path.length() - 1) != SourceConstants.FORWARD_SLASH_CHAR) {
+				path = path + SourceConstants.FORWARD_SLASH_CHAR;
+			}
+			this.path = path;
+		} else {
+			this.path = String.valueOf(SourceConstants.FORWARD_SLASH_CHAR);
+		}
+		this.file = file == null ? "" : file; //$NON-NLS-1$
+		this.line = line;
+		this.className = className == null ? "" : className; //$NON-NLS-1$
+		this.functionName = functionName == null ? "" : functionName; //$NON-NLS-1$
+	}
+
+	/**
+	 * Gets the trace
+	 * 
+	 * @return the trace
+	 */
+	public Trace getTrace() {
+		Trace retval = null;
+		if (list != null) {
+			TraceObject owner = list.getOwner();
+			if (owner instanceof Trace) {
+				retval = (Trace) owner;
+			}
+		}
+		return retval;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.LocationProperties#getFilePath()
+	 */
+	public String getFilePath() {
+		return path;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.LocationProperties#getFileName()
+	 */
+	public String getFileName() {
+		return file;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.LocationProperties#getLineNumber()
+	 */
+	public int getLineNumber() {
+		return line;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.LocationProperties#getClassName()
+	 */
+	public String getClassName() {
+		return className;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.LocationProperties#getFunctionName()
+	 */
+	public String getFunctionName() {
+		return functionName;
+	}
+
+	/**
+	 * Used by view for quick access
+	 * 
+	 * @return the view reference
+	 */
+	public Object getViewReference() {
+		return viewReference;
+	}
+
+	/**
+	 * Sets the view reference
+	 * 
+	 * @param ref
+	 *            the view reference
+	 */
+	public void setViewReference(Object ref) {
+		viewReference = ref;
+	}
+
+	/**
+	 * Sets the location list
+	 * 
+	 * @param list
+	 *            the list
+	 */
+	void setLocationList(LastKnownLocationList list) {
+		this.list = list;
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/LastKnownLocationList.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* List of last known locations
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+import java.util.ArrayList;
+
+/**
+ * List of last known  locations
+ * 
+ */
+public final class LastKnownLocationList extends LocationListBase {
+
+	/**
+	 * Location list listeners
+	 */
+	private ArrayList<LastKnownLocationListListener> listeners = new ArrayList<LastKnownLocationListListener>();
+
+	/**
+	 * Adds a location to last known  locations list
+	 * 
+	 * @param loc
+	 *            the location
+	 */
+	public void addLocation(LastKnownLocation loc) {
+		add(loc);
+		loc.setLocationList(this);
+		fireLocationAdded(loc);
+	}
+
+	/**
+	 * Adds a location list listener to this object
+	 * 
+	 * @param listener
+	 *            the listener interface
+	 */
+	public void addLocationListListener(LastKnownLocationListListener listener) {
+		listeners.add(listener);
+	}
+
+	/**
+	 * Removes the location list listener
+	 * 
+	 * @param listener
+	 *            the listener interface
+	 */
+	public void removeLocationListListener(
+			LastKnownLocationListListener listener) {
+		listeners.remove(listener);
+	}
+
+	/**
+	 * Creates locationAdded event to location list listeners
+	 * 
+	 * @param location
+	 *            the location that was added
+	 */
+	private void fireLocationAdded(LastKnownLocation location) {
+		for (LastKnownLocationListListener l : listeners) {
+			l.locationAdded(location);
+		}
+	}
+
+	/**
+	 * Creates locationRemoved event to location list listeners
+	 * 
+	 * @param location
+	 *            the location that was added
+	 */
+	void fireLocationRemoved(LastKnownLocation location) {
+		for (LastKnownLocationListListener l : listeners) {
+			l.locationRemoved(location);
+		}
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/LastKnownLocationListListener.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Listener for last known locations list
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+/**
+ * Listener for last known locations list
+ * 
+ */
+public interface LastKnownLocationListListener {
+
+	/**
+	 * Location was added to this list
+	 * 
+	 * @param location
+	 *            the new location
+	 */
+	public void locationAdded(LastKnownLocation location);
+
+	/**
+	 * Location was removed from this list
+	 * 
+	 * @param location
+	 *            the location that was removed
+	 */
+	public void locationRemoved(LastKnownLocation location);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/LocationListBase.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,121 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 TraceLocationList and LastKnownLocationList
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import com.nokia.tracebuilder.model.TraceModelExtension;
+import com.nokia.tracebuilder.model.TraceObject;
+
+/**
+ * Base class for TraceLocationList and LastKnownLocationList
+ * 
+ */
+public class LocationListBase implements TraceModelExtension,
+		Iterable<LocationProperties> {
+
+	/**
+	 * List of locations
+	 */
+	private ArrayList<LocationProperties> locations = new ArrayList<LocationProperties>();
+
+	/**
+	 * Owning trace object
+	 */
+	private TraceObject owner;
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelExtension#getOwner()
+	 */
+	public TraceObject getOwner() {
+		return owner;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelExtension#setOwner(com.nokia.tracebuilder.model.TraceObject)
+	 */
+	public void setOwner(TraceObject owner) {
+		this.owner = owner;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Iterable#iterator()
+	 */
+	public Iterator<LocationProperties> iterator() {
+		return locations.iterator();
+	}
+
+	/**
+	 * Gets the location count of this list
+	 * 
+	 * @return the count
+	 */
+	public final int getLocationCount() {
+		return locations.size();
+	}
+
+	/**
+	 * Checks if there are locations in this list
+	 * 
+	 * @return true if list has locations
+	 */
+	public final boolean hasLocations() {
+		return !locations.isEmpty();
+	}
+
+	/**
+	 * Adds a location to this list
+	 * 
+	 * @param location
+	 *            the location to be added
+	 */
+	void add(LocationProperties location) {
+		locations.add(location);
+	}
+
+	/**
+	 * Removes a location from this list
+	 * 
+	 * @param location
+	 *            the location to be removed
+	 * @return true if removed
+	 */
+	boolean remove(LocationProperties location) {
+		return locations.remove(location);
+	}
+
+	/**
+	 * Checks if location exists
+	 * 
+	 * @param location
+	 *            the location
+	 * @return true if exists
+	 */
+	boolean contains(LocationProperties location) {
+		return locations.contains(location);
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/LocationMapModelListener.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,112 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Model listener for trace location mapper
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceGroup;
+import com.nokia.tracebuilder.model.TraceModelListener;
+import com.nokia.tracebuilder.model.TraceObject;
+import com.nokia.tracebuilder.model.TraceParameter;
+
+/**
+ * Model listener for trace location mapper
+ * 
+ */
+final class LocationMapModelListener implements TraceModelListener {
+
+	/**
+	 * Trace location mapper
+	 */
+	private final TraceLocationMap locationMap;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param map
+	 *            the location mapper
+	 */
+	LocationMapModelListener(TraceLocationMap map) {
+		locationMap = map;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelListener#
+	 *      objectAdded(com.nokia.tracebuilder.model.TraceObject,
+	 *      com.nokia.tracebuilder.model.TraceObject)
+	 */
+	public void objectAdded(TraceObject owner, TraceObject object) {
+		// A trace does not have a name yet, so this does nothing
+		// The locations are assigned to the trace in propertyChanged
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelListener#
+	 *      objectRemoved(com.nokia.tracebuilder.model.TraceObject,
+	 *      com.nokia.tracebuilder.model.TraceObject)
+	 */
+	public void objectRemoved(TraceObject owner, TraceObject object) {
+		if (object instanceof Trace) {
+			locationMap.moveToUnrelated((Trace) object);
+		} else if (object instanceof TraceGroup) {
+			// Moves locations to unrelated list
+			for (Trace trace : (TraceGroup) object) {
+				locationMap.moveToUnrelated(trace);
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelListener#
+	 *      propertiesUpdated(com.nokia.tracebuilder.model.TraceObject)
+	 */
+	public void propertyUpdated(TraceObject object, int property) {
+		if (object instanceof Trace && property == NAME && object.isComplete()) {
+			Trace trace = (Trace) object;
+			locationMap.moveFromUnrelated(trace);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelListener#
+	 *      objectCreationComplete(com.nokia.tracebuilder.model.TraceObject)
+	 */
+	public void objectCreationComplete(TraceObject object) {
+		if (object instanceof Trace) {
+			Trace trace = (Trace) object;
+			locationMap.moveFromUnrelated(trace);
+		} else if (object instanceof TraceParameter) {
+			// If a parameter is added, the validity needs to be checked
+			TraceLocationList list = ((TraceParameter) object).getTrace()
+					.getExtension(TraceLocationList.class);
+			if (list != null) {
+				for (LocationProperties loc : list) {
+					((TraceLocation) loc).runValidityCheck();
+				}
+			}
+		}
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/LocationProperties.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Common properties of locations
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+/**
+ * Common properties of locations
+ * 
+ */
+public interface LocationProperties {
+
+	/**
+	 * Gets the file path
+	 * 
+	 * @return the file path
+	 */
+	public String getFilePath();
+
+	/**
+	 * Gets the file name
+	 * 
+	 * @return the file name
+	 */
+	public String getFileName();
+
+	/**
+	 * Gets the line number
+	 * 
+	 * @return the line number
+	 */
+	public int getLineNumber();
+
+	/**
+	 * Gets the name of the class which owns this location
+	 * 
+	 * @return the class name
+	 */
+	public String getClassName();
+
+	/**
+	 * Gets the name of function which owns this location
+	 * 
+	 * @return the function name
+	 */
+	public String getFunctionName();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/Messages.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 engine package
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * Messages for engine package
+ * 
+ */
+public class Messages {
+
+	/**
+	 * Bundle name
+	 */
+	private static final String BUNDLE_NAME = "com.nokia.tracebuilder.engine.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/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/PropertyDialogAdapter.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,248 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 property dialog implementation
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+import java.util.List;
+
+import com.nokia.tracebuilder.model.TraceObject;
+
+/**
+ * Property dialog interface adapter. The getters return what the setters have
+ * set and <i>open</i> returns CANCEL
+ * 
+ */
+public class PropertyDialogAdapter implements TraceObjectPropertyDialog {
+
+	/**
+	 * Dialog type
+	 */
+	private int dialogType;
+
+	/**
+	 * Object ID
+	 */
+	private int id;
+
+	/**
+	 * Object name
+	 */
+	private String name;
+
+	/**
+	 * Object value
+	 */
+	private String value;
+
+	/**
+	 * Target object
+	 */
+	private String target;
+
+	/**
+	 * Target object
+	 */
+	private TraceObject targetObject;
+
+	/**
+	 * Object template
+	 */
+	private TraceObjectPropertyDialogTemplate selectedTemplate;
+
+	/**
+	 * Dialog flags
+	 */
+	private List<TraceObjectPropertyDialogFlag> flags;
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialog#getDialogType()
+	 */
+	public int getDialogType() {
+		return dialogType;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialog#getFlags()
+	 */
+	public List<TraceObjectPropertyDialogFlag> getFlags() {
+		return flags;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialog#getID()
+	 */
+	public int getID() {
+		return id;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialog#getName()
+	 */
+	public String getName() {
+		return name;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialog#getTarget()
+	 */
+	public String getTarget() {
+		return target;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialog#getUpdateObject()
+	 */
+	public TraceObject getTargetObject() {
+		return targetObject;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialog#getTemplate()
+	 */
+	public TraceObjectPropertyDialogTemplate getTemplate() {
+		return selectedTemplate;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialog#getValue()
+	 */
+	public String getValue() {
+		return value;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialog#open()
+	 */
+	public int open() {
+		return CANCEL;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialog#setDialogType(int)
+	 */
+	public void setDialogType(int dialogType) {
+		this.dialogType = dialogType;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialog#
+	 *      setEnabler(com.nokia.tracebuilder.engine.TraceObjectPropertyDialogEnabler)
+	 */
+	public void setEnabler(TraceObjectPropertyDialogEnabler enabler) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialog#setFlags(java.util.List)
+	 */
+	public void setFlags(List<TraceObjectPropertyDialogFlag> flags) {
+		this.flags = flags;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialog#setID(int)
+	 */
+	public void setID(int id) {
+		this.id = id;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialog#setName(java.lang.String)
+	 */
+	public void setName(String name) {
+		this.name = name;
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialog#setTarget(java.lang.String)
+	 */
+	public void setTarget(String target) {
+		this.target = target;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialog#
+	 *      setUpdateObject(com.nokia.tracebuilder.model.TraceObject)
+	 */
+	public void setTargetObject(TraceObject targetObject) {
+		this.targetObject = targetObject;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialog#
+	 *      setTemplates(java.util.List,
+	 *      com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate)
+	 */
+	public void setTemplates(List<TraceObjectPropertyDialogTemplate> templates,
+			TraceObjectPropertyDialogTemplate active) {
+		selectedTemplate = active;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialog#
+	 *      setValue(java.lang.String)
+	 */
+	public void setValue(String value) {
+		this.value = value;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialog#
+	 *      setVerifier(com.nokia.tracebuilder.engine.TraceObjectPropertyDialogVerifier)
+	 */
+	public void setVerifier(TraceObjectPropertyDialogVerifier verifier) {
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/SoftwareComponent.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,86 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Software component class
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+/**
+ * Software component class
+ * 
+ */
+public class SoftwareComponent {
+
+	/**
+	 * Id
+	 */
+	private String id;
+
+	/**
+	 * Name
+	 */
+	private String name;
+
+	/**
+	 * MMP file path
+	 */
+	private String mmpFilePath;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param componentId
+	 *            component id
+	 * @param componentName
+	 *            component name
+	 * @param mmpPath
+	 *            MMP path
+	 */
+	public SoftwareComponent(String componentId, String componentName,
+			String mmpPath) {
+		id = componentId;
+		name = componentName;
+		mmpFilePath = mmpPath;
+	}
+
+	/**
+	 * Get id
+	 * 
+	 * @return the id of the component
+	 */
+	public String getId() {
+		return id;
+	}
+
+	/**
+	 * Get name
+	 * 
+	 * @return the name of the component
+	 */
+	public String getName() {
+		return name;
+	}
+
+	/**
+	 * Get MMP file path
+	 * 
+	 * @return the component mmp file path
+	 */
+	public String getMMPFilePath() {
+		return mmpFilePath;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/SourceContextManager.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,89 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 change the currently active source context
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+import com.nokia.tracebuilder.source.SourceContext;
+
+/**
+ * Interface to the currently active source context
+ * 
+ */
+public interface SourceContextManager {
+
+	/**
+	 * Gets the active source context
+	 * 
+	 * @return the context
+	 */
+	public SourceContext getContext();
+
+	/**
+	 * Sets the active source context
+	 * 
+	 * @param context
+	 *            the context
+	 */
+	public void setContext(SourceContext context);
+
+	/**
+	 * Checks if the instrumenter is running
+	 * 
+	 * @return true if instrumenter is running, false otherwise
+	 */
+	public boolean isInstrumenting();
+
+	/**
+	 * Sets the instrumenting flag
+	 * 
+	 * @param flag
+	 *            the new flag value
+	 */
+	public void setInstrumenting(boolean flag);
+
+	/**
+	 * Checks if the auto-converter is running
+	 * 
+	 * @return true if converter is running, false otherwise
+	 */
+	public boolean isConverting();
+
+	/**
+	 * Sets the auto-converter flag
+	 * 
+	 * @param flag
+	 *            the new flag value
+	 */
+	public void setConverting(boolean flag);
+
+	/**
+	 * Gets the ID of instrumenter
+	 * 
+	 * @return the instrumenter ID
+	 */
+	public String getInstrumenterID();
+
+	/**
+	 * Sets the ID of the instrumenter
+	 * 
+	 * @param id
+	 *            the instrumenter ID
+	 */
+	public void setInstrumenterID(String id);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/SourceContextManagerImpl.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,142 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* SourceContextManager interface implementation
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+import com.nokia.tracebuilder.engine.source.SourceEngine;
+import com.nokia.tracebuilder.source.SourceContext;
+
+/**
+ * SourceContextManager interface implementation
+ * 
+ */
+final class SourceContextManagerImpl implements SourceContextManager {
+
+	/**
+	 * Source engine
+	 */
+	private SourceEngine sourceEngine;
+
+	/**
+	 * Active context
+	 */
+	private SourceContext activeContext;
+
+	/**
+	 * Instrumenting flag
+	 */
+	private boolean isInstrumenting;
+
+	/**
+	 * Converting flag
+	 */
+	private boolean isConverting;
+
+	/**
+	 * Instrumenter ID
+	 */
+	private String instrumenterID;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param sourceEngine
+	 *            the source engine
+	 */
+	SourceContextManagerImpl(SourceEngine sourceEngine) {
+		this.sourceEngine = sourceEngine;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.SourceContextManager#getContext()
+	 */
+	public SourceContext getContext() {
+		SourceContext retval = activeContext;
+		if (retval == null) {
+			retval = sourceEngine.getSelectedContext();
+		}
+		return retval;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.SourceContextManager#
+	 *      setContext(com.nokia.tracebuilder.source.SourceContext)
+	 */
+	public void setContext(SourceContext context) {
+		activeContext = context;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.SourceContextManager#isInstrumenting()
+	 */
+	public boolean isInstrumenting() {
+		return isInstrumenting;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.SourceContextManager#setInstrumenting(boolean)
+	 */
+	public void setInstrumenting(boolean flag) {
+		isInstrumenting = flag;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.SourceContextManager#getInstrumenterType()
+	 */
+	public String getInstrumenterID() {
+		return instrumenterID;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.SourceContextManager#
+	 *      setInstrumenterID(java.lang.String)
+	 */
+	public void setInstrumenterID(String id) {
+		instrumenterID = id;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.SourceContextManager#isConverting()
+	 */
+	public boolean isConverting() {
+		return isConverting;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.SourceContextManager#setConverting(boolean)
+	 */
+	public void setConverting(boolean flag) {
+		this.isConverting = flag;
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceBuilder.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,1277 @@
+/*
+ * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies 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 Builder
+ *
+ */
+package com.nokia.tracebuilder.engine;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.TraceBuilderErrorCode;
+import com.nokia.tracebuilder.engine.event.EventEngine;
+import com.nokia.tracebuilder.engine.plugin.PluginEngine;
+import com.nokia.tracebuilder.engine.project.ProjectEngine;
+import com.nokia.tracebuilder.engine.propertydialog.DeleteConstantCallback;
+import com.nokia.tracebuilder.engine.propertydialog.DeleteConstantTableCallback;
+import com.nokia.tracebuilder.engine.propertydialog.DeleteGroupCallback;
+import com.nokia.tracebuilder.engine.propertydialog.DeleteMultipleTracesCallback;
+import com.nokia.tracebuilder.engine.propertydialog.DeleteObjectCallback;
+import com.nokia.tracebuilder.engine.propertydialog.DeleteParameterCallback;
+import com.nokia.tracebuilder.engine.propertydialog.DeleteTraceCallback;
+import com.nokia.tracebuilder.engine.propertydialog.InstrumentationEngine;
+import com.nokia.tracebuilder.engine.propertydialog.PropertyDialogEngine;
+import com.nokia.tracebuilder.engine.propertydialog.RunInstrumenterCallback;
+import com.nokia.tracebuilder.engine.propertyfile.PropertyFileEngine;
+import com.nokia.tracebuilder.engine.rules.RulesEngine;
+import com.nokia.tracebuilder.engine.source.SourceEngine;
+import com.nokia.tracebuilder.engine.source.SourceListener;
+import com.nokia.tracebuilder.engine.source.SourceProperties;
+import com.nokia.tracebuilder.engine.utils.TraceUtils;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceConstantTable;
+import com.nokia.tracebuilder.model.TraceConstantTableEntry;
+import com.nokia.tracebuilder.model.TraceGroup;
+import com.nokia.tracebuilder.model.TraceModel;
+import com.nokia.tracebuilder.model.TraceObject;
+import com.nokia.tracebuilder.model.TraceParameter;
+import com.nokia.tracebuilder.plugin.TraceBuilderPlugin;
+import com.nokia.tracebuilder.project.GroupNameHandlerBase;
+import com.nokia.tracebuilder.project.GroupNameHandlerOSTv2;
+import com.nokia.tracebuilder.source.OffsetLength;
+import com.nokia.tracebuilder.source.SourceContext;
+import com.nokia.tracebuilder.source.StringValuePair;
+
+/**
+ * A singleton access point to functionality of Trace Builder
+ * 
+ */
+final class TraceBuilder implements SourceListener, TraceBuilderInterface {
+
+	/**
+	 * Trace builder plug-in engine
+	 */
+	private PluginEngine pluginEngine;
+
+	/**
+	 * Property dialog logic
+	 */
+	private PropertyDialogEngine propertyDialogEngine;
+
+	/**
+	 * Event handler interface implementation
+	 */
+	private EventEngine eventEngine;
+
+	/**
+	 * Source editor engine
+	 */
+	private SourceEngine sourceEngine;
+	/**
+	 * Trace project engine
+	 */
+	private ProjectEngine projectEngine;
+
+	/**
+	 * Rule engine
+	 */
+	private RulesEngine rulesEngine;
+
+	/**
+	 * Trace property file engine
+	 */
+	private PropertyFileEngine propertyFileEngine;
+
+	/**
+	 * Instrumentation engine
+	 */
+	private InstrumentationEngine instrumentationEngine;
+
+	/**
+	 * Source context manager
+	 */
+	private SourceContextManager contextManager;
+
+	/**
+	 * Location map
+	 */
+	private TraceLocationMap locationMap;
+
+	/**
+	 * Location converter
+	 */
+	private TraceLocationConverter locationConverter;
+
+	/**
+	 * Trace model
+	 */
+	private TraceModel model;
+
+	/**
+	 * Interface to the view
+	 */
+	private TraceBuilderView view = new ViewAdapter();
+
+	/**
+	 * The trace object selected from the view
+	 */
+	private TraceObject selectedObject;
+
+	/**
+	 * Selected trace location
+	 */
+	private TraceLocation selectedLocation;
+
+	/**
+	 * Configuration
+	 */
+	private ConfigurationDelegate configurationDelegate;
+
+	/**
+	 * Flag which is set when a selection is done from the source. It prevents
+	 * the selection event from delegating back to the source
+	 */
+	private boolean selectionFromSource;
+
+	/**
+	 * List of engines that need project open / export / close notifications
+	 */
+	private ArrayList<TraceBuilderEngine> engines = new ArrayList<TraceBuilderEngine>();
+
+	/**
+	 * View has been registered flag
+	 */
+	private boolean isViewRegistered = false;
+
+	/**
+	 * Project path is stored in case the view unregisters and re-registers
+	 */
+	private String currentProjectPath;
+
+	/**
+	 * Project name is stored in case the view unregisters and re-registers
+	 */
+	private String currentProjectName;
+
+	/**
+	 * List of components
+	 */
+	private ArrayList<SoftwareComponent> softwareComponents = new ArrayList<SoftwareComponent>();
+
+	/**
+	 * Software component index
+	 */
+	private int currentSoftwareComponentIndex = 0;
+
+	/**
+	 * Previous software component name
+	 */
+	private String previousSoftwareComponentName;
+
+	/**
+	 * Project monitor
+	 */
+	private TraceProjectMonitorInterface projectMonitor;
+	
+	/**
+	 * Group name handler
+	 */
+	private GroupNameHandlerBase groupNameHandler;
+
+	/**
+	 * Trace header extension
+	 */
+	String TRACE_HEADER_EXTENSION = "Traces.h"; //$NON-NLS-1$	
+
+	/**
+	 * Gets the configuration of Trace Builder
+	 * 
+	 * @return the configuration
+	 */
+	TraceBuilderConfiguration getConfiguration() {
+		return configurationDelegate;
+	}
+
+	/**
+	 * Gets the trace builder interface
+	 * 
+	 * @return this object
+	 */
+	TraceBuilderInterface getTraceBuilder() {
+		return this;
+	}
+
+	/**
+	 * Gets the dialogs interface
+	 * 
+	 * @return the dialogs
+	 */
+	TraceBuilderDialogs getDialogs() {
+		return view.getDialogs();
+	}
+
+	/**
+	 * Gets the trace model
+	 * 
+	 * @return the trace model
+	 */
+	TraceModel getModel() {
+		return model;
+	}
+
+	/**
+	 * Gets the source engine
+	 * 
+	 * @return the source engine
+	 */
+	SourceEngine getSourceEngine() {
+		return sourceEngine;
+	}
+
+	/**
+	 * Gets the events interface
+	 * 
+	 * @return the events interface
+	 */
+	TraceBuilderEvents getEvents() {
+		return eventEngine;
+	}
+
+	/**
+	 * Adds a plug-in
+	 * 
+	 * @param plugin
+	 *            the plugin
+	 */
+	void registerPlugin(TraceBuilderPlugin plugin) {
+		pluginEngine.add(plugin);
+	}
+
+	/**
+	 * Removes an existing plug-in
+	 * 
+	 * @param plugin
+	 *            the plugin
+	 */
+	void unregisterPlugin(TraceBuilderPlugin plugin) {
+		pluginEngine.remove(plugin);
+	}
+
+	/**
+	 * Gets the source context manager
+	 * 
+	 * @return the context manager
+	 */
+	public SourceContextManager getSourceContextManager() {
+		return contextManager;
+	}
+
+	/**
+	 * Gets the actions interface
+	 * 
+	 * @return actions
+	 */
+	TraceBuilderActions getActions() {
+		return view.getActions();
+	}
+
+	/**
+	 * Starts TraceBuilder.
+	 */
+	void start() {
+		configurationDelegate = new ConfigurationDelegate();
+		
+		// Default OST version in OSTv2
+		groupNameHandler = new GroupNameHandlerOSTv2();
+		rulesEngine = new RulesEngine();
+		pluginEngine = new PluginEngine();
+		model = new TraceModel(rulesEngine, pluginEngine.getVerifier());
+		pluginEngine.setModel(model);
+		propertyDialogEngine = new PropertyDialogEngine(model, rulesEngine
+				.getPropertyDialogConfiguration());
+		projectEngine = new ProjectEngine(model);
+		propertyFileEngine = new PropertyFileEngine(model);
+		eventEngine = new EventEngine(model);
+		sourceEngine = new SourceEngine(model);
+		locationMap = new TraceLocationMap(model);
+		locationConverter = new TraceLocationConverter(model,
+				propertyDialogEngine);
+		sourceEngine.addSourceListener(this);
+		contextManager = new SourceContextManagerImpl(sourceEngine);
+		instrumentationEngine = new InstrumentationEngine(model);
+		// Keep this order -> Exports need to be in correct order
+		// Property file engine manages the ID cache so it needs to be run
+		// before plug-in's and header
+		engines.add(projectEngine);
+		engines.add(propertyFileEngine);
+		engines.add(pluginEngine);
+	}
+
+	/**
+	 * Shuts down trace builder
+	 */
+	void shutdown() {
+		closeProject();
+	}
+
+	/**
+	 * Gets the current selection
+	 * 
+	 * @return the selection
+	 */
+	public TraceObject getSelectedObject() {
+		return selectedObject;
+	}
+
+	/**
+	 * Runs an asynchronous operation
+	 * 
+	 * @param runner
+	 *            the operation to run
+	 */
+	void runAsyncOperation(Runnable runner) {
+		view.runAsyncOperation(runner);
+	}
+
+	/**
+	 * Registers the view
+	 * 
+	 * @param view
+	 *            the view
+	 */
+	void setView(TraceBuilderView view) {
+		if (view == null) {
+			// Closes the project, but leaves the currentProjectName and
+			// currentProjectPath variables. When view re-registers the project
+			// is opened back
+			internalCloseProject();
+			this.view = new ViewAdapter();
+			isViewRegistered = false;
+			if (projectMonitor != null) {
+				projectMonitor.stopMonitor();
+			}
+		} else {
+			this.view = view;
+			isViewRegistered = true;
+			if (projectMonitor != null) {
+				projectMonitor.startMonitor();
+			}
+		}
+		propertyDialogEngine.setPropertyDialog(this.view.getPropertyDialog());
+		configurationDelegate.setConfiguration(this.view.getConfiguration());
+		// Tries to open project when view registers
+		if (isViewRegistered && currentProjectName != null
+				&& currentProjectPath != null) {
+			this.view.runAsyncOperation(new Runnable() {
+
+				/*
+				 * (non-Javadoc)
+				 * 
+				 * @see java.lang.Runnable#run()
+				 */
+				public void run() {
+					try {
+						openProject(currentProjectName);
+					} catch (TraceBuilderException e) {
+					}
+				}
+
+			});
+		}
+	}
+
+	/**
+	 * Is view registered
+	 * 
+	 * @return true if view is registered false if view is not registered
+	 */
+	boolean isViewRegistered() {
+		return isViewRegistered;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderInterface#
+	 * traceObjectSelected(com.nokia.tracebuilder.model.TraceObject, boolean,
+	 * boolean)
+	 */
+	public void traceObjectSelected(TraceObject object, boolean syncView,
+			boolean sourceOpened) {
+
+		// Active object is stored
+		selectedObject = object;
+		selectedLocation = null;
+
+		// If a trace or parameter was selected from view, the source
+		// jumps to the trace in source code if there is one reference
+		// to the trace. If there are multiple references, the actual
+		// location needs to be selected from the location list
+		Trace trace = null;
+		if (object instanceof Trace) {
+			trace = (Trace) selectedObject;
+		} else if (object instanceof TraceParameter) {
+			trace = ((TraceParameter) selectedObject).getTrace();
+		}
+		if (trace != null) {
+			TraceLocationList list = null;
+			
+			// If source file was opened same time as trace was selected. Use
+			// trace from model, because trace from selected object is not up to
+			// date
+			if (sourceOpened) {
+				Trace traceFromModel = model.findTraceByName(trace.getName());
+				list = traceFromModel.getExtension(TraceLocationList.class);
+			} else {
+				list = trace.getExtension(TraceLocationList.class);
+			}
+			if (list != null && list.hasLocations()) {
+				((TraceLocation) list.iterator().next()).selectFromSource();
+
+			}
+		}
+
+		if (syncView && selectedObject != null) {
+			view.selectObject(selectedObject);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderInterface#
+	 * locationSelected(com.nokia.tracebuilder.engine.TraceLocationList,
+	 * com.nokia.tracebuilder.engine.TraceLocation, boolean)
+	 */
+	public void locationSelected(TraceLocationList list,
+			TraceLocation location, boolean syncView) {
+		if (location != null) {
+			// Activates the trace owning the location
+			selectedObject = location.getTrace();
+			selectedLocation = location;
+			// selectionFromSource flag prevents looped updates
+			// from view to source and back
+			if (!selectionFromSource) {
+				// Jumps to the selected location
+				location.selectFromSource();
+			} else {
+				selectionFromSource = false;
+			}
+		} else if (list != null) {
+			// Activates the trace owning the location list
+			selectedObject = list.getOwner();
+			selectedLocation = null;
+			if (selectedObject != null) {
+				if (list.hasLocations()) {
+					TraceLocation loc = (TraceLocation) list.iterator().next();
+					loc.selectFromSource();
+					selectedLocation = loc;
+				}
+			}
+		} else {
+			selectedObject = null;
+			selectedLocation = null;
+		}
+		if (syncView && selectedLocation != null) {
+			view.selectLocation(selectedLocation);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderInterface#addTrace()
+	 */
+	public void addTrace() throws TraceBuilderException {
+		checkIsModelValid();
+		addTrace(getOwningTraceGroup(selectedObject));
+	}
+
+	/**
+	 * Creates a trace and adds it to source
+	 * 
+	 * @param groupProposal
+	 *            the group proposal for add trace dialog
+	 * @throws TraceBuilderException
+	 *             if creation fails
+	 */
+	private void addTrace(TraceGroup groupProposal)
+			throws TraceBuilderException {
+		Trace trace = null;
+		// If the context is fully selected, the start and end traces are
+		// automatically added
+		String name = null;
+		String value = null;
+		// If adding to source, the context is checked.
+		SourceContext context = sourceEngine.getSelectedContext();
+		if (context == null) {
+			// If context was not valid, the default values are used
+			// The cursor location validity is checked before showing dialog.
+			sourceEngine.checkCursorLocationValidity();
+		} else {
+			// If context is valid, the name and value proposal are based on it
+			String cname = context.getClassName();
+			String fname = context.getFunctionName();
+			name = TraceUtils.formatTrace(TraceUtils.getDefaultNameFormat(),
+					cname, fname);
+			value = TraceUtils.formatTrace(TraceUtils.getDefaultTraceFormat(),
+					cname, fname);
+		}
+		trace = propertyDialogEngine.showAddTraceDialog(groupProposal, name,
+				value, null);
+		if (trace != null) {
+			int insertLocation = sourceEngine.addTrace(trace);
+			TraceUtils.multiplyTrace(trace, insertLocation, sourceEngine);
+			addInclude();
+			view.selectObject(trace);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderInterface#convertTrace()
+	 */
+	public void convertTrace() throws TraceBuilderException {
+		checkIsModelValid();
+		if (selectedLocation != null && selectedLocation.getTrace() == null) {
+			TraceLocation converted = selectedLocation;
+			Trace trace = locationConverter.convertLocation(selectedLocation);
+			if (trace != null) {
+				// The existing location is removed and the new trace inserted
+				sourceEngine.replaceLocationWithTrace(trace, converted);
+				addInclude();
+				view.selectObject(trace);
+			}
+		} else {
+			if (TraceBuilderConfiguration.ASSERTIONS_ENABLED) {
+				TraceBuilderGlobals.getEvents().postAssertionFailed(
+						"No trace to convert", null); //$NON-NLS-1$
+			}
+		}
+	}
+
+	/**
+	 * Checks that model is valid
+	 * 
+	 * @throws TraceBuilderException
+	 *             if model is not valid
+	 */
+	private void checkIsModelValid() throws TraceBuilderException {
+		if (!model.isValid()) {
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.MODEL_NOT_READY);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderInterface#addParameter()
+	 */
+	public void addParameter() throws TraceBuilderException {
+		checkIsModelValid();
+		if (selectedObject instanceof Trace) {
+			TraceParameter parameter = propertyDialogEngine
+					.showAddParameterDialog((Trace) selectedObject, null);
+			if (parameter != null) {
+				sourceEngine.updateTrace(parameter.getTrace());
+			}
+		} else {
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.TRACE_NOT_SELECTED, false);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderInterface#addConstant()
+	 */
+	public void addConstant() throws TraceBuilderException {
+		checkIsModelValid();
+		TraceConstantTable table = null;
+		if (selectedObject instanceof TraceConstantTable) {
+			table = (TraceConstantTable) selectedObject;
+		} else if (model.hasConstantTables()) {
+			table = model.getConstantTables().next();
+		}
+		propertyDialogEngine.showAddConstantDialog(table, null);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderInterface#addConstant()
+	 */
+	public void selectComponent() throws TraceBuilderException {
+		propertyDialogEngine.showSelectComponentDialog();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderInterface#delete()
+	 */
+	public void delete() throws TraceBuilderException {
+		checkIsModelValid();
+		DeleteObjectCallback callback;
+		// Creates a callback object based on object type
+		if (selectedObject instanceof TraceGroup) {
+			callback = new DeleteGroupCallback((TraceGroup) selectedObject,
+					sourceEngine);
+		} else if (selectedObject instanceof Trace) {
+			callback = new DeleteTraceCallback((Trace) selectedObject,
+					sourceEngine);
+		} else if (selectedObject instanceof TraceParameter) {
+			callback = new DeleteParameterCallback(
+					(TraceParameter) selectedObject);
+		} else if (selectedObject instanceof TraceConstantTableEntry) {
+			callback = new DeleteConstantCallback(
+					(TraceConstantTableEntry) selectedObject);
+		} else if (selectedObject instanceof TraceConstantTable) {
+			callback = new DeleteConstantTableCallback(
+					(TraceConstantTable) selectedObject);
+		} else {
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.CANNOT_DELETE_SELECTED_OBJECT);
+		}
+		int res = callback.delete();
+		if (res == TraceBuilderDialogs.OK) {
+			getActions().enableActions(null);
+			selectedObject = null;
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.tracebuilder.engine.TraceBuilderInterface#deleteMultipleTraces
+	 * ()
+	 */
+	public void deleteMultipleTraces() throws TraceBuilderException {
+		checkIsModelValid();
+		DeleteMultipleTracesCallback callback = new DeleteMultipleTracesCallback(
+				model, sourceEngine, instrumentationEngine);
+		int res = callback.delete();
+		if (res == TraceBuilderDialogs.OK) {
+			getActions().enableActions(null);
+			selectedObject = null;
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderInterface#
+	 * createConstantTableFromSelection()
+	 */
+	public void createConstantTableFromSelection() throws TraceBuilderException {
+		checkIsModelValid();
+		ArrayList<StringValuePair> list = new ArrayList<StringValuePair>();
+		SourceProperties props = sourceEngine.getSelectedSource();
+		if (props != null) {
+			OffsetLength selection = sourceEngine.getSelection(props);
+			String type;
+			try {
+				type = props.getSourceEditor()
+						.parseEnum(selection.offset, list);
+			} catch (Exception e) {
+				throw new TraceBuilderException(
+						TraceBuilderErrorCode.CONSTANT_TABLE_PARSE_FAILED);
+			}
+
+			// If list size is zero, then enum parse has failed
+			if (list.size() == 0) {
+				throw new TraceBuilderException(
+						TraceBuilderErrorCode.INVALID_CONSTANT_TABLE_NAME);
+			}
+
+			int id = model.getNextConstantTableID();
+			pluginEngine.getVerifier().checkConstantTableProperties(model,
+					null, id, type);
+			TraceConstantTable table = null;
+			model.startProcessing();
+			try {
+				table = model.getFactory().createConstantTable(id, type, null);
+				// This needs to be trapped so that the tables gets removed
+				// if something fails
+				for (int i = 0; i < list.size(); i++) {
+					StringValuePair pair = list.get(i);
+					pluginEngine.getVerifier().checkConstantProperties(table,
+							null, pair.value, pair.string);
+					model.getFactory().createConstantTableEntry(table,
+							pair.value, pair.string, null);
+				}
+			} catch (TraceBuilderException e) {
+				model.removeConstantTable(table);
+				throw e;
+			} finally {
+				model.processingComplete();
+			}
+		} else {
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.CONSTANT_TABLE_NOT_PART_OF_PROJECT,
+					false);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.tracebuilder.engine.TraceBuilderInterface#removeFromSource()
+	 */
+	public void removeFromSource() throws TraceBuilderException {
+		if (selectedLocation != null) {
+			Trace trace = selectedLocation.getTrace();
+			sourceEngine.removeLocation(selectedLocation);
+			selectedLocation = null;
+			selectedObject = null;
+			if (trace != null) {
+				view.selectObject(trace);
+			} else {
+				if (model.hasGroups()) {
+					view.selectObject(model.getGroupAt(0));
+				}
+			}
+		} else {
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.LOCATION_NOT_SELECTED);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.tracebuilder.engine.TraceBuilderInterface#removeUnrelatedFromSource
+	 * ()
+	 */
+	public void removeUnrelatedFromSource() throws TraceBuilderException {
+		TraceLocationList list = locationMap.getUnrelatedTraces();
+		for (LocationProperties loc : list) {
+			sourceEngine.removeLocation((TraceLocation) loc);
+		}
+		if (model.hasGroups()) {
+			view.selectObject(model.getGroupAt(0));
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderInterface#showProperties()
+	 */
+	public void showProperties() throws TraceBuilderException {
+		checkIsModelValid();
+		if (selectedObject != null) {
+			// The view flags use the ADD types instead of EDIT types
+			if (selectedObject instanceof TraceGroup) {
+				propertyDialogEngine
+						.showEditGroupDialog((TraceGroup) selectedObject);
+			} else if (selectedObject instanceof Trace) {
+				propertyDialogEngine
+						.showEditTraceDialog((Trace) selectedObject);
+			} else if (selectedObject instanceof TraceConstantTable) {
+				propertyDialogEngine
+						.showEditConstantTableDialog((TraceConstantTable) selectedObject);
+			} else if (selectedObject instanceof TraceConstantTableEntry) {
+				propertyDialogEngine
+						.showEditConstantDialog((TraceConstantTableEntry) selectedObject);
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderInterface#focusView()
+	 */
+	public void switchFocus() {
+		if (view != null && sourceEngine != null) {
+			if (view.hasFocus()) {
+				sourceEngine.setFocus();
+			} else {
+				view.setFocus();
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.tracebuilder.engine.TraceBuilderInterface#openProject(java.
+	 * lang.String, java.lang.String)
+	 */
+	public void openProject(String modelName) throws TraceBuilderException {
+		try {
+			currentProjectName = modelName;
+			if (view != null && isViewRegistered && !model.isValid()) {
+				projectEngine.openTraceProject(currentProjectPath, modelName);
+				for (TraceBuilderEngine engine : engines) {
+					engine.projectOpened();
+				}
+				model.setValid(true);
+				sourceEngine.start();
+			}
+		} catch (TraceBuilderException e) {
+			closeModel();
+			throw e;
+		}
+		// Updates the action configuration
+		getActions().enableActions(null);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderInterface#exportProject()
+	 */
+	public void exportProject() throws TraceBuilderException {
+		checkIsModelValid();
+		if (model.getID() != 0) {
+			for (TraceBuilderEngine engine : engines) {
+				engine.exportProject();
+			}
+		} else {
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.INVALID_MODEL_PROPERTIES_FOR_EXPORT);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderInterface#closeProject()
+	 */
+	public void closeProject() {
+		internalCloseProject();
+		currentProjectPath = null;
+		currentProjectName = null;
+	}
+
+	/**
+	 * Closes the project
+	 */
+	private void internalCloseProject() {
+		if (model.isValid()) {
+			if (!TraceBuilderGlobals.getConfiguration().getFlag(
+					TraceBuilderConfiguration.CONSOLE_UI_MODE)) {
+				try {
+					// Plug-in's are not exported when project is closed
+					// They can do cleanup in traceProjectClosed call
+					for (TraceBuilderEngine engine : engines) {
+						if (engine != pluginEngine) {
+							engine.exportProject();
+						}
+					}
+				} catch (TraceBuilderException e) {
+					getEvents().postError(e);
+				}
+			}
+			// Engines are closed in reverse order
+			for (int i = engines.size() - 1; i >= 0; i--) {
+				engines.get(i).projectClosed();
+			}
+			sourceEngine.shutdown();
+			closeModel();
+		}
+		// Updates the action configuration
+		getActions().enableActions(null);
+	}
+
+	/**
+	 * Closes the trace model
+	 */
+	private void closeModel() {
+		try {
+			if (model != null) {
+				model.reset();
+				model.setValid(false);
+			}
+		} catch (Exception e) {
+			if (TraceBuilderConfiguration.ASSERTIONS_ENABLED) {
+				getEvents().postAssertionFailed("Failed to close model", e); //$NON-NLS-1$
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.tracebuilder.engine.TraceBuilderInterface#startInstrumenter()
+	 */
+	public void startInstrumenter() throws TraceBuilderException {
+		checkIsModelValid();
+		instrumentationEngine.checkSourceFunctions(sourceEngine);
+		propertyDialogEngine.showInstrumenterDialog(
+				getOwningTraceGroup(selectedObject), null,
+				new RunInstrumenterCallback(model, sourceEngine,
+						contextManager, instrumentationEngine
+								.getNewInstrumenterID()));
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.SourceListener#
+	 * selectionChanged(com.nokia.tracebuilder.engine.TraceLocation)
+	 */
+	public void selectionChanged(TraceLocation location) {
+		if (view != null) {
+			selectionFromSource = true;
+			view.selectLocation(location);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.SourceListener#
+	 * sourceOpened(com.nokia.tracebuilder.engine.SourceProperties)
+	 */
+	public void sourceOpened(SourceProperties properties) {
+		locationMap.addSource(properties);
+		locationConverter.parseTracesFromSource(properties);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.SourceListener#
+	 * sourceChanged(com.nokia.tracebuilder.engine.SourceProperties)
+	 */
+	public void sourceChanged(SourceProperties properties) {
+		locationMap.updateSource(properties);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.source.SourceListener#
+	 * sourceProcessingStarted
+	 * (com.nokia.tracebuilder.engine.source.SourceProperties)
+	 */
+	public void sourceProcessingStarted(SourceProperties properties) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.source.SourceListener#
+	 * sourceProcessingComplete
+	 * (com.nokia.tracebuilder.engine.source.SourceProperties)
+	 */
+	public void sourceProcessingComplete(SourceProperties properties) {
+		sourceChanged(properties);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.SourceListener#
+	 * sourceClosed(com.nokia.tracebuilder.engine.SourceProperties)
+	 */
+	public void sourceClosed(SourceProperties properties) {
+		locationMap.removeSource(properties, null, null);
+		locationConverter.sourceClosed(properties);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.source.SourceListener#
+	 * sourceSaved(com.nokia.tracebuilder.engine.source.SourceProperties)
+	 */
+	public void sourceSaved(SourceProperties properties) {
+		String selectedObjectName = null;
+
+		// If selected object is trace, save trace name so we can use it to
+		// return selection after saving operation
+		if (selectedObject instanceof Trace && selectedObject != null) {
+			selectedObjectName = selectedObject.getName();
+		}
+
+		locationConverter.sourceSaved(properties);
+
+		// If selected object before saving operation was trace, return
+		// selection
+		if (selectedObjectName != null) {
+			selectedObject = model.findTraceByName(selectedObjectName);
+		}
+	}
+
+	/**
+	 * Gets the trace group which owns the given object
+	 * 
+	 * @param object
+	 *            the object to be checked
+	 * @return the group
+	 */
+	private TraceGroup getOwningTraceGroup(TraceObject object) {
+		TraceGroup owner = null;
+		if (object instanceof Trace) {
+			owner = ((Trace) object).getGroup();
+		} else if (object instanceof TraceGroup) {
+			owner = (TraceGroup) object;
+		} else if (object instanceof TraceParameter) {
+			owner = getOwningTraceGroup(((TraceParameter) object).getTrace());
+		}
+		return owner;
+	}
+
+	/**
+	 * Adds the include statement to source
+	 */
+	private void addInclude() {
+		// Adds the include statement if it is not yet in source
+		SourceProperties properties = sourceEngine.getSelectedSource();
+		String fileName = getHeaderFileName(properties.getFileName());
+		if (fileName != null) {
+			sourceEngine.addInclude(properties, fileName);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderInterface#exportProject()
+	 */
+	public Iterator<SourceProperties> getOpenSources() {
+		return sourceEngine.getSources();
+
+	}
+
+	/**
+	 * Get the view
+	 * 
+	 * @return the view
+	 */
+	public TraceBuilderView getView() {
+		return view;
+	}
+
+	/**
+	 * Set current software component index
+	 * 
+	 * @param componentIndex
+	 *            software component index
+	 */
+	public void setCurrentSoftwareComponentIndex(int componentIndex) {
+		this.currentSoftwareComponentIndex = componentIndex;
+	}
+
+	/**
+	 * Get software component Id
+	 * 
+	 * @return the software component Id as string
+	 */
+	public String getCurrentSoftwareComponentId() {
+		String softwareComponentId = null;
+		if (softwareComponents.size() > 0) {
+			softwareComponentId = softwareComponents.get(
+					currentSoftwareComponentIndex).getId();
+		}
+		return softwareComponentId;
+	}
+
+	/**
+	 * Get software component name
+	 * 
+	 * @return the software component name as string
+	 */
+	public String getCurrentSoftwareComponentName() {
+		String softwareComponentName = null;
+		if (softwareComponents.size() > 0) {
+			softwareComponentName = softwareComponents.get(
+					currentSoftwareComponentIndex).getName();
+		}
+		return softwareComponentName;
+	}
+
+	/**
+	 * Add software component
+	 * 
+	 * @param softwareComponentId
+	 *            software component id
+	 * @param softwareComponentName
+	 *            software component name
+	 * @param mmpPath
+	 *            components mmp path
+	 */
+	public void addSoftwareComponent(String softwareComponentId,
+			String softwareComponentName, String mmpPath) {
+		SoftwareComponent softwareComponent = new SoftwareComponent(
+				softwareComponentId, softwareComponentName, mmpPath);
+		softwareComponents.add(softwareComponent);
+	}
+
+	/**
+	 * Clear software components
+	 */
+	public void clearSoftwareComponents() {
+		previousSoftwareComponentName = getCurrentSoftwareComponentName();
+		softwareComponents.clear();
+	}
+
+	/**
+	 * Gets the software components
+	 * 
+	 * @return the software components iterator
+	 */
+	public Iterator<SoftwareComponent> getSoftwareComponents() {
+		Iterator<SoftwareComponent> componentIterator = softwareComponents
+				.iterator();
+		return componentIterator;
+	}
+
+	/**
+	 * Get current software component's MMP path
+	 * 
+	 * @return the current software component's MMP path
+	 */
+	public String getCurrentSoftwareComponentMMPPath() {
+		String mmpPath = null;
+		if (softwareComponents.size() > 0) {
+			mmpPath = softwareComponents.get(currentSoftwareComponentIndex)
+					.getMMPFilePath();
+		}
+		return mmpPath;
+	}
+
+	/**
+	 * Get current software component index
+	 * 
+	 * @return current software component index
+	 */
+	public int getCurrentSoftwareComponentIndex() {
+		return currentSoftwareComponentIndex;
+	}
+
+	/**
+	 * Get previous software component name
+	 * 
+	 * @return previous software component name
+	 */
+	public String getPreviousSoftwareComponentName() {
+		return previousSoftwareComponentName;
+	}
+
+	/**
+	 * Get project path
+	 * 
+	 * @return project path
+	 */
+	public String getProjectPath() {
+		return currentProjectPath;
+	}
+
+	/**
+	 * Set project path
+	 * 
+	 * @param path
+	 *            the path
+	 */
+	public void setProjectPath(String path) {
+		currentProjectPath = path;
+	}
+
+	/**
+	 * Set project monitor
+	 * 
+	 * @param projectMonitor
+	 *            the project monitor
+	 */
+	public void setProjectMonitor(TraceProjectMonitorInterface projectMonitor) {
+		this.projectMonitor = projectMonitor;
+	}
+
+	/**
+	 * Gets the name for the trace header file based on given source
+	 * 
+	 * @param sourceFile
+	 *            the source file name
+	 * @return the header file name
+	 */
+	public String getHeaderFileName(String sourceFile) {
+		String retval = null;
+		if (model != null) {
+			// The header file name is the source file name with extension
+			// replaced by Traces.h
+			File f = new File(sourceFile);
+			retval = removeFileExtension(f.getName()) + TRACE_HEADER_EXTENSION;
+		}
+		return retval;
+	}
+
+	/**
+	 * Removes the file extension from file name
+	 * 
+	 * @param fileName
+	 *            the file name
+	 * @return name without extension
+	 */
+	private String removeFileExtension(String fileName) {
+		int index = fileName.lastIndexOf('.');
+		int sep1 = fileName.lastIndexOf('/');
+		int sep2 = fileName.lastIndexOf('\\');
+		if (index > sep1 && index > sep2) {
+			fileName = fileName.substring(0, index);
+		}
+		return fileName;
+	}
+
+	/**
+	 * Get location converter
+	 * 
+	 * @return the location converter
+	 */
+	public TraceLocationConverter getLocationConverter() {
+		return locationConverter;
+	}
+
+	/**
+	 * Get location map
+	 * 
+	 * @return the location map
+	 */
+	public TraceLocationMap getLocationMap() {
+		return locationMap;
+	}
+
+	/**
+	 * Set group name handler
+	 * 
+	 */
+	public void setGroupNameHandler(GroupNameHandlerBase groupNameHandler) {
+		this.groupNameHandler = groupNameHandler;
+	}	
+	
+	/**
+	 * Get group name handler
+	 * 
+	 * @return the group name handler
+	 */
+	public GroupNameHandlerBase getGroupNameHandler() {
+		return groupNameHandler;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceBuilderActions.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 interface
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+/**
+ * Action interface
+ * 
+ */
+public interface TraceBuilderActions {
+
+	/**
+	 * Enables actions based on selected object
+	 * 
+	 * @param object
+	 *            the object that has been selected
+	 */
+	public void enableActions(Object object);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceBuilderConfiguration.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,188 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 to configuration of Trace Builder
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+/**
+ * Access to configuration of Trace Builder
+ * 
+ */
+public interface TraceBuilderConfiguration {
+
+	/**
+	 * Name of the currently selected source formatter
+	 */
+	public String FORMATTER_NAME = "TraceBuilder.sourceFormatter"; //$NON-NLS-1$
+
+	/**
+	 * Environment root
+	 */
+	public String ENVIRONMENT_ROOT = "TraceBuilder.environmentRoot"; //$NON-NLS-1$
+
+	/**
+	 * Printf support flag
+	 */
+	public String PRINTF_SUPPORT = "TraceBuilder.printfSupport"; //$NON-NLS-1$
+
+	/**
+	 * Printf extension macro
+	 */
+	public String PRINTF_EXTENSION = "TraceBuilder.printfMacro"; //$NON-NLS-1$
+
+	/**
+	 * Console UI mode flag
+	 */
+	public String CONSOLE_UI_MODE = "TraceBuilder.consoleUI"; //$NON-NLS-1$
+
+	/**
+	 * Flag to show the project files in view
+	 */
+	public boolean SHOW_PROJECT_FILES = false;
+
+	/**
+	 * Compiler flag to show hidden parameters in view
+	 */
+	public boolean SHOW_HIDDEN_PARAMETERS_IN_VIEW = false;
+
+	/**
+	 * Compiler flag to show location tag in view
+	 */
+	public boolean SHOW_LOCATION_TAG_IN_VIEW = false;
+
+	/**
+	 * Assertions events are enabled
+	 */
+	public boolean ASSERTIONS_ENABLED = true;
+
+	/**
+	 * Trace location assertions are enabled
+	 */
+	public boolean GLOBAL_LOCATION_ASSERTS = false;
+
+	/**
+	 * Traces the view state
+	 */
+	public boolean TRACE_VIEW_STATE = false;
+
+	/**
+	 * Allow changes to source formatter
+	 */
+	public boolean ALLOW_FORMAT_CHANGE = false;
+
+	/**
+	 * Comment after trace
+	 */
+	public String COMMENT_POSITION_AFTER_TRACE = "before"; //$NON-NLS-1$
+
+	/**
+	 * Comment before trace
+	 */
+	public String COMMENT_POSITION_BEFORE_TRACE = "after"; //$NON-NLS-1$
+
+	/**
+	 * Flag which determines if the configuration is available
+	 * 
+	 * @return true if available, false if not
+	 */
+	public boolean isAvailable();
+
+	/**
+	 * Stores a boolean flag into properties
+	 * 
+	 * @param flagName
+	 *            name for the flag
+	 * @param flag
+	 *            flag to be stored
+	 */
+	public void setFlag(String flagName, boolean flag);
+
+	/**
+	 * Gets a configuration flag based on flag name
+	 * 
+	 * @param flagName
+	 *            the confiugration flag name
+	 * @return the flag value
+	 */
+	public boolean getFlag(String flagName);
+
+	/**
+	 * Stores an integer value into properties
+	 * 
+	 * @param valueName
+	 *            name for the value
+	 * @param value
+	 *            value to be stored
+	 */
+	public void setValue(String valueName, int value);
+
+	/**
+	 * Gets a configuration value based on value name
+	 * 
+	 * @param valueName
+	 *            configuration value name
+	 * @return the value
+	 */
+	public int getValue(String valueName);
+
+	/**
+	 * Stores text into properties
+	 * 
+	 * @param textName
+	 *            name for the text
+	 * @param text
+	 *            text to be stored
+	 */
+	public void setText(String textName, String text);
+
+	/**
+	 * Gets a text entry based on property name
+	 * 
+	 * @param textName
+	 *            configuration value name
+	 * @return the text
+	 */
+	public String getText(String textName);
+
+	/**
+	 * Checks if the given entry exists in configuration.
+	 * 
+	 * @param entryName
+	 *            the name of the entry
+	 * @return true if entry exists, false otherwise
+	 */
+	public boolean hasEntry(String entryName);
+
+	/**
+	 * Adds a configuration listener to this configuration
+	 * 
+	 * @param configurationListener
+	 *            the listener to be added
+	 */
+	public void addConfigurationListener(
+			TraceBuilderConfigurationListener configurationListener);
+
+	/**
+	 * Removes an existing configuration listener
+	 * 
+	 * @param configurationListener
+	 *            the listener to be removed
+	 */
+	public void removeConfigurationListener(
+			TraceBuilderConfigurationListener configurationListener);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceBuilderConfigurationListener.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Configuration listener interface
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+/**
+ * Configuration listener interface
+ * 
+ */
+public interface TraceBuilderConfigurationListener {
+
+	/**
+	 * Configuration creation notification
+	 */
+	public void configurationCreated();
+
+	/**
+	 * Change notification in configuration
+	 * 
+	 * @param property
+	 *            the property that was changed
+	 * @param newValue
+	 *            the new value
+	 */
+	public void configurationChanged(String property, Object newValue);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceBuilderDialogs.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,255 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 provided to other components via TraceBuilderGlobals
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+import java.util.List;
+
+/**
+ * Interface provided to other components via {@link TraceBuilderGlobals}. This
+ * can be used to show various query and error dialogs to the user
+ * 
+ */
+public interface TraceBuilderDialogs {
+
+	/**
+	 * Parameters for a check list dialog
+	 * 
+	 */
+	public class CheckListDialogParameters {
+
+		/**
+		 * The dialog type
+		 */
+		public CheckListDialogType dialogType;
+
+		/**
+		 * Root items for the dialog
+		 */
+		public List<CheckListDialogEntry> rootItems;
+
+		/**
+		 * Initial expand level for dialog tree
+		 */
+		public int expandLevel;
+
+		/**
+		 * Flag to show / hide the root element
+		 */
+		public boolean showRoot;
+
+	}
+
+	/**
+	 * Parameters for a query dialog
+	 * 
+	 */
+	public class QueryDialogParameters {
+
+		/**
+		 * The query dialog type
+		 */
+		public QueryDialogType dialogType;
+
+	}
+
+	/**
+	 * Query, which shows a file path but does not allow the user to change it
+	 * 
+	 */
+	public class FileQueryParameters extends QueryDialogParameters {
+
+		/**
+		 * File path
+		 */
+		public String path;
+
+	}
+
+	/**
+	 * Query, which allows user to select a file via file dialog
+	 * 
+	 */
+	public class FileDialogQueryParameters extends FileQueryParameters {
+
+		/**
+		 * File filter titles
+		 */
+		public String[] filterTitles;
+
+		/**
+		 * File filters
+		 */
+		public String[] filters;
+
+	}
+
+	/**
+	 * Query, which allows user to select a directory via directory dialog
+	 * 
+	 */
+	public class DirectoryDialogQueryParameters extends FileQueryParameters {
+	}
+
+	/**
+	 * Parameters for delete object query
+	 * 
+	 */
+	public class DeleteObjectQueryParameters extends QueryDialogParameters {
+
+		/**
+		 * Name of the object to be deleted
+		 */
+		public String objectName;
+
+		/**
+		 * Name of the owner of the object to be deleted
+		 */
+		public String ownerName;
+
+	}
+
+	/**
+	 * Query with user-defined message and buttons
+	 * 
+	 */
+	public class ExtendedQueryParameters extends QueryDialogParameters {
+
+		/**
+		 * Dialog message
+		 */
+		public String message;
+
+		/**
+		 * Titles for the buttons
+		 */
+		public String[] buttonTitles;
+
+	}
+
+	/**
+	 * Query dialog types
+	 * 
+	 */
+	enum QueryDialogType {
+
+		/**
+		 * Delete group confirmation query type
+		 */
+		DELETE_GROUP,
+
+		/**
+		 * Delete trace confirmation query type
+		 */
+		DELETE_TRACE,
+
+		/**
+		 * Delete parameter confirmation query type
+		 */
+		DELETE_PARAMETER,
+
+		/**
+		 * Delete constant table query type
+		 */
+		DELETE_CONSTANT_TABLE,
+
+		/**
+		 * Delete constant query type
+		 */
+		DELETE_CONSTANT,
+
+		/**
+		 * Import project query
+		 */
+		IMPORT_TRACE_PROJECT,
+
+		/**
+		 * Select environment query
+		 */
+		SELECT_TARGET_ENVIRONMENT,
+
+		/**
+		 * Model update when source is not open
+		 */
+		UPDATE_WHEN_SOURCE_NOT_OPEN,
+
+		/**
+		 * Replace existing file query type. This does not use the normal Yes /
+		 * No dialog
+		 */
+		REPLACE_FILE
+	}
+
+	/**
+	 * Checklist dialog type
+	 * 
+	 */
+	enum CheckListDialogType {
+
+		/**
+		 * Delete multiple traces check list type
+		 */
+		DELETE_TRACES,
+
+		/**
+		 * Instrument files check list type
+		 */
+		INSTRUMENT_FILES
+
+	}
+
+	/**
+	 * OK result
+	 */
+	int OK = 0; // CodForChk_Dis_Magic
+
+	/**
+	 * Cancel result
+	 */
+	int CANCEL = 1; // CodForChk_Dis_Magic
+
+	/**
+	 * Shows an error dialog to user. This must use display.asyncExec instead of
+	 * showing the dialog directly
+	 * 
+	 * @param message
+	 *            the message
+	 */
+	public void showErrorMessage(String message);
+
+	/**
+	 * Shows a confirmation (Yes / No) dialog to the user. This uses one of the
+	 * pre-defined confirmation query types.
+	 * 
+	 * @param parameters
+	 *            the parameters for the query
+	 * @return YES / NO
+	 */
+	public int showConfirmationQuery(QueryDialogParameters parameters);
+
+	/**
+	 * Shows a dialog with list of selectable items and OK / Cancel buttons.
+	 * This uses one of the pre-defined check list dialog types.
+	 * 
+	 * @param parameters
+	 *            the parameters for the dialog
+	 * @return OK / CANCEL
+	 */
+	public int showCheckList(CheckListDialogParameters parameters);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceBuilderEngine.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 engine classes
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+import com.nokia.tracebuilder.model.TraceBuilderException;
+
+/**
+ * Base class for all engine classes
+ * 
+ */
+public abstract class TraceBuilderEngine {
+
+	/**
+	 * Called after trace project has been opened
+	 */
+	public abstract void projectOpened();
+
+	/**
+	 * Called when trace project is closed
+	 */
+	public abstract void projectClosed();
+
+	/**
+	 * Called when exporting the project
+	 * 
+	 * @throws TraceBuilderException
+	 *             if export fails
+	 */
+	public abstract void exportProject() throws TraceBuilderException;
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceBuilderErrorCodes.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,476 @@
+/*
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Error codes for Trace Builder
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+import com.nokia.tracebuilder.model.TraceBuilderErrorParameters;
+import com.nokia.tracebuilder.model.TraceBuilderException.TraceBuilderExceptionCode;
+
+/**
+ * Error codes for Trace Builder
+ * 
+ */
+public interface TraceBuilderErrorCodes {
+
+	/**
+	 * Error parameters for a file-related errors
+	 * 
+	 */
+	public class FileErrorParameters extends TraceBuilderErrorParameters {
+
+		/**
+		 * Path to the file
+		 */
+		public String file;
+
+	}
+
+	/**
+	 * Error parameters for errors related to names, titles etc.
+	 * 
+	 */
+	public class StringErrorParameters extends TraceBuilderErrorParameters {
+
+		/**
+		 * String
+		 */
+		public String string;
+
+	}
+
+	/**
+	 * Error parameters for integer values that must be between two values
+	 * 
+	 */
+	public class RangeErrorParameters extends TraceBuilderErrorParameters {
+
+		/**
+		 * Start of range
+		 */
+		public int start;
+
+		/**
+		 * End of range
+		 */
+		public int end;
+
+		/**
+		 * Hex / decimal flag
+		 */
+		public boolean isHex;
+
+	}
+
+	/**
+	 * Error codes for TraceBuilder
+	 * 
+	 */
+	public enum TraceBuilderErrorCode implements TraceBuilderExceptionCode {
+
+		/**
+		 * Success
+		 */
+		OK,
+
+		/**
+		 * Trace ID was duplicate
+		 */
+		DUPLICATE_TRACE_ID,
+
+		/**
+		 * Group ID was duplicate
+		 */
+		DUPLICATE_GROUP_ID,
+
+		/**
+		 * Trace name was duplicate
+		 */
+		DUPLICATE_TRACE_NAME,
+
+		/**
+		 * Trace name was duplicate
+		 */
+		DUPLICATE_GROUP_NAME,
+
+		/**
+		 * Trace ID was not valid. Parameters for this error are either
+		 * RangeErrorParameters or null (no range)
+		 */
+		INVALID_TRACE_ID,
+
+		/**
+		 * Group ID was not valid. Parameters for this error are either
+		 * RangeErrorParameters or null (no range)
+		 */
+		INVALID_GROUP_ID,
+
+		/**
+		 * Name was not valid
+		 */
+		INVALID_TRACE_NAME,
+
+		/**
+		 * Name was not valid
+		 */
+		INVALID_GROUP_NAME,
+
+		/**
+		 * Trace string was not valid
+		 */
+		INVALID_TRACE_DATA,
+
+		/**
+		 * Cannot edit source file
+		 */
+		SOURCE_NOT_EDITABLE,
+
+		/**
+		 * Source location was not valid
+		 */
+		INVALID_SOURCE_LOCATION,
+
+		/**
+		 * Unreachable trace location
+		 */
+		UNREACHABLE_TRACE_LOCATION,
+
+		/**
+		 * Tried to perform group operation when group was not selected
+		 */
+		GROUP_NOT_SELECTED,
+
+		/**
+		 * Tried to perform trace operation when trace was not selected
+		 */
+		TRACE_NOT_SELECTED,
+
+		/**
+		 * Not enough parameters in trace
+		 */
+		NOT_ENOUGH_PARAMETERS,
+
+		/**
+		 * Unexpected exception occurred
+		 */
+		UNEXPECTED_EXCEPTION,
+
+		/**
+		 * Trace model is not ready
+		 */
+		MODEL_NOT_READY,
+
+		/**
+		 * No trace groups
+		 */
+		NO_TRACE_GROUPS,
+
+		/**
+		 * Parameter name is not valid
+		 */
+		INVALID_PARAMETER_NAME,
+
+		/**
+		 * Model properties are not valid
+		 */
+		INVALID_MODEL_PROPERTIES_FOR_EXPORT,
+
+		/**
+		 * Model name is not valid
+		 */
+		INVALID_MODEL_NAME,
+
+		/**
+		 * Trace project file cannot be parsed
+		 */
+		INVALID_PROJECT_FILE,
+
+		/**
+		 * File was not found. This error is related to FileErrorParameters
+		 * class
+		 */
+		FILE_NOT_FOUND,
+
+		/**
+		 * Path was not valid. This is related to FileErrorParameters class
+		 */
+		INVALID_PATH,
+
+		/**
+		 * Constant value was duplicate
+		 */
+		DUPLICATE_CONSTANT_VALUE,
+
+		/**
+		 * Constant name was already in use
+		 */
+		DUPLICATE_CONSTANT_TABLE_NAME,
+
+		/**
+		 * Constant table name was not valid
+		 */
+		INVALID_CONSTANT_TABLE_NAME,
+
+		/**
+		 * Constant table not part of project
+		 */
+		CONSTANT_TABLE_NOT_PART_OF_PROJECT,
+		
+		/**
+		 * Constant ID was already in use
+		 */
+		DUPLICATE_CONSTANT_ID,
+
+		/**
+		 * Constant value was not valid
+		 */
+		INVALID_CONSTANT_VALUE,
+
+		/**
+		 * Parameter name was already in use
+		 */
+		DUPLICATE_PARAMETER_NAME,
+
+		/**
+		 * Parameter type was not supported
+		 */
+		INVALID_PARAMETER_TYPE,
+
+		/**
+		 * Parameters cannot be added
+		 */
+		PARAMETER_ADD_NOT_ALLOWED,
+
+		/**
+		 * Parameters cannot be removed
+		 */
+		PARAMETER_REMOVE_NOT_ALLOWED,
+
+		/**
+		 * Parameter template was already used by another parameter
+		 */
+		PARAMETER_TEMPLATE_ALREADY_IN_USE,
+
+		/**
+		 * Tried to remove trace location when one was not selected
+		 */
+		LOCATION_NOT_SELECTED,
+
+		/**
+		 * Cannot add a constant, since constant table was not selected
+		 */
+		CONSTANT_TABLE_NOT_SELECTED,
+
+		/**
+		 * The selected object was not valid target for delete operation
+		 */
+		CANNOT_DELETE_SELECTED_OBJECT,
+
+		/**
+		 * Trace text format is not valid
+		 */
+		INVALID_TRACE_TEXT_FORMAT,
+
+		/**
+		 * Trace name format is not valid
+		 */
+		INVALID_TRACE_NAME_FORMAT,
+
+		/**
+		 * Missing function name from trace name format
+		 */
+		TRACE_NAME_FORMAT_MISSING_FUNCTION,
+
+		/**
+		 * No traces to delete
+		 */
+		NO_TRACES_TO_DELETE,
+
+		/**
+		 * Source file is not open
+		 */
+		SOURCE_NOT_OPEN,
+
+		/**
+		 * Failed to parse a constant table from source
+		 */
+		CONSTANT_TABLE_PARSE_FAILED,
+
+		/**
+		 * Cannot open project file
+		 */
+		CANNOT_OPEN_PROJECT_FILE,
+
+		/**
+		 * Cannot write project file
+		 */
+		CANNOT_WRITE_PROJECT_FILE,
+
+		/**
+		 * Parameter ID was already in use
+		 */
+		DUPLICATE_PARAMETER_ID,
+
+		/**
+		 * Constant table ID was already in use
+		 */
+		DUPLICATE_CONSTANT_TABLE_ID,
+
+		/**
+		 * Instrumenter function list was empty
+		 */
+		NO_FUNCTIONS_TO_INSTRUMENT,
+
+		/**
+		 * Instrumenter function list was empty. Related to
+		 * StringErrorParameters
+		 */
+		NO_FUNCTIONS_TO_INSTRUMENT_WITH_TEMPLATE,
+
+		/**
+		 * Multiple errors during an operation
+		 */
+		MULTIPLE_ERRORS_IN_OPERATION,
+
+		/**
+		 * Printf parameter parameter format specification did not match the
+		 * parameter count
+		 */
+		PARAMETER_FORMAT_MISMATCH,
+
+		/**
+		 * A trace does not exist
+		 */
+		TRACE_DOES_NOT_EXIST,
+
+		/**
+		 * Trace needs to be converted to correct API
+		 */
+		TRACE_NEEDS_CONVERSION,
+
+		/**
+		 * Parameter count of location and trace do not match
+		 */
+		PARAMETER_COUNT_MISMATCH,
+
+		/**
+		 * Parameter count in location does not match the API macro
+		 */
+		PARAMETER_COUNT_DOES_NOT_MATCH_API,
+
+		/**
+		 * Location parser failed
+		 */
+		LOCATION_PARSER_FAILED,
+
+		/**
+		 * Trace is not referenced from source files
+		 */
+		TRACE_HAS_NO_LOCATIONS,
+
+		/**
+		 * Trace is used from multiple locations in source files
+		 */
+		TRACE_HAS_MULTIPLE_LOCATIONS,
+
+		/**
+		 * Project was empty when export was called
+		 */
+		NO_TRACES_TO_EXPORT,
+
+		/**
+		 * Source file cannot be opened
+		 */
+		CANNOT_OPEN_SOURCE_FILE,
+
+		/**
+		 * Trace in source cannot be updated
+		 */
+		CANNOT_UPDATE_TRACE_INTO_SOURCE,
+
+		/**
+		 * Parameter format is not supported
+		 */
+		PARAMETER_FORMAT_NOT_SUPPORTED,
+
+		/**
+		 * Parameter format is not supported by default macros
+		 */
+		PARAMETER_FORMAT_NEEDS_EXT_MACRO,
+
+		/**
+		 * Ext macro usage is not necessary with
+		 */
+		PARAMETER_FORMAT_UNNECESSARY_EXT_MACRO,
+
+		/**
+		 * Parameter format cannot be used as an array
+		 */
+		PARAMETER_FORMAT_NOT_SUPPORTED_IN_ARRAY,
+
+		/**
+		 * Property file element was unknown
+		 */
+		PROPERTY_FILE_ELEMENT_NOT_SUPPORTED,
+
+		/**
+		 * Property file element was in wrong place
+		 */
+		PROPERTY_FILE_ELEMENT_MISPLACED,
+
+		/**
+		 * Property file attribute was not valid
+		 */
+		PROPERTY_FILE_ATTRIBUTE_INVALID,
+
+		/**
+		 * Inserting a trace into source will produce incorrect results
+		 */
+		INSERT_TRACE_DOES_NOT_WORK,
+
+		/**
+		 * Trace found from source is not in valid source context
+		 */
+		NO_CONTEXT_FOR_LOCATION,
+
+		/**
+		 * Function parameters could not be parsed
+		 */
+		CANNOT_PARSE_FUNCTION_PARAMETERS,
+
+		/**
+		 * Parameter name is not valid exit trace return parameter name
+		 */
+		INVALID_PARAMETER_NAME_IN_RETURN_VALUE,
+		
+		/**
+		 * Run out of user defined Group IDs
+		 */
+		RUN_OUT_OF_USER_DEFINED_GROUP_IDS,
+		
+		/**
+		 * Cannot add function parameters if there is var arg list 
+		 */
+		VAR_ARG_LIST_PARAMETER_FOUND,
+		
+		/**
+		 * Unknown OST version
+		 */
+		UNKNOWN_OST_VERSION
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceBuilderErrorMessages.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,713 @@
+/*
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Error code to error message mapper
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+import java.io.File;
+
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.FileErrorParameters;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.RangeErrorParameters;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.StringErrorParameters;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.TraceBuilderErrorCode;
+import com.nokia.tracebuilder.model.TraceBuilderErrorParameters;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.project.TraceProjectAPI;
+import com.nokia.tracebuilder.source.SourceConstants;
+import com.nokia.tracebuilder.source.SourceUtils;
+
+/**
+ * Error code to error message mapper
+ * 
+ */
+public final class TraceBuilderErrorMessages {
+
+	/**
+	 * Maps an exception to error message
+	 * 
+	 * @param e
+	 *            the exception
+	 * @return the message
+	 */
+	public static String getErrorMessage(TraceBuilderException e) {
+		return TraceBuilderErrorMessages.getErrorMessage(
+				(TraceBuilderErrorCode) e.getErrorCode(), e
+						.getErrorParameters());
+	}
+
+	/**
+	 * Maps error code to error message
+	 * 
+	 * @param error
+	 *            the error code
+	 * @param parameters
+	 *            the parameters of the error
+	 * @return the message
+	 */
+	public static String getErrorMessage(TraceBuilderErrorCode error,
+			TraceBuilderErrorParameters parameters) {
+		// CodForChk_Dis_LengthyFunc
+		// CodForChk_Dis_ComplexFunc
+		String s;
+		StringBuffer sb = new StringBuffer();
+		switch (error) {
+		case DUPLICATE_GROUP_ID:
+			sb.append(Messages
+					.getString("TraceBuilderErrorMessages.DuplicateGroupID")); //$NON-NLS-1$
+			break;
+		case DUPLICATE_GROUP_NAME:
+			sb.append(Messages
+					.getString("TraceBuilderErrorMessages.DuplicateGroupName")); //$NON-NLS-1$
+			break;
+		case DUPLICATE_TRACE_ID:
+			sb.append(Messages
+					.getString("TraceBuilderErrorMessages.DuplicateTraceID")); //$NON-NLS-1$
+			break;
+		case DUPLICATE_TRACE_NAME:
+			sb.append(Messages
+					.getString("TraceBuilderErrorMessages.DuplicateTraceName")); //$NON-NLS-1$
+			break;
+		case DUPLICATE_PARAMETER_ID:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.DuplicateParameterID"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case DUPLICATE_CONSTANT_VALUE:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.DuplicateConstantValue"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case DUPLICATE_CONSTANT_ID:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.DuplicateConstantID"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case DUPLICATE_CONSTANT_TABLE_NAME:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.DuplicateConstantTableName"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case DUPLICATE_CONSTANT_TABLE_ID:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.DuplicateConstantTableID"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case DUPLICATE_PARAMETER_NAME:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.DuplicateParameterName"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case INVALID_GROUP_ID:
+			createInvalidGroupIDMessage(parameters, sb);
+			break;
+		case INVALID_TRACE_ID:
+			createInvalidTraceIDMessage(parameters, sb);
+			break;
+		case INVALID_MODEL_PROPERTIES_FOR_EXPORT:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.InvalidModelPropertiesForExport"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case INVALID_MODEL_NAME:
+			sb.append(Messages
+					.getString("TraceBuilderErrorMessages.InvalidProjectName")); //$NON-NLS-1$
+			break;
+		case INVALID_GROUP_NAME:
+			sb.append(Messages
+					.getString("TraceBuilderErrorMessages.InvalidGroupName")); //$NON-NLS-1$
+			break;
+		case INVALID_TRACE_NAME:
+			sb.append(Messages
+					.getString("TraceBuilderErrorMessages.InvalidTraceName")); //$NON-NLS-1$
+			break;
+		case INVALID_PARAMETER_NAME:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.InvalidParameterName"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case INVALID_CONSTANT_TABLE_NAME:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.InvalidConstantTableName"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case CONSTANT_TABLE_NOT_PART_OF_PROJECT:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.ConstantTableNotPartOfProject"); //$NON-NLS-1$
+			sb.append(s);
+			break;			
+		case INVALID_TRACE_DATA:
+			sb.append(Messages
+					.getString("TraceBuilderErrorMessages.InvalidTraceData")); //$NON-NLS-1$
+			break;
+		case INVALID_PARAMETER_TYPE:
+			createInvalidParameterTypeMessage(parameters, sb);
+			break;
+		case INVALID_CONSTANT_VALUE:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.InvalidConstantValue"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case SOURCE_NOT_EDITABLE:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.SourceNotEditable"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case INVALID_SOURCE_LOCATION:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.InvalidSourceLocation"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case UNREACHABLE_TRACE_LOCATION:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.UnreachableTraceLocation"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case INVALID_PROJECT_FILE:
+			sb.append(Messages
+					.getString("TraceBuilderErrorMessages.InvalidTraceFile")); //$NON-NLS-1$
+			break;
+		case FILE_NOT_FOUND:
+			createFileNotFoundMessage((FileErrorParameters) parameters, sb);
+			break;
+		case INVALID_PATH:
+			createInvalidPathMessage((FileErrorParameters) parameters, sb);
+			break;
+		case SOURCE_NOT_OPEN:
+			sb.append(Messages
+					.getString("TraceBuilderErrorMessages.SourceNotOpen")); //$NON-NLS-1$
+			break;
+		case CANNOT_OPEN_PROJECT_FILE:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.CannotOpenProjectFile"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case CANNOT_WRITE_PROJECT_FILE:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.CannotWriteProjectFile"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case PARAMETER_FORMAT_MISMATCH:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.ParameterFormatMismatch"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case GROUP_NOT_SELECTED:
+			sb.append(Messages
+					.getString("TraceBuilderErrorMessages.GroupNotSelected")); //$NON-NLS-1$
+			break;
+		case TRACE_NOT_SELECTED:
+			sb.append(Messages
+					.getString("TraceBuilderErrorMessages.TraceNotSelected")); //$NON-NLS-1$
+			break;
+		case CONSTANT_TABLE_NOT_SELECTED:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.ConstantTableNotSelected"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case LOCATION_NOT_SELECTED:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.TraceLocationNotSelected"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case CANNOT_DELETE_SELECTED_OBJECT:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.CannotDeleteSelectedObject"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case MODEL_NOT_READY:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.TraceProjectNotOpen"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case NO_TRACE_GROUPS:
+			sb.append(Messages
+					.getString("TraceBuilderErrorMessages.NoTraceGroups")); //$NON-NLS-1$
+			break;
+		case NOT_ENOUGH_PARAMETERS:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.NotEnoughParameters"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case PARAMETER_ADD_NOT_ALLOWED:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.ParameterAddNotAllowed"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case PARAMETER_REMOVE_NOT_ALLOWED:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.ParameterRemoveNotAllowed"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case PARAMETER_TEMPLATE_ALREADY_IN_USE:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.ParameterTemplateInUse"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case CONSTANT_TABLE_PARSE_FAILED:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.ConstantTableParseFailed"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case UNEXPECTED_EXCEPTION:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.UnexpectedException"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case TRACE_NAME_FORMAT_MISSING_FUNCTION:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.NameFormatMissingFunction"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case INVALID_TRACE_TEXT_FORMAT:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.InvalidTraceTextFormat"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case INVALID_TRACE_NAME_FORMAT:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.InvalidTraceNameFormat"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case NO_FUNCTIONS_TO_INSTRUMENT_WITH_TEMPLATE:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.NoFunctionsToInstrumentPrefix"); //$NON-NLS-1$
+			sb.append(s);
+			sb.append(((StringErrorParameters) parameters).string);
+			s = Messages
+					.getString("TraceBuilderErrorMessages.NoFunctionsToInstrumentPostfix"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case NO_FUNCTIONS_TO_INSTRUMENT:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.NoFunctionsToInstrument"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case MULTIPLE_ERRORS_IN_OPERATION:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.MultipleErrorsInOperation"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case NO_TRACES_TO_DELETE:
+			sb.append(Messages
+					.getString("TraceBuilderErrorMessages.NoTracesToDelete")); //$NON-NLS-1$
+			break;
+		case TRACE_DOES_NOT_EXIST:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.TraceDoesNotExist"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case TRACE_NEEDS_CONVERSION:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.TraceNeedsConversionPrefix"); //$NON-NLS-1$
+			sb.append(s);
+			sb.append(TraceBuilderGlobals.getTraceModel().getExtension(
+					TraceProjectAPI.class).getTitle());
+			break;
+		case PARAMETER_COUNT_MISMATCH:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.ParameterCountMismatch"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case PARAMETER_COUNT_DOES_NOT_MATCH_API:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.ParameterCountDoesNotMatchApi"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case TRACE_HAS_NO_LOCATIONS:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.TraceHasNoLocations"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case TRACE_HAS_MULTIPLE_LOCATIONS:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.TraceHasMultipleLocations"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case LOCATION_PARSER_FAILED:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.LocationCouldNotBeParsed"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case NO_TRACES_TO_EXPORT:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.NoTracesToExport"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case CANNOT_OPEN_SOURCE_FILE:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.CannotOpenSourceFile"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case CANNOT_UPDATE_TRACE_INTO_SOURCE:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.CannotUpdateTraceIntoSource"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case PARAMETER_FORMAT_NOT_SUPPORTED:
+			createParameterFormatNotSupportedMessage(parameters, sb);
+			break;
+		case PARAMETER_FORMAT_NEEDS_EXT_MACRO:
+			createParameterFormatNotSupportedInMacroMessage(parameters, sb);
+			break;
+		case PARAMETER_FORMAT_NOT_SUPPORTED_IN_ARRAY:
+			createParameterFormatNotSupportedInArrayMessage(parameters, sb);
+			break;
+		case PARAMETER_FORMAT_UNNECESSARY_EXT_MACRO:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.ParameterFormatUnnecessaryExtMacro"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case PROPERTY_FILE_ELEMENT_NOT_SUPPORTED:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.PropertyFileElementNotSupportedPrefix"); //$NON-NLS-1$ CodForChk_Dis_LengthyLine
+			sb.append(s);
+			sb.append(((StringErrorParameters) parameters).string);
+			s = Messages
+					.getString("TraceBuilderErrorMessages.PropertyFileElementNotSupportedPostfix"); //$NON-NLS-1$ CodForChk_Dis_LengthyLine
+			sb.append(s);
+			break;
+		case PROPERTY_FILE_ELEMENT_MISPLACED:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.PropertyFileElementMisplacedPrefix"); //$NON-NLS-1$
+			sb.append(s);
+			sb.append(((StringErrorParameters) parameters).string);
+			s = Messages
+					.getString("TraceBuilderErrorMessages.PropertyFileElementMisplacedPostfix"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case PROPERTY_FILE_ATTRIBUTE_INVALID:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.PropertyFileAttributeInvalidPrefix"); //$NON-NLS-1$
+			sb.append(s);
+			sb.append(((StringErrorParameters) parameters).string);
+			s = Messages
+					.getString("TraceBuilderErrorMessages.PropertyFileAttributeInvalidPostfix"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case INSERT_TRACE_DOES_NOT_WORK:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.InsertTraceDoesNotWork"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case NO_CONTEXT_FOR_LOCATION:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.NoContextForLocation"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case CANNOT_PARSE_FUNCTION_PARAMETERS:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.CannotParseFunctionParameters"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case INVALID_PARAMETER_NAME_IN_RETURN_VALUE:
+			s = Messages
+					.getString("TraceBuilderErrorMessages.InvalidParameterNameInReturnValue"); //$NON-NLS-1$
+			sb.append(s);
+			break;
+		case RUN_OUT_OF_USER_DEFINED_GROUP_IDS:
+			sb.append(Messages
+					.getString("TraceBuilderErrorMessages.RunOutOfGroupIDs")); //$NON-NLS-1$
+			break;
+		case VAR_ARG_LIST_PARAMETER_FOUND:
+			sb.append(Messages
+					.getString("TraceBuilderErrorMessages.VarArgListParameterFound")); //$NON-NLS-1$
+			break;			
+		case UNKNOWN_OST_VERSION:
+			sb.append(Messages
+					.getString("TraceBuilderErrorMessages.UnkownOstVersion")); //$NON-NLS-1$
+			break;				
+		default:
+			break;
+		}
+		return sb.toString();
+	}
+
+	/**
+	 * Creates invalid parameter type message
+	 * 
+	 * @param parameters
+	 *            the parameters
+	 * @param sb
+	 *            the message buffer
+	 */
+	private static void createInvalidParameterTypeMessage(
+			TraceBuilderErrorParameters parameters, StringBuffer sb) {
+		String s;
+		if (parameters instanceof StringErrorParameters) {
+			s = Messages
+					.getString("TraceBuilderErrorMessages.InvalidParameterTypePrefix"); //$NON-NLS-1$
+			sb.append(s);
+			sb.append(((StringErrorParameters) parameters).string);
+			String format = SourceUtils
+					.mapNormalTypeToFormat(((StringErrorParameters) parameters).string);
+			if (format != null) {
+				sb.append(" "); //$NON-NLS-1$
+				sb.append(format);
+			}
+			s = Messages
+					.getString("TraceBuilderErrorMessages.InvalidParameterTypePostfix"); //$NON-NLS-1$
+			sb.append(s);
+		} else {
+			s = Messages
+					.getString("TraceBuilderErrorMessages.InvalidParameterType"); //$NON-NLS-1$
+			sb.append(s);
+		}
+	}
+
+	/**
+	 * Creates parameter format not supported message
+	 * 
+	 * @param parameters
+	 *            the parameters
+	 * @param sb
+	 *            the message buffer
+	 */
+	private static void createParameterFormatNotSupportedMessage(
+			TraceBuilderErrorParameters parameters, StringBuffer sb) {
+		String s;
+		if (parameters instanceof StringErrorParameters) {
+			s = Messages
+					.getString("TraceBuilderErrorMessages.ParameterFormatNotSupportedPrefix"); //$NON-NLS-1$
+			sb.append(s);
+			sb.append(((StringErrorParameters) parameters).string);
+			s = Messages
+					.getString("TraceBuilderErrorMessages.ParameterFormatNotSupportedPostfix"); //$NON-NLS-1$
+			sb.append(s);
+		} else {
+			s = Messages
+					.getString("TraceBuilderErrorMessages.ParameterFormatNotSupported"); //$NON-NLS-1$
+			sb.append(s);
+		}
+	}
+
+	/**
+	 * Creates parameter not supported in macro message
+	 * 
+	 * @param parameters
+	 *            the parameters
+	 * @param sb
+	 *            the message buffer
+	 */
+	private static void createParameterFormatNotSupportedInMacroMessage(
+			TraceBuilderErrorParameters parameters, StringBuffer sb) {
+		String s;
+		if (parameters instanceof StringErrorParameters) {
+			s = Messages
+					.getString("TraceBuilderErrorMessages.ParameterFormatNotSupportedInMacroPrefix"); //$NON-NLS-1$ CodForChk_Dis_LengthyLine
+			sb.append(s);
+			sb.append(((StringErrorParameters) parameters).string);
+			s = Messages
+					.getString("TraceBuilderErrorMessages.ParameterFormatNotSupportedInMacroPostfix"); //$NON-NLS-1$ CodForChk_Dis_LengthyLine
+			sb.append(s);
+		} else {
+			s = Messages
+					.getString("TraceBuilderErrorMessages.ParameterFormatNotSupportedInMacro"); //$NON-NLS-1$
+			sb.append(s);
+		}
+	}
+
+	/**
+	 * Creates parameter not supported in array message
+	 * 
+	 * @param parameters
+	 *            the parameters
+	 * @param sb
+	 *            the message buffer
+	 */
+	private static void createParameterFormatNotSupportedInArrayMessage(
+			TraceBuilderErrorParameters parameters, StringBuffer sb) {
+		String s;
+		if (parameters instanceof StringErrorParameters) {
+			s = Messages
+					.getString("TraceBuilderErrorMessages.ParameterFormatNotSupportedInArrayPrefix"); //$NON-NLS-1$ CodForChk_Dis_LengthyLine
+			sb.append(s);
+			sb.append(((StringErrorParameters) parameters).string);
+			s = Messages
+					.getString("TraceBuilderErrorMessages.ParameterFormatNotSupportedInArrayPostfix"); //$NON-NLS-1$ CodForChk_Dis_LengthyLine
+			sb.append(s);
+		} else {
+			s = Messages
+					.getString("TraceBuilderErrorMessages.ParameterFormatNotSupportedInArray"); //$NON-NLS-1$
+			sb.append(s);
+		}
+	}
+
+	/**
+	 * Creates invalid trace ID message
+	 * 
+	 * @param parameters
+	 *            the parameters
+	 * @param sb
+	 *            the message buffer
+	 */
+	private static void createInvalidTraceIDMessage(
+			TraceBuilderErrorParameters parameters, StringBuffer sb) {
+		String s;
+		if (parameters instanceof RangeErrorParameters) {
+			s = Messages
+					.getString("TraceBuilderErrorMessages.InvalidTraceIDStart"); //$NON-NLS-1$
+			sb.append(s);
+			s = Messages
+					.getString("TraceBuilderErrorMessages.InvalidTraceIDMiddle"); //$NON-NLS-1$
+			addRangeParameter((RangeErrorParameters) parameters, sb, s);
+			sb.append(Messages
+					.getString("TraceBuilderErrorMessages.InvalidTraceIDEnd")); //$NON-NLS-1$
+		} else {
+			sb.append(Messages
+					.getString("TraceBuilderErrorMessages.InvalidTraceID")); //$NON-NLS-1$
+		}
+	}
+
+	/**
+	 * Creates invalid group ID message
+	 * 
+	 * @param parameters
+	 *            the parameters
+	 * @param sb
+	 *            the message buffer
+	 */
+	private static void createInvalidGroupIDMessage(
+			TraceBuilderErrorParameters parameters, StringBuffer sb) {
+		String s;
+		if (parameters instanceof RangeErrorParameters) {
+			s = Messages
+					.getString("TraceBuilderErrorMessages.InvalidGroupIDStart"); //$NON-NLS-1$
+			sb.append(s);
+			s = Messages
+					.getString("TraceBuilderErrorMessages.InvalidGroupIDMiddle"); //$NON-NLS-1$
+			addRangeParameter((RangeErrorParameters) parameters, sb, s);
+			sb.append(Messages
+					.getString("TraceBuilderErrorMessages.InvalidGroupIDEnd")); //$NON-NLS-1$
+		} else {
+			sb.append(Messages
+					.getString("TraceBuilderErrorMessages.InvalidGroupID")); //$NON-NLS-1$
+		}
+	}
+
+	/**
+	 * Adds a range parameter to error buffer
+	 * 
+	 * @param parameters
+	 *            the range
+	 * @param sb
+	 *            the buffer
+	 * @param middleText
+	 *            the text between the range
+	 */
+	private static void addRangeParameter(RangeErrorParameters parameters,
+			StringBuffer sb, String middleText) {
+		if (parameters.isHex) {
+			sb.append(SourceConstants.HEX_PREFIX);
+			sb.append(Integer.toHexString(parameters.start));
+		} else {
+			sb.append(parameters.start);
+		}
+		sb.append(middleText);
+		if (parameters.isHex) {
+			sb.append(SourceConstants.HEX_PREFIX);
+			sb.append(Integer.toHexString(parameters.end));
+		} else {
+			sb.append(parameters.end);
+		}
+	}
+
+	/**
+	 * Creates "Invalid directory" message
+	 * 
+	 * @param parameters
+	 *            the message parameters
+	 * @param sb
+	 *            the string buffer where the message is stored
+	 */
+	private static void createInvalidPathMessage(
+			FileErrorParameters parameters, StringBuffer sb) {
+		String s;
+		if (parameters != null) {
+			s = Messages
+					.getString("TraceBuilderErrorMessages.InvalidDirectoryPrefix"); //$NON-NLS-1$
+			sb.append(s);
+			sb.append(convertPath(parameters.file));
+			s = Messages
+					.getString("TraceBuilderErrorMessages.InvalidDirectoryPostfix"); //$NON-NLS-1$
+			sb.append(s);
+		} else {
+			sb.append(Messages
+					.getString("TraceBuilderErrorMessages.InvalidDirectory")); //$NON-NLS-1$
+		}
+	}
+
+	/**
+	 * Creates "File not found" message
+	 * 
+	 * @param parameters
+	 *            the message parameters
+	 * @param sb
+	 *            the string buffer where the message is stored
+	 */
+	private static void createFileNotFoundMessage(
+			FileErrorParameters parameters, StringBuffer sb) {
+		String s;
+		if (parameters != null) {
+			s = Messages
+					.getString("TraceBuilderErrorMessages.FileDoesNotExistPrefix"); //$NON-NLS-1$
+			sb.append(s);
+			sb.append(convertPath(parameters.file));
+			s = Messages
+					.getString("TraceBuilderErrorMessages.FileDoesNotExistPostfix"); //$NON-NLS-1$
+			sb.append(s);
+		} else {
+			sb.append(Messages
+					.getString("TraceBuilderErrorMessages.FileDoesNotExist")); //$NON-NLS-1$
+		}
+	}
+
+	/**
+	 * Adds some spaces to path string to allow folding
+	 * 
+	 * @param path
+	 *            the path
+	 * @return the converted path
+	 */
+	public static String convertPath(String path) {
+		StringBuffer sb = new StringBuffer();
+		int strIndex = -1;
+		do {
+			strIndex++;
+			int lastIndex = strIndex;
+			strIndex = path.indexOf(File.separatorChar, strIndex);
+			if (strIndex != -1) {
+				String sub = path.substring(lastIndex, strIndex);
+				if (sub.length() > 0) {
+					sb.append(sub);
+					sb.append(' ');
+					sb.append(File.separatorChar);
+					sb.append(' ');
+				}
+			} else {
+				// If the data ends with file separator, lastIndex points to
+				// end-of-data. If not, the rest of the data is appended without
+				// further white spaces
+				if (lastIndex < path.length()) {
+					String sub = path.substring(lastIndex);
+					sb.append(sub);
+				}
+			}
+		} while (strIndex != -1);
+		return sb.toString();
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceBuilderEvents.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,110 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 interface
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+import com.nokia.tracebuilder.model.TraceBuilderException;
+
+/**
+ * Event listener interface
+ * 
+ */
+public interface TraceBuilderEvents {
+
+	/**
+	 * Event category for verbose info events
+	 */
+	String VERBOSE_INFO = "Verbose"; //$NON-NLS-1$
+
+	/**
+	 * Posts an error event to TraceBuilder
+	 * 
+	 * @param exception
+	 *            the error data
+	 */
+	public void postError(TraceBuilderException exception);
+
+	/**
+	 * Posts an error event to TraceBuilder
+	 * 
+	 * @param message
+	 *            the error message
+	 * @param source
+	 *            the error source
+	 * @param postEvent
+	 *            defines is error event also posted to trace event view
+	 */
+	public void postErrorMessage(String message, Object source, boolean postEvent);
+
+	/**
+	 * Posts a warning event to TraceBuilder
+	 * 
+	 * @param message
+	 *            the warning message
+	 * @param source
+	 *            the warning source
+	 */
+	public void postWarningMessage(String message, Object source);
+
+	/**
+	 * Posts an info event to TraceBuilder
+	 * 
+	 * @param message
+	 *            the info message
+	 * @param source
+	 *            the info source
+	 */
+	public void postInfoMessage(String message, Object source);
+
+	/**
+	 * Posts a critical assertion failed event
+	 * 
+	 * @param message
+	 *            the message
+	 * @param source
+	 *            the source of the assertion
+	 */
+	public void postCriticalAssertionFailed(String message, Object source);
+
+	/**
+	 * Posts an assertion failed event
+	 * 
+	 * @param message
+	 *            the message
+	 * @param source
+	 *            the source of the assertion
+	 */
+	public void postAssertionFailed(String message, Object source);
+
+	/**
+	 * Sets the category for all events posted to event manager
+	 * 
+	 * @param category
+	 *            the new category
+	 * @return the old category
+	 */
+	public String setEventCategory(String category);
+
+	/**
+	 * Gets the current event category
+	 * 
+	 * @return the current category
+	 */
+	public String getEventCategory();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceBuilderGlobals.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,377 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 Builder engine
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+import java.util.Iterator;
+import com.nokia.tracebuilder.engine.source.SourceEngine;
+import com.nokia.tracebuilder.model.TraceModel;
+import com.nokia.tracebuilder.plugin.TraceBuilderPlugin;
+import com.nokia.tracebuilder.project.GroupNameHandlerBase;
+
+/**
+ * Access point to the exported interfaces of Trace Builder engine
+ * 
+ */
+public class TraceBuilderGlobals {
+
+	/**
+	 * Max trace ID
+	 */
+	public static final int MAX_TRACE_ID = 65535; // CodForChk_Dis_Magic
+
+	/**
+	 * Trace builder instance
+	 */
+	private static TraceBuilder instance;
+
+	/**
+	 * Constructor is hidden
+	 */
+	private TraceBuilderGlobals() {
+	}
+
+	/**
+	 * Starts Trace Builder engine.
+	 */
+	public static void start() {
+		if (instance == null) {
+			instance = new TraceBuilder();
+			instance.start();
+		}
+	}
+
+	/**
+	 * Shuts down the TraceBuilder instance
+	 */
+	public static void shutdown() {
+		if (instance != null) {
+			instance.shutdown();
+			instance = null;
+		}
+	}
+
+	/**
+	 * Gets the configuration interface. The configuration interface is not
+	 * available until view has been registered.
+	 * 
+	 * @return the configuration
+	 */
+	public static TraceBuilderConfiguration getConfiguration() {
+		return instance.getConfiguration();
+	}
+
+	/**
+	 * Gets the trace model
+	 * 
+	 * @return the model
+	 */
+	public static TraceModel getTraceModel() {
+		return instance.getModel();
+	}
+
+	/**
+	 * Gets the source engine
+	 * 
+	 * @return the source engine
+	 */
+	public static SourceEngine getSourceEngine() {
+		return instance.getSourceEngine();
+	}
+
+	/**
+	 * Gets the trace builder interface
+	 * 
+	 * @return trace builder
+	 */
+	public static TraceBuilderInterface getTraceBuilder() {
+		return instance.getTraceBuilder();
+	}
+
+	/**
+	 * Gets the dialogs interface
+	 * 
+	 * @return the dialogs interface
+	 */
+	public static TraceBuilderDialogs getDialogs() {
+		return instance.getDialogs();
+	}
+
+	/**
+	 * Gets the events interface
+	 * 
+	 * @return the events interface
+	 */
+	public static TraceBuilderEvents getEvents() {
+		return instance.getEvents();
+	}
+
+	/**
+	 * Called by a plug-in to register itself
+	 * 
+	 * @param plugin
+	 *            the plugin to be registered
+	 */
+	public static void registerPlugin(TraceBuilderPlugin plugin) {
+		instance.registerPlugin(plugin);
+	}
+
+	/**
+	 * Called by a plug-in to unregister itself
+	 * 
+	 * @param plugin
+	 *            the plugin to be unregistered
+	 */
+	public static void unregisterPlugin(TraceBuilderPlugin plugin) {
+		if (instance != null) {
+			instance.unregisterPlugin(plugin);
+		}
+	}
+
+	/**
+	 * Called by the view plug-in to register the view
+	 * 
+	 * @param view
+	 *            the view
+	 */
+	public static void setView(TraceBuilderView view) {
+		instance.setView(view);
+	}
+
+	/**
+	 * Is view registered
+	 * 
+	 * @return true if view is registered false if view is not registered
+	 */
+	public static boolean isViewRegistered() {
+		return instance.isViewRegistered();
+	}
+
+	/**
+	 * Runs an asynchronous operation. Asynchronous operations are not available
+	 * until view has been registered
+	 * 
+	 * @param runner
+	 *            the operation to run
+	 */
+	public static void runAsyncOperation(Runnable runner) {
+		instance.runAsyncOperation(runner);
+	}
+
+	/**
+	 * Gets the source context manager
+	 * 
+	 * @return the context manager
+	 */
+	public static SourceContextManager getSourceContextManager() {
+		return instance.getSourceContextManager();
+	}
+
+	/**
+	 * Returns the actions interface. The actions interface is not available
+	 * until view has been registered
+	 * 
+	 * @return the factory
+	 */
+	public static TraceBuilderActions getActions() {
+		return instance.getActions();
+	}
+
+	/**
+	 * Returns the view
+	 * 
+	 * @return the view
+	 */
+	public static TraceBuilderView getView() {
+		return instance.getView();
+	}
+
+	/**
+	 * Set current software component index
+	 * 
+	 * @param currentSoftwareComponentIndex
+	 *            Current component index
+	 */
+	public static void setCurrentSoftwareComponentIndex(
+			int currentSoftwareComponentIndex) {
+		instance
+				.setCurrentSoftwareComponentIndex(currentSoftwareComponentIndex);
+	}
+
+	/**
+	 * Get current software component Id
+	 * 
+	 * @return the software component Id as string
+	 */
+	public static String getCurrentSoftwareComponentId() {
+		String softwareComponentId = instance.getCurrentSoftwareComponentId();
+		return softwareComponentId;
+	}
+
+	/**
+	 * Get current software component name
+	 * 
+	 * @return the current software component name as string
+	 */
+	public static String getCurrentSoftwareComponentName() {
+		String softwareComponentName = instance
+				.getCurrentSoftwareComponentName();
+		return softwareComponentName;
+	}
+
+	/**
+	 * Add software component
+	 * 
+	 * @param softwareComponentId
+	 *            software component Id
+	 * @param softwareComponentName
+	 *            software component name
+	 * @param mmpPath
+	 *            software component's mmp path
+	 */
+	public static void addSoftwareComponent(String softwareComponentId,
+			String softwareComponentName, String mmpPath) {
+		instance.addSoftwareComponent(softwareComponentId,
+				softwareComponentName, mmpPath);
+	}
+
+	/**
+	 * Clear software components
+	 */
+	public static void clearSoftwareComponents() {
+		instance.clearSoftwareComponents();
+	}
+
+	/**
+	 * Gets the software components
+	 * 
+	 * @return the software components iterator
+	 */
+	public static Iterator<SoftwareComponent> getSoftwareComponents() {
+		Iterator<SoftwareComponent> softwareComponentIterator = instance
+				.getSoftwareComponents();
+		return softwareComponentIterator;
+	}
+
+	/**
+	 * Get current software component's MMP path
+	 * 
+	 * @return the current software component's MMP path
+	 */
+	public static String getCurrentSoftwareComponentMMPPath() {
+		String mmpPath = instance.getCurrentSoftwareComponentMMPPath();
+		return mmpPath;
+	}
+
+	/**
+	 * Get current software component index
+	 * 
+	 * @return current software component index
+	 */
+	public static int getCurrentSoftwareComponentIndex() {
+		int index = instance.getCurrentSoftwareComponentIndex();
+		return index;
+	}
+
+	/**
+	 * Get previous software component name
+	 * 
+	 * @return previous software component name
+	 */
+	public static String getPreviousSoftwareComponentName() {
+		String componentName = instance.getPreviousSoftwareComponentName();
+		return componentName;
+	}
+
+	/**
+	 * Get project path
+	 * 
+	 * @return project path
+	 */
+	public static String getProjectPath() {
+		String projetcPath = instance.getProjectPath();
+		return projetcPath;
+	}
+
+	/**
+	 * Set project path
+	 * 
+	 * @param path
+	 *            the path
+	 */
+	public static void setProjectPath(String path) {
+		instance.setProjectPath(path);
+	}
+
+	/**
+	 * Gets the name for the trace header file based on given source
+	 * 
+	 * @param sourceFile
+	 *            the source file name
+	 * @return the header file name
+	 */
+	public static String getHeaderFileName(String sourceFile) {
+		String retval = instance.getHeaderFileName(sourceFile);
+		return retval;
+	}
+
+	/**
+	 * Set project monitor
+	 * 
+	 * @param projectMonitor
+	 *            the project monitor
+	 */
+	public static void setProjectMonitor(TraceProjectMonitorInterface projectMonitor) {
+		instance.setProjectMonitor(projectMonitor);
+	}
+
+	/**
+	 * Get location converter
+	 * 
+	 * @return the location converter
+	 */
+	public static TraceLocationConverter getLocationConverter() {
+		return instance.getLocationConverter();
+	}
+
+	/**
+	 * Get location map
+	 * 
+	 * @return the location map
+	 */
+	public static TraceLocationMap getLocationMap() {
+		return instance.getLocationMap();
+	}
+	
+	/**
+	 * Get group name handler
+	 * 
+	 * @return the group name handler
+	 */
+	public static GroupNameHandlerBase getGroupNameHandler() {
+		return instance.getGroupNameHandler();
+	}
+	
+	/**
+	 * Set group name handler
+	 * 
+	 */
+	public static void setGroupNameHandler(GroupNameHandlerBase groupNameHandler) {
+		instance.setGroupNameHandler(groupNameHandler);
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceBuilderHelp.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,108 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Help context constants
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+/**
+ * Help context constants
+ * 
+ */
+public interface TraceBuilderHelp {
+
+	/**
+	 * Help context ID base
+	 */
+	public String HELP_CONTEXT_BASE = "com.nokia.tracebuilder.help."; //$NON-NLS-1$
+
+	/**
+	 * Help context for tree viewer
+	 */
+	public String TREE_VIEWER_HELP_CONTEXT = "TREE_VIEWER"; //$NON-NLS-1$
+
+	/**
+	 * Help context for add trace action
+	 */
+	public String ADD_TRACE_HELP_CONTEXT = "ADD_TRACE"; //$NON-NLS-1$
+
+	/**
+	 * Help context for add parameter action
+	 */
+	public String ADD_PARAMETER_HELP_CONTEXT = "ADD_PARAMETER"; //$NON-NLS-1$
+
+	/**
+	 * Help context for add enum action
+	 */
+	public String ADD_ENUM_HELP_CONTEXT = "ADD_ENUM"; //$NON-NLS-1$
+
+	/**
+	 * Help context for edit properties action. Note that there are more
+	 * specific contexts for edit group, edit trace etc.
+	 */
+	public String EDIT_PROPERTIES_HELP_CONTEXT = "EDIT_PROPERTIES"; //$NON-NLS-1$
+
+	/**
+	 * Help context for delete action
+	 */
+	public String DELETE_OBJECT_HELP_CONTEXT = "DELETE_OBJECT"; //$NON-NLS-1$
+
+	/**
+	 * Help context for delete traces action
+	 */
+	public String DELETE_TRACES_HELP_CONTEXT = "DELETE_TRACES"; //$NON-NLS-1$
+
+	/**
+	 * Help context for insert trace action
+	 */
+	public String INSERT_TRACE_HELP_CONTEXT = "INSERT_TRACE"; //$NON-NLS-1$
+
+	/**
+	 * Help context for remove trace from source action
+	 */
+	public String REMOVE_TRACE_HELP_CONTEXT = "REMOVE_TRACE"; //$NON-NLS-1$
+
+	/**
+	 * Help context for remove unrelated traces action
+	 */
+	public String REMOVE_UNRELATED_HELP_CONTEXT = "REMOVE_UNRELATED"; //$NON-NLS-1$
+
+	/**
+	 * Help context for convert trace action
+	 */
+	public String CONVERT_TRACE_HELP_CONTEXT = "CONVERT_TRACE"; //$NON-NLS-1$
+
+	/**
+	 * Help context for instrumenter
+	 */
+	public String INSTRUMENTER_HELP_CONTEXT = "INSTRUMENTER"; //$NON-NLS-1$
+
+	/**
+	 * Help context for parse enum action
+	 */
+	public String PARSE_ENUM_HELP_CONTEXT = "PARSE_ENUM"; //$NON-NLS-1$
+
+	/**
+	 * Help context for general preferences
+	 */
+	public String GENERAL_PREFERENCES_CONTEXT = "GENERAL_PREFERENCES"; //$NON-NLS-1$
+
+	/**
+	 * Help context for select component dialog
+	 */
+	public String SELECT_COMPONENT_HELP_CONTEXT = "SELECT_COMPONENT"; //$NON-NLS-1$
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceBuilderInterface.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,209 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 Builder interface
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+import java.util.Iterator;
+
+import com.nokia.tracebuilder.engine.source.SourceProperties;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceObject;
+
+/**
+ * Trace Builder interface
+ * 
+ */
+public interface TraceBuilderInterface {
+
+	/**
+	 * Set the trace object as an active object. Can be called with null
+	 * parameter to deselect the active object. Other functions of this
+	 * interface will work with the selected trace object until this method or
+	 * extensionSelected is called again.
+	 * 
+	 * @param object
+	 *            the object selected from trace view
+	 * @param syncView
+	 *            if true, delegates the object to TraceBuilderView.selectObject
+	 * @param sourceOpened
+	 *            if true, trace from model is used, otherwise trace from selected object           
+	 */
+	public void traceObjectSelected(TraceObject object, boolean syncView, boolean sourceOpened);
+
+	/**
+	 * Selects an TraceLocation or TraceLocationList as the active object. The
+	 * functions that expect the selected object to be a TraceObject will not
+	 * work until traceObjectSelected is called again.
+	 * 
+	 * @param list
+	 *            the selected location list
+	 * @param location
+	 *            the selected location from the list or null if only the list
+	 *            was selected
+	 * @param syncView
+	 *            if true, delegates the location to
+	 *            TraceBuilderView.selectLocation
+	 */
+	public void locationSelected(TraceLocationList list,
+			TraceLocation location, boolean syncView);
+
+	/**
+	 * Creates a new trace.
+	 * 
+	 * @throws TraceBuilderException
+	 *             if a trace cannot be created
+	 */
+	public void addTrace() throws TraceBuilderException;
+
+	/**
+	 * Creates a new trace based on unrelated location found from source.
+	 * 
+	 * @throws TraceBuilderException
+	 *             if a trace cannot be created
+	 */
+	public void convertTrace() throws TraceBuilderException;
+
+	/**
+	 * Creates a new trace parameter and adds it to the currently active trace
+	 * object.
+	 * 
+	 * @throws TraceBuilderException
+	 *             if adding fails
+	 */
+	public void addParameter() throws TraceBuilderException;
+
+	/**
+	 * Creates a new constant value and adds it to the currently active constant
+	 * table
+	 * 
+	 * @throws TraceBuilderException
+	 *             if adding fails
+	 */
+	public void addConstant() throws TraceBuilderException;
+
+	/**
+	 * Select component to be used in case that one cpp file is included to more
+	 * than one mmp file
+	 * 
+	 * @throws TraceBuilderException
+	 *             if adding fails
+	 */
+	public void selectComponent()
+			throws TraceBuilderException;
+
+	/**
+	 * Deletes the currently active trace object from the model.
+	 * 
+	 * @throws TraceBuilderException
+	 *             if deleting fails
+	 */
+	public void delete() throws TraceBuilderException;
+
+	/**
+	 * Removes the currently active trace object or location from the source
+	 * files
+	 * 
+	 * @throws TraceBuilderException
+	 *             if removing fails
+	 */
+	public void removeFromSource() throws TraceBuilderException;
+
+	/**
+	 * Removes all unrelated trace locations from the source files
+	 * 
+	 * @throws TraceBuilderException
+	 *             if removing fails
+	 */
+	public void removeUnrelatedFromSource() throws TraceBuilderException;
+
+	/**
+	 * Shows the properties of the active trace object.
+	 * 
+	 * @throws TraceBuilderException
+	 *             if properties of active object cannot be shown
+	 */
+	public void showProperties() throws TraceBuilderException;
+
+	/**
+	 * Changes the focus between the view and source editor
+	 */
+	public void switchFocus();
+
+	/**
+	 * Opens the trace project related to given source file
+	 * 
+	 * @param modelName
+	 *            the name for the model
+	 * @throws TraceBuilderException
+	 *             if startup fails
+	 */
+	public void openProject(String modelName)
+			throws TraceBuilderException;
+
+	/**
+	 * Exports the trace project
+	 * 
+	 * @throws TraceBuilderException
+	 *             if export fails
+	 */
+	public void exportProject() throws TraceBuilderException;
+
+	/**
+	 * Closes the trace project
+	 */
+	public void closeProject();
+
+	/**
+	 * Starts the code instrumenter
+	 * 
+	 * @throws TraceBuilderException
+	 *             if startup fails
+	 */
+	public void startInstrumenter() throws TraceBuilderException;
+
+	/**
+	 * Shows a dialog, which can be used to select and delete traces
+	 * 
+	 * @throws TraceBuilderException
+	 *             if deleting fails
+	 */
+	public void deleteMultipleTraces() throws TraceBuilderException;
+
+	/**
+	 * Creates a constant table from the source selection
+	 * 
+	 * @throws TraceBuilderException
+	 *             if processing fails
+	 */
+	public void createConstantTableFromSelection() throws TraceBuilderException;
+	
+	/**
+	 * Gets the open sources
+	 * 
+	 * @return the open sources
+	 */
+	public Iterator<SourceProperties> getOpenSources();
+	
+	/**
+	 * Gets the current selection
+	 * 
+	 * @return the selection
+	 */
+	public TraceObject getSelectedObject();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceBuilderView.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,105 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 Builder
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+import com.nokia.tracebuilder.model.TraceObject;
+
+/**
+ * Interface implemented by the view of Trace Builder. The view is implemented
+ * as a separate plug-in, which is registered via
+ * {@link TraceBuilderGlobals#setView(TraceBuilderView)}
+ * 
+ * @see com.nokia.tracebuilder.engine.TraceBuilderGlobals#setView(TraceBuilderView)
+ */
+public interface TraceBuilderView {
+
+	/**
+	 * Selects a trace object from the view
+	 * 
+	 * @param object
+	 *            the object to be selected
+	 */
+	public void selectObject(TraceObject object);
+
+	/**
+	 * Selects a location from the view.
+	 * 
+	 * @param location
+	 *            the location to be selected
+	 */
+	public void selectLocation(TraceLocation location);
+
+	/**
+	 * Sets the focus to the view
+	 */
+	public void setFocus();
+
+	/**
+	 * Checks if the view has the focus
+	 * 
+	 * @return true if view has focus
+	 */
+	public boolean hasFocus();
+
+	/**
+	 * Gets a dialog for editing trace object properties
+	 * 
+	 * @return the dialog
+	 */
+	public TraceObjectPropertyDialog getPropertyDialog();
+
+	/**
+	 * Gets the dialogs interface
+	 * 
+	 * @return the dialogs
+	 */
+	public TraceBuilderDialogs getDialogs();
+
+	/**
+	 * Gets the actions interface
+	 * 
+	 * @return the actions interface
+	 */
+	public TraceBuilderActions getActions();
+
+	/**
+	 * Gets the configuration interface
+	 * 
+	 * @return the configuration interface
+	 */
+	public TraceBuilderConfiguration getConfiguration();
+
+	/**
+	 * Runs an asynchronous operation
+	 * 
+	 * @param runnable
+	 *            the operation to be run
+	 */
+	public void runAsyncOperation(Runnable runnable);
+
+	/**
+	 * Refresh the view
+	 */
+	public void refresh();
+	
+	/**
+	 * Expand Trace Groups branch
+	 */
+	public void expandTraceGroupsBranch();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceGroupPropertyDialogTemplate.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 a template for the property dialog
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+/**
+ * Interface to a template for the TraceGroup property dialog.
+ * 
+ */
+public interface TraceGroupPropertyDialogTemplate extends
+		TraceObjectPropertyDialogTemplate {
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceLocation.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,523 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Represents a location of a trace within a source document
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.TraceBuilderErrorCode;
+import com.nokia.tracebuilder.engine.source.SourceParserResult;
+import com.nokia.tracebuilder.engine.source.SourceParserRule;
+import com.nokia.tracebuilder.engine.source.SourceProperties;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceBuilderErrorParameters;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceObject;
+import com.nokia.tracebuilder.source.SourceLocation;
+import com.nokia.tracebuilder.source.SourceLocationListener;
+
+/**
+ * Represents a location of a trace within a source document. The locations of a
+ * document are updated by TraceLocationUpdater when document is changed
+ * 
+ */
+public class TraceLocation extends SourceLocation implements LocationProperties {
+
+	/**
+	 * Source which owns this location
+	 */
+	private SourceProperties source;
+
+	/**
+	 * Name of the trace as parsed from source
+	 */
+	private String originalName;
+
+	/**
+	 * Name after conversion to valid trace name
+	 */
+	private String convertedName;
+
+	/**
+	 * Text of the trace as parsed from source
+	 */
+	private String traceText;
+
+	/**
+	 * The tag of the parser that found this trace location
+	 */
+	private String tag;
+
+	/**
+	 * Content changed flag
+	 */
+	private boolean contentChanged;
+
+	/**
+	 * Name changed flag
+	 */
+	private boolean nameChanged;
+
+	/**
+	 * The location list
+	 */
+	private TraceLocationList list;
+
+	/**
+	 * The parameters
+	 */
+	private List<String> parameters;
+
+	/**
+	 * Parser-specific data associated with this location
+	 */
+	private List<String> parserData;
+
+	/**
+	 * Rule which defines how the parameters found from source are interpreted
+	 */
+	private SourceParserRule parserRule;
+
+	/**
+	 * Optional properties for this location.
+	 */
+	private TraceLocationProperties properties = new TraceLocationProperties();
+
+	/**
+	 * Flag, which determines if this location has changed after last convert
+	 * operation
+	 */
+	private boolean changedAfterConvert = true;
+
+	/**
+	 * Last notified validity code
+	 */
+	private TraceBuilderErrorCode notifiedValidity = TraceBuilderErrorCode.OK;
+
+	/**
+	 * Last notified validity parameters
+	 */
+	private TraceBuilderErrorParameters notifiedValidityParameters;
+
+	/**
+	 * Parser error code
+	 */
+	private TraceBuilderErrorCode parserErrorCode = TraceBuilderErrorCode.OK;
+
+	/**
+	 * Parser error parameters
+	 */
+	private TraceBuilderErrorParameters parserErrorParameters;
+
+	/**
+	 * Converter error code
+	 */
+	private TraceBuilderErrorCode converterErrorCode = TraceBuilderErrorCode.OK;
+
+	/**
+	 * Converter error parameters
+	 */
+	private TraceBuilderErrorParameters converterErrorParameters;
+
+	/**
+	 * Creates a new location
+	 * 
+	 * @param source
+	 *            the source where the location is associated
+	 * @param offset
+	 *            the offset to the trace within the source document
+	 * @param length
+	 *            the length of the trace
+	 */
+	public TraceLocation(SourceProperties source, int offset, int length) {
+		super(source.getSourceEditor(), offset, length);
+		this.source = source;
+	}
+
+	/**
+	 * Sets the content changed flag. If <i>changed</i> is false this also sets
+	 * the name changed flag to false
+	 * 
+	 * @param changed
+	 *            the new changed flag
+	 */
+	public void setContentChanged(boolean changed) {
+		this.contentChanged = changed;
+		if (!changed) {
+			nameChanged = false;
+		}
+	}
+
+	/**
+	 * Checks if the content has changed.
+	 * 
+	 * @return the content changed flag
+	 */
+	public boolean isContentChanged() {
+		return contentChanged;
+	}
+
+	/**
+	 * Checks if the name has changed.
+	 * 
+	 * @return the name changed flag
+	 */
+	public boolean isNameChanged() {
+		return contentChanged && nameChanged;
+	}
+
+	/**
+	 * Gets the trace this location is associated to or null if unrelated
+	 * 
+	 * @return the trace
+	 */
+	public Trace getTrace() {
+		Trace retval = null;
+		if (list != null) {
+			TraceObject object = list.getOwner();
+			if (object instanceof Trace) {
+				retval = (Trace) object;
+			}
+		}
+		return retval;
+	}
+
+	/**
+	 * Gets the name of the trace as parsed from source
+	 * 
+	 * @return the name of the trace
+	 */
+	public String getOriginalName() {
+		return originalName;
+	}
+
+	/**
+	 * Gets the name of the trace after conversion to valid name
+	 * 
+	 * @return the name of the trace
+	 */
+	public String getConvertedName() {
+		return convertedName;
+	}
+
+	/**
+	 * Gets the text of the trace
+	 * 
+	 * @return the text of the trace
+	 */
+	public String getTraceText() {
+		return traceText;
+	}
+
+	/**
+	 * Returns the source properties this location belongs to
+	 * 
+	 * @return source properties
+	 */
+	public SourceProperties getSource() {
+		return source;
+	}
+
+	/**
+	 * Sets the location list which owns this location
+	 * 
+	 * @param list
+	 *            the location list
+	 */
+	public void setLocationList(TraceLocationList list) {
+		this.list = list;
+	}
+
+	/**
+	 * Gets the location list this location belongs to
+	 * 
+	 * @return the list
+	 */
+	public TraceLocationList getLocationList() {
+		return list;
+	}
+
+	/**
+	 * Sets the parser rule that will be used to parse the data of this
+	 * location. Must be called before setData
+	 * 
+	 * @param rule
+	 *            the rule used to parse the data
+	 */
+	public void setParserRule(SourceParserRule rule) {
+		parserRule = rule;
+	}
+
+	/**
+	 * Gets the parser rule that found this location
+	 * 
+	 * @return the parser rule
+	 */
+	public SourceParserRule getParserRule() {
+		return parserRule;
+	}
+
+	/**
+	 * Gets the optional properties of this location
+	 * 
+	 * @return the properties
+	 */
+	public TraceLocationProperties getProperties() {
+		return properties;
+	}
+
+	/**
+	 * Sets the trace tag that was found from source
+	 * 
+	 * @param tag
+	 *            the trace tag
+	 */
+	public void setTag(String tag) {
+		this.tag = tag;
+	}
+
+	/**
+	 * Gets the trace tag
+	 * 
+	 * @return the tag
+	 */
+	public String getTag() {
+		return tag;
+	}
+
+	/**
+	 * Sets the trace data
+	 * 
+	 * @param list
+	 *            the list of parameters
+	 */
+	public void setData(ArrayList<String> list) {
+		try {
+			SourceParserResult result = parserRule.parseParameters(tag, list);
+			setData(result.originalName, result.convertedName,
+					result.traceText, result.parameters, result.parserData);
+			parserRule.getLocationParser().processNewLocation(this);
+			parserErrorCode = TraceBuilderErrorCode.OK;
+			parserErrorParameters = null;
+			converterErrorCode = TraceBuilderErrorCode.OK;
+			converterErrorParameters = null;
+		} catch (TraceBuilderException e) {
+			parserErrorCode = (TraceBuilderErrorCode) e.getErrorCode();
+			parserErrorParameters = e.getErrorParameters();
+		}
+	}
+
+	/**
+	 * Sets the trace name and parameter list
+	 * 
+	 * @param originalName
+	 *            the name parsed from source
+	 * @param convertedName
+	 *            the name after conversion
+	 * @param traceText
+	 *            the text parsed from source
+	 * @param parameters
+	 *            the list of parameters parsed from source
+	 * @param parserData
+	 *            list of parser-specific data
+	 */
+	private void setData(String originalName, String convertedName,
+			String traceText, List<String> parameters, List<String> parserData) {
+		if (!convertedName.equals(this.convertedName)) {
+			this.convertedName = convertedName;
+			nameChanged = true;
+		}
+		this.originalName = originalName;
+		this.traceText = traceText;
+		this.parameters = parameters;
+		this.parserData = parserData;
+	}
+
+	/**
+	 * Removes the parameter at given index
+	 * 
+	 * @param index
+	 *            the index
+	 */
+	public void removeParameterAt(int index) {
+		// NOTE: Does not cause validity callbacks
+		// This is currently only used temporarily when removing a parameter
+		// from trace. This is needed to correctly update the source code
+		if (parameters != null && index >= 0 && index < parameters.size()) {
+			parameters.remove(index);
+		}
+	}
+
+	/**
+	 * Gets the number of parameters found from the source code
+	 * 
+	 * @return the number of parameters
+	 */
+	public int getParameterCount() {
+		return parameters != null ? parameters.size() : 0;
+	}
+
+	/**
+	 * Gets the parameter at given index
+	 * 
+	 * @param index
+	 *            the parameter index
+	 * @return the parameter at the index
+	 */
+	public String getParameter(int index) {
+		return parameters.get(index);
+	}
+
+	/**
+	 * Gets the parameters
+	 * 
+	 * @return iterator over the parameters
+	 */
+	public Iterator<String> getParameters() {
+		List<String> list = null;
+		if (parameters != null) {
+			list = parameters;
+		} else {
+			list = Collections.emptyList();
+		}
+		return list.iterator();
+	}
+
+	/**
+	 * Gets the parser-specific data
+	 * 
+	 * @return the parser data
+	 */
+	public List<String> getParserData() {
+		return parserData;
+	}
+
+	/**
+	 * Gets the current location validity code.
+	 * 
+	 * @return the validity code
+	 */
+	public TraceBuilderErrorCode getValidityCode() {
+		return notifiedValidity;
+	}
+
+	/**
+	 * Gets the parameters associated with the current location validity code.
+	 * 
+	 * @return the validity code
+	 */
+	public TraceBuilderErrorParameters getValidityParameters() {
+		return notifiedValidityParameters;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceLocation#notifyLocationChanged()
+	 */
+	@Override
+	protected void notifyLocationChanged() {
+		super.notifyLocationChanged();
+		if (isContentChanged()) {
+			changedAfterConvert = true;
+			Iterator<SourceLocationListener> itr = getListeners();
+			while (itr.hasNext()) {
+				SourceLocationListener listener = itr.next();
+				if (listener instanceof TraceLocationListener) {
+					((TraceLocationListener) listener)
+							.locationContentChanged(this);
+				}
+			}
+			runValidityCheck();
+		}
+	}
+
+	/**
+	 * Creates a notification if validity has changed. This is initially called
+	 * from the location list when a location is added to it and after that from
+	 * notifyLocationChanged.
+	 */
+	void runValidityCheck() {
+		TraceBuilderErrorCode code;
+		TraceBuilderErrorParameters parameters;
+		if (parserErrorCode != TraceBuilderErrorCode.OK) {
+			code = parserErrorCode;
+			parameters = parserErrorParameters;
+		} else if (converterErrorCode != TraceBuilderErrorCode.OK) {
+			code = converterErrorCode;
+			parameters = converterErrorParameters;
+		} else {
+			code = TraceBuilderErrorCode.TRACE_DOES_NOT_EXIST;
+			parameters = null;
+			if (parserRule != null) {
+				code = parserRule.getLocationParser().checkLocationValidity(
+						this);
+			}
+		}
+		if (code != notifiedValidity) {
+			notifiedValidity = code;
+			notifiedValidityParameters = parameters;
+			Iterator<SourceLocationListener> itr = getListeners();
+			while (itr.hasNext()) {
+				SourceLocationListener listener = itr.next();
+				if (listener instanceof TraceLocationListener) {
+					((TraceLocationListener) listener)
+							.locationValidityChanged(this);
+				}
+			}
+		}
+	}
+
+	/**
+	 * Sets the converter error code and runs the validity check to notify
+	 * listeners about change in error code
+	 * 
+	 * @param errorCode
+	 *            the new error code
+	 * @param parameters
+	 *            the error parameters
+	 */
+	void setConverterErrorCode(TraceBuilderErrorCode errorCode,
+			TraceBuilderErrorParameters parameters) {
+		converterErrorCode = errorCode;
+		converterErrorParameters = parameters;
+		runValidityCheck();
+	}
+
+	/**
+	 * Flag, which determines if the location has changed since last convert
+	 * operation
+	 * 
+	 * @return the flag
+	 */
+	public boolean hasChangedAfterConvert() {
+		return changedAfterConvert;
+	}
+
+	/**
+	 * Called when the location has been converted. Sets the changed after
+	 * convert flag to false
+	 */
+	public void locationConverted() {
+		changedAfterConvert = false;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceLocationConverter.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,587 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 converter monitors locations and converts them to traces if necessary.
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.TraceBuilderErrorCode;
+import com.nokia.tracebuilder.engine.propertydialog.PropertyDialogEnabler;
+import com.nokia.tracebuilder.engine.propertydialog.PropertyDialogEngine;
+import com.nokia.tracebuilder.engine.source.SourceParserRule;
+import com.nokia.tracebuilder.engine.source.SourceProperties;
+import com.nokia.tracebuilder.engine.source.SourceParserRule.ParameterConversionResult;
+import com.nokia.tracebuilder.engine.source.SourceParserRule.TraceConversionResult;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceGroup;
+import com.nokia.tracebuilder.model.TraceModel;
+import com.nokia.tracebuilder.model.TraceModelExtension;
+import com.nokia.tracebuilder.model.TraceModelPersistentExtension;
+import com.nokia.tracebuilder.model.TraceParameter;
+import com.nokia.tracebuilder.project.FormattingUtils;
+
+/**
+ * Location converter monitors locations and converts them to traces if
+ * necessary.
+ * 
+ */
+public final class TraceLocationConverter {
+
+	/**
+	 * Regular expression for catching variable syntax
+	 */
+	private final String VARIABLE_REGEX = "%\\S*"; //$NON-NLS-1$
+
+	/**
+	 * Trace model
+	 */
+	private TraceModel model;
+
+	/**
+	 * Property dialog engine
+	 */
+	private PropertyDialogEngine propertyDialogEngine;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            the trace model
+	 * @param propertyDialogEngine
+	 *            property dialog engine
+	 */
+	TraceLocationConverter(TraceModel model,
+			PropertyDialogEngine propertyDialogEngine) {
+		this.model = model;
+		this.propertyDialogEngine = propertyDialogEngine;
+	}
+
+	/**
+	 * Parse traces from source
+	 * 
+	 * @param properties
+	 *            the source properties
+	 */
+	public void parseTracesFromSource(SourceProperties properties) {
+		TraceBuilderGlobals.getSourceContextManager().setConverting(true);
+		model.startProcessing();
+		try {
+			for (TraceLocation loc : properties) {
+				autoConvertLocation(loc);
+			}
+			// If there are duplicates or unused traces, they are removed
+			// Note that this will work across source files although this
+			// function is processing only one file.
+			// If a trace is created, all locations from all open source files
+			// are linked to that trace and thus it will be removed as
+			// duplicate.
+			removeDuplicateTraces();
+			// Unused traces may exist if the cache file is not up-to-date
+			removeUnusedTraces();
+
+		} finally {
+			model.processingComplete();
+			SourceContextManager manager = TraceBuilderGlobals
+					.getSourceContextManager();
+			manager.setConverting(false);
+			manager.setContext(null);
+		}
+	}
+
+	/**
+	 * Converts the given location to trace if parser supports auto-conversion
+	 * 
+	 * @param location
+	 *            the location
+	 */
+	private void autoConvertLocation(TraceLocation location) {
+		// Stores the context of the location to the context manager.
+		TraceBuilderGlobals.getSourceContextManager().setContext(
+				location.getParser().getContext(location.getOffset()));
+		Trace trace = location.getTrace();
+		if (trace == null) {
+			// If the trace does not exist, the parser determines if the
+			// location can be converted
+			if (location.getParserRule().getLocationParser()
+					.isLocationConverted(location)) {
+				try {
+					convertLocation(location, null, true);
+				} catch (TraceBuilderException e) {
+					// If converter fails, the error code is stored into the
+					// location. The location notifies all validity listeners
+					// about the change
+					location.setConverterErrorCode((TraceBuilderErrorCode) e
+							.getErrorCode(), e.getErrorParameters());
+				}
+			}
+		} else {
+			// If the trace already exists in the model, it is updated
+			// based on the source file contents
+			updateLocation(location);
+		}
+	}
+
+	/**
+	 * Updates all locations of the source
+	 * 
+	 * @param properties
+	 *            the source that was saved
+	 */
+	void sourceSaved(SourceProperties properties) {
+		TraceBuilderGlobals.getSourceContextManager().setConverting(true);
+		model.startProcessing();
+		try {
+			// When a source is saved, all traces that have been removed from
+			// sources are also removed from the model.
+			removeUnusedTraces();
+
+			for (TraceLocation loc : properties) {
+				updateLocation(loc);
+			}
+
+			// TODO: When a duplicate location is removed from one source file,
+			// the other files are not processed and thus the duplicates
+			// will not be converted until the file they are in is saved.
+			// -> This affects UI builder only
+			// If there are duplicates, they are removed
+			removeDuplicateTraces();
+
+		} finally {
+			model.processingComplete();
+			TraceBuilderGlobals.getSourceContextManager().setConverting(false);
+		}
+	}
+
+	/**
+	 * Recreates the trace from changed location when source is saved
+	 * 
+	 * @param location
+	 *            the location to be checked
+	 */
+	private void updateLocation(TraceLocation location) {
+		// Parser determines if the location can be converted
+		if (location.getParserRule().getLocationParser().isLocationConverted(
+				location)) {
+			try {
+				Trace trace = location.getTrace();
+
+				// If a location has changed, the old trace is removed
+				// and a new one created. Persistent extensions are moved to the
+				// new trace
+				Iterator<TraceModelPersistentExtension> extensions = null;
+				if (trace != null) {
+					extensions = trace
+							.getExtensions(TraceModelPersistentExtension.class);
+					trace.getGroup().removeTrace(trace);
+				}
+				convertLocation(location, extensions, true);
+
+				// Check that the location is inside a function. Otherwise throw
+				// an error because the code is unreachable
+				if (location.getFunctionName() == null) {
+					throw new TraceBuilderException(
+							TraceBuilderErrorCode.UNREACHABLE_TRACE_LOCATION);
+				}
+
+			} catch (TraceBuilderException e) {
+				// If converter fails, the error code is stored into the
+				// location. The location notifies all validity listeners about
+				// the change
+				location.setConverterErrorCode((TraceBuilderErrorCode) e
+						.getErrorCode(), e.getErrorParameters());
+			}
+		}
+	}
+
+
+	/**
+	 * Source closed notification
+	 * 
+	 * @param properties
+	 *            the source properties
+	 */
+	void sourceClosed(SourceProperties properties) {
+		TraceBuilderGlobals.getSourceContextManager().setConverting(true);
+		model.startProcessing();
+		try {
+			removeUnusedTraces();
+		} finally {
+			model.processingComplete();
+			TraceBuilderGlobals.getSourceContextManager().setConverting(false);
+		}
+	}
+
+	/**
+	 * Removes all unused traces from the model
+	 */
+	private void removeUnusedTraces() {
+		boolean groupRemoved = true;
+		while (groupRemoved) {
+			groupRemoved = false;
+			for (TraceGroup group : model) {
+				removeUnusedTracesFromGroup(group);
+				if (!group.hasTraces()) {
+					model.removeGroup(group);
+					groupRemoved = true;
+					break;
+				}
+			}
+		}
+	}
+
+	/**
+	 * Removes unused traces from a trace group
+	 * 
+	 * @param group
+	 *            the group
+	 */
+	private void removeUnusedTracesFromGroup(TraceGroup group) {
+		boolean traceRemoved = true;
+		while (traceRemoved) {
+			traceRemoved = false;
+			for (Trace trace : group) {
+				TraceLocationList list = trace
+						.getExtension(TraceLocationList.class);
+				LastKnownLocationList plist = trace
+						.getExtension(LastKnownLocationList.class);
+				if ((list == null || !list.hasLocations())
+						&& (plist == null || !plist.hasLocations())) {
+					group.removeTrace(trace);
+					traceRemoved = true;
+					break;
+				}
+			}
+		}
+	}
+
+	/**
+	 * Removes all duplicate traces from the model
+	 */
+	private void removeDuplicateTraces() {
+		boolean groupRemoved = true;
+		while (groupRemoved) {
+			groupRemoved = false;
+			for (TraceGroup group : model) {
+				removeDuplicateTracesFromGroup(group);
+				if (!group.hasTraces()) {
+					model.removeGroup(group);
+					groupRemoved = true;
+					break;
+				}
+			}
+		}
+	}
+
+	/**
+	 * Removes duplicate traces from a trace group
+	 * 
+	 * @param group
+	 *            the group
+	 */
+	private void removeDuplicateTracesFromGroup(TraceGroup group) {
+		boolean traceRemoved = true;
+		while (traceRemoved) {
+			traceRemoved = false;
+			for (Trace trace : group) {
+				TraceLocationList list = trace
+						.getExtension(TraceLocationList.class);
+				if (list != null) {
+					if (list.getLocationCount() > 1) {
+						// All the locations are marked as duplicates and the
+						// trace is deleted
+						TraceBuilderErrorCode code = TraceBuilderErrorCode.TRACE_HAS_MULTIPLE_LOCATIONS;
+						for (LocationProperties loc : list) {
+							((TraceLocation) loc).setConverterErrorCode(code,
+									null);
+						}
+						group.removeTrace(trace);
+						traceRemoved = true;
+						break;
+					}
+				}
+			}
+		}
+	}
+
+	/**
+	 * Converts a location to a Trace object.
+	 * 
+	 * @param location
+	 *            the location to be converted
+	 * @return the new trace
+	 * @throws TraceBuilderException
+	 *             if conversion fails
+	 */
+	Trace convertLocation(TraceLocation location) throws TraceBuilderException {
+		return convertLocation(location, null, false);
+	}
+
+	/**
+	 * Converts a location to a Trace object.
+	 * 
+	 * @param location
+	 *            the location to be converted
+	 * @param extensions
+	 *            persistent extensions to be added to the new trace
+	 * @param autoConvert
+	 *            true if converting without user interaction
+	 * @return the new trace
+	 * @throws TraceBuilderException
+	 *             if conversion fails
+	 */
+	private Trace convertLocation(TraceLocation location,
+			Iterator<TraceModelPersistentExtension> extensions,
+			boolean autoConvert) throws TraceBuilderException {
+		Trace trace = null;
+		// If the parser has failed, the validity code is not OK and the
+		// location cannot be converted. Traces marked with no-trace error code
+		// have not yet been converted, so that is OK. Traces that have
+		// duplicate ID's error code can be parsed, since the duplicates might
+		// no longer exist.
+		if (!autoConvert
+				|| location.getValidityCode() == TraceBuilderErrorCode.OK
+				|| location.getValidityCode() == TraceBuilderErrorCode.TRACE_DOES_NOT_EXIST
+				|| location.getValidityCode() == TraceBuilderErrorCode.TRACE_HAS_MULTIPLE_LOCATIONS) {
+			// The parser does the actual conversion
+			SourceParserRule rule = location.getParserRule();
+			TraceConversionResult result = rule.getLocationParser()
+					.convertLocation(location);
+			// After parser has finished, the trace is created.
+			if (!autoConvert) {
+				trace = convertWithUI(result, extensions);
+			} else {
+				trace = convertWithoutUI(result, extensions);
+			}
+			if (trace != null) {
+				model.startProcessing();
+				try {
+					createParametersFromConversionResult(location, result,
+							trace);
+					// Runs a location validity check and notifies listeners
+					// that location is now OK
+					location.setConverterErrorCode(TraceBuilderErrorCode.OK,
+							null);
+				} catch (TraceBuilderException e) {
+					// If parameters cannot be created, the trace is removed
+					TraceGroup group = trace.getGroup();
+					trace.getGroup().removeTrace(trace);
+					if (!group.hasTraces()) {
+						group.getModel().removeGroup(group);
+					}
+					throw e;
+				} finally {
+					model.processingComplete();
+				}
+			}
+		}
+		return trace;
+	}
+
+	/**
+	 * Converts a location to trace without UI
+	 * 
+	 * @param result
+	 *            the conversion result from parser
+	 * @param extensions
+	 *            persistent extensions to be added to the new trace
+	 * @return the converted trace
+	 * @throws TraceBuilderException
+	 *             if location properties are not valid
+	 */
+	private Trace convertWithoutUI(TraceConversionResult result,
+			Iterator<TraceModelPersistentExtension> extensions)
+			throws TraceBuilderException {
+		Trace trace = null;
+		if (result.group != null) {
+			String groupName = result.group;
+			TraceGroup group = handleGroup(groupName);
+			trace = handleTrace(result, extensions, group);
+		} else {
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.GROUP_NOT_SELECTED);
+		}
+		return trace;
+	}
+
+	/**
+	 * Handle trace
+	 * 
+	 * @param result
+	 *            the conversion result from parser
+	 * @param extensions
+	 *            persistent extensions to be added to the new trace
+	 * @param group
+	 *            the group where trace belongs to
+	 * @return the trace
+	 * @throws TraceBuilderException
+	 */
+	private Trace handleTrace(TraceConversionResult result,
+			Iterator<TraceModelPersistentExtension> extensions, TraceGroup group)
+			throws TraceBuilderException {
+
+		Trace trace = null;
+		String traceName = result.name;
+		int traceId = group.getNextTraceID();
+		String text = result.text;
+		model.getVerifier().checkTraceProperties(group, null, traceId,
+				traceName, text);
+		TraceModelExtension[] extArray = createExtensionArray(result,
+				extensions);
+		trace = model.getFactory().createTrace(group, traceId, traceName, text,
+				extArray);
+
+		return trace;
+	}
+
+	/**
+	 * Handle group. Try to fnd group from model. If it does not exist then
+	 * create new group.
+	 * 
+	 * @param groupName
+	 *            the name of the group
+	 * @return the handled group
+	 * @throws TraceBuilderException
+	 */
+	private TraceGroup handleGroup(String groupName)
+			throws TraceBuilderException {
+		// If auto-convert flag is set, the location is converted without
+		// user interaction. A new trace group is created if not found
+		TraceGroup group = model.findGroupByName(groupName);
+		if (group == null) {
+			int groupId = FormattingUtils.getGroupID(model, groupName);
+			model.getVerifier().checkTraceGroupProperties(model, null, groupId,
+					groupName);
+			group = model.getFactory().createTraceGroup(groupId, groupName,
+					null);
+		}
+
+		return group;
+	}
+
+	/**
+	 * Combines extensions into one array
+	 * 
+	 * @param result
+	 *            the conversion result
+	 * @param extensions
+	 *            the persistent extensions from old trace
+	 * @return the combined array of extensions
+	 */
+	private TraceModelExtension[] createExtensionArray(
+			TraceConversionResult result,
+			Iterator<TraceModelPersistentExtension> extensions) {
+		TraceModelExtension[] extArray = null;
+		ArrayList<TraceModelExtension> ext = null;
+		if (result.extensions != null) {
+			ext = new ArrayList<TraceModelExtension>();
+			ext.addAll(result.extensions);
+		}
+		if (extensions != null) {
+			if (ext == null) {
+				ext = new ArrayList<TraceModelExtension>();
+			}
+			while (extensions.hasNext()) {
+				ext.add(extensions.next());
+			}
+		}
+		if (ext != null) {
+			extArray = new TraceModelExtension[ext.size()];
+			ext.toArray(extArray);
+		}
+		return extArray;
+	}
+
+	/**
+	 * Converts a location via UI
+	 * 
+	 * @param result
+	 *            the conversion result from parser
+	 * @param extensions
+	 *            persistent extensions to be added to the new trace
+	 * @return the converted trace
+	 */
+	private Trace convertWithUI(TraceConversionResult result,
+			Iterator<TraceModelPersistentExtension> extensions) {
+		Trace trace;
+		// Templates and flags are disabled
+		PropertyDialogEnabler enabler = new PropertyDialogEnabler(
+				PropertyDialogEnabler.ENABLE_ID
+						| PropertyDialogEnabler.ENABLE_NAME
+						| PropertyDialogEnabler.ENABLE_VALUE
+						| PropertyDialogEnabler.ENABLE_TARGET);
+		// If auto-convert flag is not set, the "Add Trace" dialog is
+		// shown
+		TraceGroup group = null;
+		if (result.group != null) {
+			group = model.findGroupByName(result.group);
+		}
+
+		// Remove all variables from the text before showing the UI
+		if (result.text != null) {
+			result.text = result.text.replaceAll(VARIABLE_REGEX, ""); //$NON-NLS-1$
+		}
+		trace = propertyDialogEngine.showAddTraceDialog(group, result.name,
+				result.text, result.extensions, enabler);
+		return trace;
+	}
+
+	/**
+	 * Creates the trace parameters based on trace conversion result
+	 * 
+	 * @param converted
+	 *            the location that was converted
+	 * @param result
+	 *            the conversion result
+	 * @param trace
+	 *            the trace
+	 * @throws TraceBuilderException
+	 *             if parameters cannot be created
+	 */
+	private void createParametersFromConversionResult(TraceLocation converted,
+			TraceConversionResult result, Trace trace)
+			throws TraceBuilderException {
+		if (result.parameters != null) {
+			for (int i = 0; i < result.parameters.size(); i++) {
+				int id = trace.getNextParameterID();
+				ParameterConversionResult res = result.parameters.get(i);
+				boolean warning = false;
+				if (res.type == null) {
+					warning = true;
+					res.type = TraceParameter.HEX32;
+				}
+				model.getVerifier().checkTraceParameterProperties(trace, null,
+						id, res.name, res.type);
+				TraceModelExtension[] extArray = null;
+				if (res.extensions != null) {
+					extArray = new TraceModelExtension[res.extensions.size()];
+					res.extensions.toArray(extArray);
+				}
+				TraceParameter param = model.getFactory().createTraceParameter(
+						trace, id, res.name, res.type, extArray);
+				if (warning) {
+					String msg = Messages
+							.getString("TraceBuilder.UnknownTypeWarning"); //$NON-NLS-1$
+					TraceBuilderGlobals.getEvents().postWarningMessage(msg,
+							param);
+				}
+			}
+		}
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceLocationList.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,141 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* List of trace locations
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+import java.util.ArrayList;
+
+/**
+ * List of trace locations.
+ * 
+ */
+public class TraceLocationList extends LocationListBase {
+
+	/**
+	 * Location list listeners
+	 */
+	private ArrayList<TraceLocationListListener> listeners = new ArrayList<TraceLocationListListener>();
+
+	/**
+	 * List title, returned by getTitle
+	 */
+	private String listTitle;
+
+	/**
+	 * Constructor
+	 */
+	TraceLocationList() {
+	}
+
+	/**
+	 * Constructor
+	 * 
+	 * @param listTitle
+	 *            the title of this location list
+	 */
+	TraceLocationList(String listTitle) {
+		this.listTitle = listTitle;
+	}
+
+	/**
+	 * Adds a location to this list.
+	 * 
+	 * @param location
+	 *            the location to be added
+	 */
+	void addLocation(TraceLocation location) {
+		if (TraceBuilderConfiguration.ASSERTIONS_ENABLED) {
+			if (contains(location)) {
+				TraceBuilderGlobals.getEvents().postCriticalAssertionFailed(
+						"Duplicate trace location", //$NON-NLS-1$
+						location.getConvertedName());
+			}
+		}
+		location.setLocationList(this);
+		add(location);
+		fireLocationAdded(location);
+		location.runValidityCheck();
+	}
+
+	/**
+	 * Removes a location from this list.
+	 * 
+	 * @param location
+	 *            the location to be removed
+	 */
+	void removeLocation(TraceLocation location) {
+		if (remove(location)) {
+			fireLocationRemoved(location);
+			location.setLocationList(null);
+		}
+	}
+
+	/**
+	 * Adds a location list listener to this object
+	 * 
+	 * @param listener
+	 *            the listener interface
+	 */
+	public void addLocationListListener(TraceLocationListListener listener) {
+		listeners.add(listener);
+	}
+
+	/**
+	 * Removes the location list listener
+	 * 
+	 * @param listener
+	 *            the listener interface
+	 */
+	public void removeLocationListListener(TraceLocationListListener listener) {
+		listeners.remove(listener);
+	}
+
+	/**
+	 * Creates locationAdded event to location list listeners
+	 * 
+	 * @param location
+	 *            the location that was added
+	 */
+	private void fireLocationAdded(TraceLocation location) {
+		for (TraceLocationListListener l : listeners) {
+			l.locationAdded(location);
+		}
+	}
+
+	/**
+	 * Creates locationRemoved event to location list listeners
+	 * 
+	 * @param location
+	 *            the location that was added
+	 */
+	void fireLocationRemoved(TraceLocation location) {
+		for (TraceLocationListListener l : listeners) {
+			l.locationRemoved(location);
+		}
+	}
+
+	/**
+	 * Gets the list title or null
+	 * 
+	 * @return the list title
+	 */
+	public String getListTitle() {
+		return listTitle;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceLocationListListener.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Listener for trace location lists
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+/**
+ * Listener for trace location lists
+ * 
+ */
+public interface TraceLocationListListener {
+
+	/**
+	 * Location was added to this list
+	 * 
+	 * @param location
+	 *            the new location
+	 */
+	public void locationAdded(TraceLocation location);
+
+	/**
+	 * Location was removed from this list
+	 * 
+	 * @param location
+	 *            the location that was removed
+	 */
+	public void locationRemoved(TraceLocation location);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceLocationListener.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Extends the source location listener with trace location -specific callbacks
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+import com.nokia.tracebuilder.source.SourceLocationListener;
+
+/**
+ * Extends the source location listener with trace location -specific callbacks
+ * 
+ */
+public interface TraceLocationListener extends SourceLocationListener {
+
+	/**
+	 * Notification that location validity has changed
+	 * 
+	 * @param location
+	 *            the location that changed
+	 */
+	public void locationValidityChanged(TraceLocation location);
+
+	/**
+	 * Notification that location content has changed
+	 * 
+	 * @param location
+	 *            the location that changed
+	 */
+	public void locationContentChanged(TraceLocation location);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceLocationMap.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,487 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Maps trace locations into traces and vice versa
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import com.nokia.tracebuilder.engine.source.SourceProperties;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceGroup;
+import com.nokia.tracebuilder.model.TraceModel;
+import com.nokia.tracebuilder.model.TraceObject;
+import com.nokia.tracebuilder.source.SourceContext;
+
+/**
+ * Maps trace locations into traces and vice versa.
+ * 
+ */
+public final class TraceLocationMap {
+
+	/**
+	 * List of unrelated traces
+	 */
+	private TraceLocationList unrelated = new TraceLocationList();
+
+	/**
+	 * Parser groups
+	 */
+	private HashMap<String, TraceLocationList> parserGroups = new HashMap<String, TraceLocationList>();
+
+	/**
+	 * The trace model
+	 */
+	private TraceModel model;
+
+	/**
+	 * Global list of locations, used for verification purposes with
+	 * GLOBAL_LOCATION_ASSERTS configuration flag
+	 */
+	private ArrayList<TraceLocation> globalList;
+
+	/**
+	 * Flag which is set when "Source missing" error is shown. Prevents it to be
+	 * shown again
+	 */
+	private boolean missingSourceErrorShown;
+
+	/**
+	 * Creates a location mapper
+	 * 
+	 * @param model
+	 *            the trace model
+	 */
+	public TraceLocationMap(TraceModel model) {
+		if (TraceBuilderConfiguration.GLOBAL_LOCATION_ASSERTS) {
+			globalList = new ArrayList<TraceLocation>();
+		}
+		this.model = model;
+		model.addModelListener(new LocationMapModelListener(this));
+		model.addExtension(unrelated);
+	}
+
+	/**
+	 * Adds the locations from the source file to the map
+	 * 
+	 * @param source
+	 *            properties of the source to be added
+	 */
+	public void addSource(SourceProperties source) {
+		for (TraceLocation location : source) {
+			if (TraceBuilderConfiguration.GLOBAL_LOCATION_ASSERTS) {
+				if (globalList.contains(location)) {
+					TraceBuilderGlobals.getEvents().postAssertionFailed(
+							"Location already in global list", //$NON-NLS-1$
+							location.getConvertedName());
+				} else {
+					globalList.add(location);
+				}
+			}
+			// Generates locationAdded event via TraceLocationListListener
+			addNewLocationToTrace(location);
+		}
+		removeFromStorage(source);
+	}
+
+	/**
+	 * Updates the locations based on the new source properties
+	 * 
+	 * @param source
+	 *            the source properties of the updated source
+	 */
+	void updateSource(SourceProperties source) {
+		for (TraceLocation location : source) {
+			if (location.isDeleted()) {
+				// Generates locationRemoved event via TraceLocationListListener
+				locationDeleted(location);
+			} else if (location.isContentChanged()) {
+				locationContentChanged(location);
+			} else {
+				// Generates locationChanged events if offset or length has
+				// changed
+				location.notifyLocationChanged();
+			}
+		}
+		checkGlobalValidity();
+	}
+
+	/**
+	 * Removes the locations of the closed source properties
+	 * 
+	 * @param source
+	 *            the source properties of the removed source
+	 * @param path
+	 *            the file path as string
+	 * @param name
+	 *            the file name
+	 */
+	public void removeSource(SourceProperties source, String path,
+			String name) {
+		missingSourceErrorShown = false;
+		for (TraceLocation location : source) {
+			if (TraceBuilderConfiguration.GLOBAL_LOCATION_ASSERTS) {
+				if (!globalList.remove(location)) {
+					TraceBuilderGlobals.getEvents().postAssertionFailed(
+							"Location not in global list", //$NON-NLS-1$
+							location.getConvertedName());
+				}
+			}
+			TraceLocationList list = location.getLocationList();
+			if (list != null) {
+				addLastKnownLocation(source, location, list, path, name);
+				// Generates locationRemoved event via TraceLocationListListener
+				list.removeLocation(location);
+			} else {
+				if (TraceBuilderConfiguration.ASSERTIONS_ENABLED) {
+					TraceBuilderGlobals.getEvents().postAssertionFailed(
+							"Unassociated location on remove", //$NON-NLS-1$
+							location.getConvertedName());
+				}
+			}
+		}
+	}	
+
+	/**
+	 * Converts a location to a last known  location
+	 * 
+	 * @param source
+	 *            the source file
+	 * @param location
+	 *            the location
+	 * @param list
+	 *            the location list
+	 * @param path
+	 *            the file path as string
+	 * @param name
+	 *            the file name
+	 */
+	public void addLastKnownLocation(SourceProperties source,
+			TraceLocation location, TraceLocationList list, String path, String name) {
+		TraceObject owner = list.getOwner();
+		if (owner instanceof Trace) {
+			LastKnownLocationList pll = owner
+					.getExtension(LastKnownLocationList.class);
+			if (pll == null) {
+				pll = new LastKnownLocationList();
+				owner.addExtension(pll);
+			}
+			if (path == null) {
+				path = source.getFilePath();
+			}
+			if (name == null) {
+				name = source.getFileName();
+			}			
+			if (path != null && name != null) {
+				if (new File(path + name).exists()) {
+					String cname = null;
+					String mname = null;
+					SourceContext context = source.getSourceEditor()
+							.getContext(location.getOffset());
+					if (context != null) {
+						cname = context.getClassName();
+						mname = context.getFunctionName();
+					}
+					LastKnownLocation loc = new LastKnownLocation(path, name,
+							location.getLineNumber(), cname, mname);
+					pll.addLocation(loc);
+				} else {
+					showSourceRemovedError(name);
+				}
+			}
+		}
+	}	
+	
+	/**
+	 * Shows source with traces removed error
+	 * 
+	 * @param name
+	 *            the source name
+	 */
+	private void showSourceRemovedError(String name) {
+		// TODO: Add an error code for this and move message there
+		if (!missingSourceErrorShown) {
+			missingSourceErrorShown = true;
+			String msg = Messages
+					.getString("TraceLocationMap.SourceWithTraceRemoved"); //$NON-NLS-1$
+			TraceBuilderGlobals.getEvents().postErrorMessage(msg, name, true);
+		}
+	}
+
+	/**
+	 * Removes locations from last known storage
+	 * 
+	 * @param source
+	 *            the source file
+	 */
+	private void removeFromStorage(SourceProperties source) {
+		File f = new File(source.getFilePath() + source.getFileName());
+		Iterator<TraceGroup> groups = model.getGroups();
+		while (groups.hasNext()) {
+			Iterator<Trace> traces = groups.next().getTraces();
+			while (traces.hasNext()) {
+				LastKnownLocationList list = traces.next().getExtension(
+						LastKnownLocationList.class);
+				if (list != null) {
+					Iterator<LocationProperties> locs = list.iterator();
+					while (locs.hasNext()) {
+						LastKnownLocation loc = (LastKnownLocation) locs
+								.next();
+						File locf = new File(loc.getFilePath()
+								+ loc.getFileName());
+						if (f.equals(locf)) {
+							locs.remove();
+							list.fireLocationRemoved(loc);
+						}
+					}
+				}
+			}
+		}
+	}
+
+	/**
+	 * Adds a location to trace or to the unrelated list if a trace cannot be
+	 * found.
+	 * 
+	 * @param location
+	 *            the location to be added
+	 */
+	private void addNewLocationToTrace(TraceLocation location) {
+		TraceLocationList list;
+		Trace trace = model.findTraceByName(location.getOriginalName());
+		if (trace != null) {
+			list = trace.getExtension(TraceLocationList.class);
+			if (list == null) {
+				list = new TraceLocationList();
+				trace.addExtension(list);
+			}
+		} else {
+			String name = location.getParserRule().getLocationParser()
+					.getLocationGroup();
+			if (name == null) {
+				list = unrelated;
+			} else {
+				list = parserGroups.get(name);
+				if (list == null) {
+					list = new TraceLocationList(name);
+					model.addExtension(list);
+					parserGroups.put(name, list);
+				}
+			}
+		}
+		list.addLocation(location);
+	}
+
+	/**
+	 * Checks that all locations are valid.
+	 * Posts assertion failed events if not valid
+	 */
+	private void checkGlobalValidity() {
+		if (TraceBuilderConfiguration.GLOBAL_LOCATION_ASSERTS) {
+			boolean failure = false;
+			for (int i = 0; i < globalList.size(); i++) {
+				TraceLocation loc = globalList.get(i);
+				if (loc.isDeleted()) {
+					TraceBuilderGlobals.getEvents().postAssertionFailed(
+							"Deleted location found", //$NON-NLS-1$
+							loc.getConvertedName());
+					failure = true;
+				} else if (loc.getLocationList() == null) {
+					TraceBuilderGlobals.getEvents().postAssertionFailed(
+							"Unassociated location found", //$NON-NLS-1$
+							loc.getConvertedName());
+					failure = true;
+				} else if (loc.getTag() == null) {
+					TraceBuilderGlobals.getEvents().postAssertionFailed(
+							"Untagged location found", loc.getConvertedName()); //$NON-NLS-1$
+					failure = true;
+				} else if (loc.getLength() <= loc.getTag().length()) {
+					TraceBuilderGlobals.getEvents().postAssertionFailed(
+							"Unassociated location found", //$NON-NLS-1$
+							loc.getConvertedName());
+					failure = true;
+				}
+			}
+			if (failure) {
+				TraceBuilderGlobals.getEvents().postCriticalAssertionFailed(
+						"Invalid location(s) found", null); //$NON-NLS-1$
+			}
+		}
+	}
+
+	/**
+	 * Processes a location which has been deleted
+	 * 
+	 * @param location
+	 *            the location that was deleted
+	 */
+	private void locationDeleted(TraceLocation location) {
+		if (TraceBuilderConfiguration.GLOBAL_LOCATION_ASSERTS) {
+			if (!globalList.remove(location)) {
+				TraceBuilderGlobals.getEvents().postAssertionFailed(
+						"Location not in global list", //$NON-NLS-1$
+						location.getConvertedName());
+			}
+		}
+		TraceLocationList list = location.getLocationList();
+		if (list != null) {
+			list.removeLocation(location);
+		} else {
+			if (TraceBuilderConfiguration.ASSERTIONS_ENABLED) {
+				TraceBuilderGlobals.getEvents().postCriticalAssertionFailed(
+						"Unassociated location on delete", //$NON-NLS-1$
+						location.getConvertedName());
+			}
+		}
+	}
+
+	/**
+	 * Processes a location that has content changed flag
+	 * 
+	 * @param location
+	 *            the location to be processed
+	 */
+	private void locationContentChanged(TraceLocation location) {
+		// If location is new, it does not have a list
+		if (location.getLocationList() == null) {
+			if (TraceBuilderConfiguration.GLOBAL_LOCATION_ASSERTS) {
+				if (globalList.contains(location)) {
+					TraceBuilderGlobals.getEvents().postAssertionFailed(
+							"Location already in global list", //$NON-NLS-1$
+							location.getConvertedName());
+				} else {
+					globalList.add(location);
+				}
+			}
+			// Generates locationAdded event via TraceLocationListListener
+			addNewLocationToTrace(location);
+		} else if (location.isNameChanged()) {
+			// Generates locationRemoved to listeners of old list and
+			// locationAdded to listeners of new list
+			moveLocation(location);
+			// Generates content and validity changed events
+			location.notifyLocationChanged();
+		} else if (location.isContentChanged()) {
+			// Generates content and validity changed events
+			location.notifyLocationChanged();
+		}
+	}
+
+	/**
+	 * Moves a location from trace to another. Does nothing if the target trace
+	 * is same as source trace
+	 * 
+	 * @param location
+	 *            the location to be moved
+	 */
+	private void moveLocation(TraceLocation location) {
+		Trace trace = location.getTrace();
+		Trace newTrace = model.findTraceByName(location.getOriginalName());
+		// If the traces differ, this relocates the location
+		// to different location array
+		if (trace != newTrace) {
+			TraceLocationList list = location.getLocationList();
+			// Removes from existing list and adds the existing list to the
+			// updates list
+			list.removeLocation(location);
+			// Adds to new list. If new list does not exist, it is created
+			if (newTrace != null) {
+				list = newTrace.getExtension(TraceLocationList.class);
+				if (list == null) {
+					list = new TraceLocationList();
+					newTrace.addExtension(list);
+				}
+			} else {
+				list = unrelated;
+			}
+			list.addLocation(location);
+		}
+	}
+
+	/**
+	 * Returns the list of unrelated trace objects.
+	 * 
+	 * @return list of unrelated traces
+	 */
+	TraceLocationList getUnrelatedTraces() {
+		return unrelated;
+	}
+
+	/**
+	 * Removes all location lists from the model
+	 */
+	public void clearAll() {
+		model.removeExtension(unrelated);
+		Iterator<TraceGroup> groups = model.getGroups();
+		while (groups.hasNext()) {
+			TraceGroup group = groups.next();
+			Iterator<Trace> traces = group.getTraces();
+			while (traces.hasNext()) {
+				Trace trace = traces.next();
+				TraceLocationList list = trace
+						.getExtension(TraceLocationList.class);
+				trace.removeExtension(list);
+			}
+		}
+	}
+
+	/**
+	 * Moves the locations from trace to unrelated list
+	 * 
+	 * @param trace
+	 *            the trace
+	 */
+	void moveToUnrelated(Trace trace) {
+		TraceLocationList list = trace.getExtension(TraceLocationList.class);
+		if (list != null) {
+			trace.removeExtension(list);
+			for (LocationProperties loc : list) {
+				unrelated.addLocation((TraceLocation) loc);
+			}
+		}
+	}
+
+	/**
+	 * Moves locations from unrelated to the given trace
+	 * 
+	 * @param trace
+	 *            the trace
+	 */
+	void moveFromUnrelated(Trace trace) {
+		String name = trace.getName();
+		TraceLocationList list = null;
+		Iterator<LocationProperties> itr = unrelated.iterator();
+		while (itr.hasNext()) {
+			TraceLocation location = (TraceLocation) itr.next();
+			if (name.equals(location.getOriginalName())) {
+				list = trace.getExtension(TraceLocationList.class);
+				if (list == null) {
+					list = new TraceLocationList();
+					trace.addExtension(list);
+				}
+				// NOTE: This must replicate the behavior of
+				// TraceLocationList.removeLocation
+				itr.remove();
+				unrelated.fireLocationRemoved(location);
+				list.addLocation(location);
+			}
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceLocationProperties.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,167 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Optional properties for a trace location
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import com.nokia.tracebuilder.engine.source.SourceLocationRule;
+import com.nokia.tracebuilder.engine.source.TraceFormattingRule;
+
+/**
+ * Optional properties for a trace location
+ * 
+ */
+public class TraceLocationProperties {
+
+	/**
+	 * Formatting rule for the location
+	 */
+	private TraceFormattingRule formatRule;
+
+	/**
+	 * Location rule for the location
+	 */
+	private SourceLocationRule locationRule;
+
+	/**
+	 * Tags to be added to source as parameters instead of parameter name
+	 */
+	private ArrayList<String> parameterTags;
+
+	/**
+	 * View reference for quick view updates
+	 */
+	private Object viewReference;
+
+	/**
+	 * Event view reference for quick event view updates
+	 */
+	private Object eventViewReference;
+
+	/**
+	 * Gets the location rule
+	 * 
+	 * @return the location rule
+	 */
+	public SourceLocationRule getLocationRule() {
+		return locationRule;
+	}
+
+	/**
+	 * Sets a location rule for the location. The rule overrides the default
+	 * location rule provided by the trace that owns the location
+	 * 
+	 * @param rule
+	 *            the location formatting rule
+	 */
+	public void setLocationRule(SourceLocationRule rule) {
+		this.locationRule = rule;
+	}
+
+	/**
+	 * Gets the formatting rule
+	 * 
+	 * @return the formatting rule
+	 */
+	public TraceFormattingRule getFormatRule() {
+		return formatRule;
+	}
+
+	/**
+	 * Sets a formatting rule for the location. The formatting rule overrides
+	 * the formatting rule provided by the trace that owns the location
+	 * 
+	 * @param rule
+	 *            the location formatting rule
+	 */
+	public void setFormatRule(TraceFormattingRule rule) {
+		this.formatRule = rule;
+	}
+
+	/**
+	 * Gets the parameter tags for this location. This works based on parameter
+	 * index
+	 * 
+	 * @return the list of parameter tags for the location
+	 */
+	public Iterator<String> getParameterTags() {
+		List<String> list;
+		if (parameterTags != null) {
+			list = parameterTags;
+		} else {
+			list = Collections.emptyList();
+		}
+		return list.iterator();
+	}
+
+	/**
+	 * Adds a new parameter tag to this location
+	 * 
+	 * @param tag
+	 *            the tag to be added
+	 */
+	public void addParameterTag(String tag) {
+		if (parameterTags == null) {
+			parameterTags = new ArrayList<String>();
+		}
+		parameterTags.add(tag);
+	}
+
+	/**
+	 * Sets the view reference
+	 * 
+	 * @param viewReference
+	 *            the view reference
+	 */
+	public void setViewReference(Object viewReference) {
+		this.viewReference = viewReference;
+	}
+
+	/**
+	 * Gets the view reference of the location
+	 * 
+	 * @return the view reference
+	 */
+	public Object getViewReference() {
+		return viewReference;
+	}
+
+	/**
+	 * Sets the event view reference
+	 * 
+	 * @param eventViewReference
+	 *            the event view reference
+	 */
+	public void setEventViewReference(Object eventViewReference) {
+		this.eventViewReference = eventViewReference;
+	}
+
+	/**
+	 * Gets the event view reference of the location
+	 * 
+	 * @return the event view reference
+	 */
+	public Object getEventViewReference() {
+		return eventViewReference;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceObjectPropertyDialog.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,243 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 a property dialog of Trace Builder
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+import java.util.List;
+
+import com.nokia.tracebuilder.model.TraceObject;
+
+/**
+ * Interface to a property dialog of Trace Builder. Implemented into the view
+ * 
+ */
+public interface TraceObjectPropertyDialog {
+
+	/**
+	 * OK button pressed
+	 */
+	int OK = 0;
+
+	/**
+	 * Cancel button pressed
+	 */
+	int CANCEL = 1;
+
+	/**
+	 * Add trace dialog type
+	 */
+	int ADD_TRACE = 1;
+
+	/**
+	 * Add parameter dialog type
+	 */
+	int ADD_PARAMETER = 2;
+
+	/**
+	 * Select component dialog type
+	 */
+	int SELECT_COMPONENT = 3;
+
+	/**
+	 * Add constant dialog type
+	 */
+	int ADD_CONSTANT = 4;
+
+	/**
+	 * Edit group dialog type
+	 */
+	int EDIT_GROUP = 5;
+
+	/**
+	 * Edit trace dialog type
+	 */
+	int EDIT_TRACE = 6;
+
+	/**
+	 * Edit constant table dialog type
+	 */
+	int EDIT_CONSTANT_TABLE = 7;
+
+	/**
+	 * Edit constant dialog type
+	 */
+	int EDIT_CONSTANT = 8;
+
+	/**
+	 * Instrumenter dialog type
+	 */
+	int INSTRUMENTER = 9;
+
+	/**
+	 * Sets the dialog type
+	 * 
+	 * @param dialogType
+	 *            the type
+	 */
+	public void setDialogType(int dialogType);
+
+	/**
+	 * Gets the dialog type
+	 * 
+	 * @return the dialog type
+	 */
+	public int getDialogType();
+
+	/**
+	 * Gets the name of the target. When OK button is pressed, this may return a
+	 * different name than the name of the object set by setTargetObject
+	 * 
+	 * @return the name of the target object
+	 */
+	public String getTarget();
+
+	
+	/**
+	 * Sets the target name
+	 * 
+	 * @param target
+	 *            the new target name
+	 */
+	public void setTarget(String target);
+	
+	/**
+	 * Sets the target object. The object may not be changed by the UI.
+	 * 
+	 * @param object
+	 *            the target object
+	 */
+	public void setTargetObject(TraceObject object);
+
+	/**
+	 * Gets the object that was set with setTargetObject
+	 * 
+	 * @return the target object
+	 */
+	public TraceObject getTargetObject();
+
+	/**
+	 * Shows the dialog.
+	 * 
+	 * @return the button ID used to close the dialog
+	 */
+	public int open();
+
+	/**
+	 * Sets the object identifier
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceObject#getID()
+	 * @param id
+	 *            the object ID
+	 */
+	public void setID(int id);
+
+	/**
+	 * Gets the object identifier
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceObject#getID()
+	 * @return the object ID
+	 */
+	public int getID();
+
+	/**
+	 * Sets the object name
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceObject#getName()
+	 * @param name
+	 *            the new name
+	 */
+	public void setName(String name);
+
+	/**
+	 * Returns the object name
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceObject#getName()
+	 * @return the name
+	 */
+	public String getName();
+
+	/**
+	 * Gets the object value.
+	 * 
+	 * @see com.nokia.tracebuilder.model.Trace#getTrace()
+	 * @see com.nokia.tracebuilder.model.TraceParameter#getType()
+	 * @return the value
+	 */
+	public String getValue();
+
+	/**
+	 * Sets the object value.
+	 * 
+	 * @see com.nokia.tracebuilder.model.Trace#getTrace()
+	 * @see com.nokia.tracebuilder.model.TraceParameter#getType()
+	 * @param value
+	 *            the object value
+	 */
+	public void setValue(String value);
+
+	/**
+	 * Sets the dialog flags
+	 * 
+	 * @param flags
+	 *            the flags
+	 */
+	public void setFlags(List<TraceObjectPropertyDialogFlag> flags);
+
+	/**
+	 * Gets the dialog flags
+	 * 
+	 * @return the list of flags
+	 */
+	public List<TraceObjectPropertyDialogFlag> getFlags();
+
+	/**
+	 * Sets the templates to the dialog.
+	 * 
+	 * @param templates
+	 *            the list of templates
+	 * @param active
+	 *            the template that should be selected when the dialog is shown
+	 */
+	public void setTemplates(List<TraceObjectPropertyDialogTemplate> templates,
+			TraceObjectPropertyDialogTemplate active);
+
+	/**
+	 * Gets the template that was selected
+	 * 
+	 * @return the template
+	 */
+	public TraceObjectPropertyDialogTemplate getTemplate();
+
+	/**
+	 * Sets the enabler interface
+	 * 
+	 * @param enabler
+	 *            the enabler
+	 */
+	public void setEnabler(TraceObjectPropertyDialogEnabler enabler);
+
+	/**
+	 * Sets an interface that can be used by the view to verify dialog contents
+	 * while user is changing them
+	 * 
+	 * @param verifier
+	 *            the dialog content verifier
+	 */
+	public void setVerifier(TraceObjectPropertyDialogVerifier verifier);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceObjectPropertyDialogConfiguration.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 used by property dialog manager to configure the property dialog
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+import java.util.List;
+
+/**
+ * Interface used by property dialog manager to configure the property dialog
+ * 
+ */
+public interface TraceObjectPropertyDialogConfiguration {
+
+	/**
+	 * Adds the templates to be shown in the "Add" dialog
+	 * 
+	 * @param templates
+	 *            the list where the templates are added
+	 * @param dialogType
+	 *            the dialog type
+	 */
+	public void addViewTemplates(
+			List<TraceObjectPropertyDialogTemplate> templates, int dialogType);
+
+	/**
+	 * Adds the property flags that are shown in the view for given object
+	 * 
+	 * @param flags
+	 *            the list where the flags are added
+	 * @param dialogType
+	 *            the dialog type
+	 */
+	public void addViewFlags(List<TraceObjectPropertyDialogFlag> flags,
+			int dialogType);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceObjectPropertyDialogDynamicFlag.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 a flag shown in property dialog
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+/**
+ * Extends the property dialog flag interface by providing means to receive
+ * template change notifications from the UI
+ * 
+ */
+public interface TraceObjectPropertyDialogDynamicFlag extends
+		TraceObjectPropertyDialogFlag {
+
+	/**
+	 * Called by the UI when user changes the template
+	 * 
+	 * @param template
+	 *            the new template
+	 * @return true if flag changed, false if not
+	 */
+	public boolean templateChanged(TraceObjectPropertyDialogTemplate template);
+
+	/**
+	 * Called by the UI when user changes a property flag
+	 * 
+	 * @param flag
+	 *            the flag that was changed
+	 * @return true if flag changed, false if not
+	 */
+	public boolean flagChanged(TraceObjectPropertyDialogFlag flag);
+
+	/**
+	 * Queried by the UI after template has changed. If this returns false, the
+	 * UI checkbox is disabled and the flag value is set to isAlwaysEnabled
+	 * 
+	 * @return availability flag
+	 */
+	public boolean isAvailable();
+
+	/**
+	 * If this returns true, the flag value is set even if the checkbox is
+	 * disabled
+	 * 
+	 * @return the always enabled flag
+	 */
+	public boolean isAlwaysEnabled();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceObjectPropertyDialogEnabler.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 disable property dialog editors
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+import com.nokia.tracebuilder.model.TraceModelExtension;
+
+/**
+ * Interface which can be implemented by a trace object rule to prevent object
+ * modification with a property dialog. If this interface is not present, all
+ * properties can be edited.
+ * 
+ */
+public interface TraceObjectPropertyDialogEnabler extends TraceModelExtension {
+
+	/**
+	 * Checks if target field is enabled
+	 * 
+	 * @return true if enabled
+	 */
+	public boolean isTargetEnabled();
+	
+	/**
+	 * Checks if ID field is enabled
+	 * 
+	 * @return true if enabled
+	 */
+	public boolean isIdEnabled();
+
+	/**
+	 * Checks if name field is enabled
+	 * 
+	 * @return true if enabled
+	 */
+	public boolean isNameEnabled();
+
+	/**
+	 * Checks if value field is enabled
+	 * 
+	 * @return true if enabled
+	 */
+	public boolean isValueEnabled();
+
+	/**
+	 * Checks if type selector is enabled
+	 * 
+	 * @return true if enabled
+	 */
+	public boolean isTypeEnabled();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceObjectPropertyDialogFlag.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 a flag shown in property dialog
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+import java.util.List;
+
+import com.nokia.tracebuilder.model.TraceModelExtension;
+
+/**
+ * Interface to a flag shown in property dialog
+ * 
+ */
+public interface TraceObjectPropertyDialogFlag {
+
+	/**
+	 * Gets the flag state
+	 * 
+	 * @return the enabled state
+	 */
+	public boolean isEnabled();
+
+	/**
+	 * Sets the flag state
+	 * 
+	 * @param enabled
+	 *            the flag state
+	 */
+	public void setEnabled(boolean enabled);
+
+	/**
+	 * Gets the text shown in UI
+	 * 
+	 * @return the text
+	 */
+	public String getText();
+
+	/**
+	 * Checks if this flag should be shown in UI
+	 * 
+	 * @return true if visible, false otherwise
+	 */
+	public boolean isVisible();
+
+	/**
+	 * Creates the extensions to be added to the trace
+	 * 
+	 * @param extList
+	 *            the list where the extensions should be added
+	 */
+	public void createExtensions(List<TraceModelExtension> extList);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceObjectPropertyDialogTemplate.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,95 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 a template for the property dialog
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+import java.util.List;
+
+import com.nokia.tracebuilder.model.TraceModelExtension;
+
+/**
+ * Interface to a template for the property dialog. Templates contain predefined
+ * values for property dialogs.
+ * 
+ */
+public interface TraceObjectPropertyDialogTemplate {
+
+	/**
+	 * Gets the title of the template
+	 * 
+	 * @return the title
+	 */
+	public String getTitle();
+
+	/**
+	 * Gets the object name
+	 * 
+	 * @return the name
+	 */
+	public String getName();
+
+	/**
+	 * Gets the object value
+	 * 
+	 * @return the value
+	 */
+	public String getValue();
+
+	/**
+	 * Checks if the target can be changed after it has been set to the value
+	 * specified by this template
+	 * 
+	 * @return true if target can be changed, false if not
+	 */
+	public boolean isTargetEnabled();	
+	
+	/**
+	 * Checks if the ID can be changed after it has been set to the value
+	 * specified by this template
+	 * 
+	 * @return true if ID can be changed, false if not
+	 */
+	public boolean isIDEnabled();
+
+	/**
+	 * Checks if the name can be changed after it has been set to the value
+	 * specified by this template
+	 * 
+	 * @return true if name can be changed, false if not
+	 */
+	public boolean isNameEnabled();
+
+	/**
+	 * Checks if the value can be changed after it has been set to the value
+	 * specified by this template
+	 * 
+	 * @return true if value can be changed, false if not
+	 */
+	public boolean isValueEnabled();
+
+	/**
+	 * Creates the extensions provided by this template and adds them to the
+	 * given list. The extensions are passed to the creation function of object
+	 * factory.
+	 * 
+	 * @param list
+	 *            the list where extension are added
+	 */
+	public void createExtensions(List<TraceModelExtension> list);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceObjectPropertyDialogVerifier.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 which can be used by the view to verify dialog contents
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+import com.nokia.tracebuilder.model.TraceBuilderException;
+
+/**
+ * Interface which can be used by the view to verify dialog contents while user
+ * is changing them
+ * 
+ */
+public interface TraceObjectPropertyDialogVerifier {
+
+	/**
+	 * Verifies the contents of the property dialog. The exception thrown by
+	 * this method can be used to generate the error message
+	 * 
+	 * @throws TraceBuilderException
+	 *             if verification fails
+	 */
+	public void verifyContents() throws TraceBuilderException;
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceParameterPropertyDialogDynamicFlag.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Dynamic flag modifier which is based on parameter type
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+/**
+ * Dynamic flag modifier which is based on parameter type
+ * 
+ */
+public interface TraceParameterPropertyDialogDynamicFlag extends
+		TraceObjectPropertyDialogDynamicFlag {
+
+	/**
+	 * Called by UI when parameter type changes
+	 * 
+	 * @param newType
+	 *            the new parameter type
+	 * @return true if change required UI update
+	 */
+	public boolean typeChanged(String newType);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceParameterPropertyDialogTemplate.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 a template for the property dialog
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+/**
+ * Interface to a template for the TraceParameter property dialog.
+ * 
+ */
+public interface TraceParameterPropertyDialogTemplate extends
+		TraceObjectPropertyDialogTemplate {
+
+	/**
+	 * Gets the parameter type
+	 * 
+	 * @return the type
+	 */
+	public String getType();
+
+	/**
+	 * Checks if the type can be changed after it has been set to the value
+	 * specified by this template
+	 * 
+	 * @return true if type can be changed, false if not
+	 */
+	public boolean isTypeEnabled();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceProjectMonitorInterface.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Trace Builder interface
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+/**
+ * Trace Project Monitor interface
+ * 
+ */
+public interface TraceProjectMonitorInterface {
+	/**
+	 * Starts monitoring
+	 */
+	public void startMonitor();
+
+	/**
+	 * Stops monitoring
+	 */
+	public void stopMonitor();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TracePropertyDialogTemplate.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 a template for the property dialog
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+/**
+ * Interface to a template for the Trace property dialog.
+ * 
+ */
+public interface TracePropertyDialogTemplate extends
+		TraceObjectPropertyDialogTemplate {
+
+	/**
+	 * Gets the preferred target group for new traces based on this template
+	 * 
+	 * @return the target group name
+	 */
+	public String getGroupName();
+
+	/**
+	 * Gets a new trace text value. Called when the target group is changed in
+	 * the property dialog
+	 * 
+	 * @param groupName
+	 *            the target group name
+	 * @return the trace text
+	 */
+	public String getText(String groupName);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceViewExtension.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,70 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Extensions to the trace view that can be stored into the model implement this interface
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+import java.util.Iterator;
+
+import com.nokia.tracebuilder.model.TraceModelUpdatableExtension;
+
+/**
+ * Extensions to the trace view that can be stored into the model implement this
+ * interface. The view implementation needs to be able to show all the
+ * extensions it finds from the model.
+ * 
+ */
+public interface TraceViewExtension extends TraceModelUpdatableExtension {
+
+	/**
+	 * Gets the children of this extension
+	 * 
+	 * @return the children in array
+	 */
+	public Iterator<?> getChildren();
+
+	/**
+	 * Determines if this extension has children
+	 * 
+	 * @return true if this has children
+	 */
+	public boolean hasChildren();
+
+	/**
+	 * Flag that determines whether to show or hide the extension when it has no
+	 * children
+	 * 
+	 * @return the flag
+	 */
+	public boolean hideWhenEmpty();
+
+	/**
+	 * View reference must be stored and returned via getViewReference
+	 * 
+	 * @param reference
+	 *            the reference
+	 */
+	public void setViewReference(Object reference);
+
+	/**
+	 * Gets the view reference
+	 * 
+	 * @return the view reference
+	 */
+	public Object getViewReference();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceViewNameExtension.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 add text to the object name shown in view
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+import com.nokia.tracebuilder.model.TraceModelExtension;
+
+/**
+ * Interface to add text to the object name shown in view
+ * 
+ */
+public interface TraceViewNameExtension extends TraceModelExtension {
+
+	/**
+	 * Returns the name extension that is shown in parenthesis after the actual
+	 * object name
+	 * 
+	 * @return the name extension
+	 */
+	public String getNameExtension();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/ViewAdapter.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,150 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 adapter
+*
+*/
+package com.nokia.tracebuilder.engine;
+
+import com.nokia.tracebuilder.model.TraceObject;
+
+/**
+ * View adapter implements the view interface.
+ * 
+ */
+public class ViewAdapter implements TraceBuilderView {
+
+	/**
+	 * Actions interface
+	 */
+	private TraceBuilderActions actions;
+
+	/**
+	 * Dialogs interface
+	 */
+	private TraceBuilderDialogs dialogs;
+
+	/**
+	 * Property dialog interface
+	 */
+	private TraceObjectPropertyDialog propertyDialog;
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderView#
+	 *      createPropertyDialog()
+	 */
+	public TraceObjectPropertyDialog getPropertyDialog() {
+		if (propertyDialog == null) {
+			propertyDialog = new PropertyDialogAdapter();
+		}
+		return propertyDialog;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderView#getActions()
+	 */
+	public TraceBuilderActions getActions() {
+		if (actions == null) {
+			actions = new ActionsAdapter();
+		}
+		return actions;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderView#getConfiguration()
+	 */
+	public TraceBuilderConfiguration getConfiguration() {
+		// This can be null, the configuration delegate checks it
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderView#getDialogs()
+	 */
+	public TraceBuilderDialogs getDialogs() {
+		if (dialogs == null) {
+			dialogs = new DialogsAdapter();
+		}
+		return dialogs;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderView#hasFocus()
+	 */
+	public boolean hasFocus() {
+		return false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderView#
+	 *      runAsyncOperation(java.lang.Runnable)
+	 */
+	public void runAsyncOperation(Runnable runnable) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderView#
+	 *      selectLocation(com.nokia.tracebuilder.engine.TraceLocation)
+	 */
+	public void selectLocation(TraceLocation location) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderView#
+	 *      selectObject(com.nokia.tracebuilder.model.TraceObject)
+	 */
+	public void selectObject(TraceObject object) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderView#setFocus()
+	 */
+	public void setFocus() {
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderView#
+	 *      refresh()
+	 */
+	public void refresh() {
+	}
+	
+	/* (non-Javadoc)
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderView#expandTraceGroupsBranch()
+	 */
+	public void expandTraceGroupsBranch() {
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/event/EventEngine.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,216 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Implements TraceBuilderEvents to forward events to the event router plug-in
+*
+*/
+package com.nokia.tracebuilder.engine.event;
+
+import com.nokia.trace.eventrouter.TraceEvent;
+import com.nokia.trace.eventrouter.TraceEventRouter;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorMessages;
+import com.nokia.tracebuilder.engine.TraceBuilderEvents;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.TraceBuilderErrorCode;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceModel;
+
+/**
+ * Implements TraceBuilderEvents to forward events to the event router plug-in
+ * 
+ */
+public final class EventEngine implements TraceBuilderEvents {
+
+	/**
+	 * Error which is shown after sequential processing
+	 */
+	private String processingError;
+
+	/**
+	 * Category for new events
+	 */
+	private String defaultCategory = "General"; //$NON-NLS-1$
+
+	/**
+	 * Trace model
+	 */
+	private TraceModel model;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            the trace model
+	 */
+	public EventEngine(TraceModel model) {
+		model.addProcessingListener(new EventManagerProcessingListener(this));
+		this.model = model;
+	}
+
+	/**
+	 * Resets the processing error
+	 */
+	void resetProcessingError() {
+		processingError = null;
+	}
+
+	/**
+	 * Gets the processing error
+	 * 
+	 * @return the error
+	 */
+	String getProcessingError() {
+		return processingError;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderEvents#
+	 *      postError(com.nokia.tracebuilder.engine.TraceBuilderException)
+	 */
+	public void postError(TraceBuilderException exception) {
+		String message = TraceBuilderErrorMessages.getErrorMessage(exception);
+		if (message != null && message.length() > 0) {
+			postErrorMessage(message, exception.getErrorSource(), exception.isEventWantedToPost());
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderEvents#postErrorMessage(java.lang.String, java.lang.Object, boolean)
+	 */
+	public void postErrorMessage(String message, Object source, boolean postEvent) {
+		
+		if (postEvent) {
+			postEvent(TraceEvent.ERROR, message, defaultCategory, source);
+		}
+		
+		// If the auto-converter is running, dialogs are not shown at all
+		// Otherwise they would pop up on every file save
+		if (!TraceBuilderGlobals.getSourceContextManager().isConverting()) {
+			// If the model is running a sequence of operations, the error
+			// dialog is now shown to user. After processing is complete,
+			// the dialog is shown
+			if (!model.isProcessing()) {
+				TraceBuilderGlobals.getDialogs().showErrorMessage(message);
+			} else {
+				// Stores the error to be viewed later. If there are multiple
+				// errors, the individual errors are not shown as message
+				// dialogs
+				if (processingError == null) {
+					processingError = message;
+				} else {
+					TraceBuilderErrorCode errorid = TraceBuilderErrorCode.MULTIPLE_ERRORS_IN_OPERATION;
+					processingError = TraceBuilderErrorMessages
+							.getErrorMessage(errorid, null);
+				}
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderEvents#
+	 *      postWarningMessage(java.lang.String, java.lang.Object)
+	 */
+	public void postWarningMessage(String message, Object source) {
+		postEvent(TraceEvent.WARNING, message, defaultCategory, source);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderEvents#
+	 *      postInfoMessage(java.lang.String, java.lang.Object)
+	 */
+	public void postInfoMessage(String message, Object source) {
+		postEvent(TraceEvent.INFO, message, defaultCategory, source);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderEvents#
+	 *      postAssertionFailed(java.lang.String, java.lang.Object)
+	 */
+	public void postAssertionFailed(String message, Object source) {
+		message = "Assertion failed. Reason: " //$NON-NLS-1$
+				+ message;
+		postEvent(TraceEvent.ASSERT_NORMAL, message, "Normal", source); //$NON-NLS-1$
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderEvents#
+	 *      postCriticalAssertionFailed(java.lang.String, java.lang.Object)
+	 */
+	public void postCriticalAssertionFailed(String message, Object source) {
+		message = "Critical assertion failure, the project has been closed. Reason: " //$NON-NLS-1$
+				+ message;
+		// Closes the trace project and shows an error message
+		TraceBuilderGlobals.getTraceBuilder().closeProject();
+		TraceBuilderGlobals.getActions().enableActions(null);
+		postEvent(TraceEvent.ASSERT_CRITICAL, message, "Critical", source); //$NON-NLS-1$
+		TraceBuilderGlobals.getDialogs().showErrorMessage(message);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderEvents#setEventCategory(java.lang.String)
+	 */
+	public String setEventCategory(String category) {
+		String oldCategory = this.defaultCategory;
+		this.defaultCategory = category;
+		return oldCategory;
+	}
+
+	/**
+	 * Posts an event to the event router plug-in if it is available
+	 * 
+	 * @param message
+	 *            event message
+	 * @param category
+	 *            event category
+	 * @param source
+	 *            event source
+	 * @param type
+	 *            event type
+	 */
+	private void postEvent(int type, String message, String category,
+			Object source) {
+		TraceEventRouter router = TraceEventRouter.getInstance();
+		if (router != null) {
+			TraceEvent event = new TraceEvent(type, message);
+			event.setCategory(category);
+			event.setSource(source);
+			router.postEvent(event);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderEvents#getEventCategory()
+	 */
+	public String getEventCategory() {
+		return defaultCategory;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/event/EventManagerProcessingListener.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Model processing listener for event manager
+*
+*/
+package com.nokia.tracebuilder.engine.event;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.model.TraceProcessingListener;
+
+/**
+ * Model processing listener for event manager
+ * 
+ */
+final class EventManagerProcessingListener implements TraceProcessingListener {
+
+	/**
+	 * The event manager
+	 */
+	private final EventEngine manager;
+
+	/**
+	 * @param manager
+	 */
+	EventManagerProcessingListener(EventEngine manager) {
+		this.manager = manager;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceProcessingListener#processingComplete(boolean)
+	 */
+	public void processingComplete(boolean changed) {
+		String err = manager.getProcessingError();
+		if (err != null) {
+			TraceBuilderGlobals.getDialogs().showErrorMessage(err);
+			manager.resetProcessingError();
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceProcessingListener#processingStarted()
+	 */
+	public void processingStarted() {
+		manager.resetProcessingError();
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/event/package.html	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,3 @@
+<html><body>
+TraceBuilder event router implementation
+</body></html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/messages.properties	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,101 @@
+TraceBuilder.UnknownTypeWarning=Parameter type is unknown. Hex, 32-bit used
+TraceLocationMap.SourceWithTraceRemoved=Source file with traces was removed
+TraceBuilderErrorMessages.SourceNotEditable=Source cannot be edited
+TraceBuilderErrorMessages.DuplicateGroupID=Group ID conflict. Please close all the source files, delete traceid and tracebuilder cache files. Then reopen source file.
+TraceBuilderErrorMessages.DuplicateTraceID=Trace ID is already in use
+TraceBuilderErrorMessages.DuplicateGroupName=Group name is already in use
+TraceBuilderErrorMessages.DuplicateTraceName=Trace name is already in use
+TraceBuilderErrorMessages.DuplicateConstantValue=Enum text is already in use
+TraceBuilderErrorMessages.DuplicateConstantID=Enum value is already in use
+TraceBuilderErrorMessages.DuplicateConstantTableName=Enum type is already in use
+TraceBuilderErrorMessages.DuplicateConstantTableID=Enum ID is already in use
+TraceBuilderErrorMessages.DuplicateParameterName=Parameter name is already in use
+TraceBuilderErrorMessages.DuplicateParameterID=Parameter ID is already in use
+TraceBuilderErrorMessages.InvalidGroupName=Invalid group name
+TraceBuilderErrorMessages.InvalidTraceName=Invalid trace name
+TraceBuilderErrorMessages.InvalidGroupID=Invalid group ID
+TraceBuilderErrorMessages.InvalidGroupIDStart=Group ID must be between 
+TraceBuilderErrorMessages.InvalidGroupIDMiddle=\ and 
+TraceBuilderErrorMessages.InvalidGroupIDEnd=
+TraceBuilderErrorMessages.InvalidTraceID=Invalid trace ID
+TraceBuilderErrorMessages.InvalidTraceIDStart=Trace ID must be between 
+TraceBuilderErrorMessages.InvalidTraceIDMiddle=\ and 
+TraceBuilderErrorMessages.InvalidTraceIDEnd=
+TraceBuilderErrorMessages.InvalidModelPropertiesForExport=Before exporting, the trace compiler needs to be run once to generate UID and name for the component.
+TraceBuilderErrorMessages.InvalidProjectName=Project name is not valid
+TraceBuilderErrorMessages.InvalidSourceLocation=Cursor location is not valid
+TraceBuilderErrorMessages.InvalidParameterName=Parameter name is not valid
+TraceBuilderErrorMessages.InvalidParameterNameInReturnValue=Return parameter name is not valid. Parameter was not added to exit trace.
+TraceBuilderErrorMessages.InvalidConstantValue=Enum text is not valid
+TraceBuilderErrorMessages.InvalidParameterType=Parameter type is not supported
+TraceBuilderErrorMessages.InvalidParameterTypePrefix=Parameter type 
+TraceBuilderErrorMessages.InvalidParameterTypePostfix=\ is not supported
+TraceBuilderErrorMessages.InvalidDirectoryPrefix=
+TraceBuilderErrorMessages.InvalidDirectoryPostfix=\ is not a valid directory
+TraceBuilderErrorMessages.InvalidDirectory=Directory is not valid
+TraceBuilderErrorMessages.InvalidConstantTableName=Enum type is not valid or it is empty. Please select a valid enum from the source code and try again.
+TraceBuilderErrorMessages.ConstantTableNotPartOfProject=The file where enum exist is not part of project. You can parse enums only from files that are part of the project. If you want parse enum from external file, you can copy and paste that enum to some file in your project and parse it from there. After you have parsed enum you can delete it from your project.  
+TraceBuilderErrorMessages.FileDoesNotExistPrefix=
+TraceBuilderErrorMessages.FileDoesNotExistPostfix=\ does not exist
+TraceBuilderErrorMessages.InvalidTraceData=Invalid trace text
+TraceBuilderErrorMessages.InvalidTraceFile=Trace project file is not valid
+TraceBuilderErrorMessages.GroupNotSelected=Group was not selected
+TraceBuilderErrorMessages.NoFunctionsToInstrumentPrefix=None of the functions from open files could be instrumented with 
+TraceBuilderErrorMessages.NoFunctionsToInstrument=Currently open files do not have any functions that can be instrumented
+TraceBuilderErrorMessages.NoFunctionsToInstrumentPostfix=\ template
+TraceBuilderErrorMessages.ParameterFormatMismatch=Parameter count does not match the format specification
+TraceBuilderErrorMessages.ParameterFormatNotSupported=Parameter format is not supported
+TraceBuilderErrorMessages.ParameterFormatNotSupportedPrefix=Parameter format 
+TraceBuilderErrorMessages.ParameterFormatNotSupportedPostfix=\ is not supported
+TraceBuilderErrorMessages.MultipleErrorsInOperation=Multiple errors during operation. See event viewer for details
+TraceBuilderErrorMessages.ParameterAddNotAllowed=Parameters cannot be added to the trace
+TraceBuilderErrorMessages.SourceNotOpen=Source file needs to be opened first
+TraceBuilderErrorMessages.ParameterRemoveNotAllowed=The parameter cannot be removed
+TraceBuilderErrorMessages.ConstantTableNotSelected=Enum was not selected
+TraceBuilderErrorMessages.ConstantTableParseFailed=Failed to parse enum
+TraceBuilderErrorMessages.CannotDeleteSelectedObject=The selected object cannot be deleted
+TraceBuilderErrorMessages.CannotUpdateTraceIntoSource=Trace could not be updated to source code
+TraceBuilderErrorMessages.CannotParseFunctionParameters=None of the function parameters could be added to the function entry trace
+TraceBuilderErrorMessages.CannotOpenProjectFile=Cannot open project file. Check that the directory is not read-only
+TraceBuilderErrorMessages.CannotWriteProjectFile=Cannot write project file. Check that the directory is not read-only
+TraceBuilderErrorMessages.CannotOpenSourceFile=Source file could not be opened
+TraceBuilderErrorMessages.ParameterTemplateInUse=Another parameter already uses the selected template
+TraceBuilderErrorMessages.InvalidTraceTextFormat=Trace text format is not valid
+TraceBuilderErrorMessages.InvalidTraceNameFormat=Trace name format is not valid
+TraceBuilderErrorMessages.InsertTraceDoesNotWork=Data traces cannot be inserted to source
+TraceBuilderErrorMessages.TraceLocationNotSelected=Source location was not selected
+TraceBuilderErrorMessages.TraceHasMultipleLocations=Trace is used from multiple places
+TraceBuilderErrorMessages.LocationCouldNotBeParsed=Location could not be parsed
+TraceBuilderErrorMessages.UnreachableTraceLocation=Trace is in unreachable part of the code
+TraceBuilderErrorMessages.NameFormatMissingFunction=Missing function name tag {$FN} from trace name
+TraceBuilderErrorMessages.TraceNotSelected=Trace was not selected
+TraceBuilderErrorMessages.TraceProjectNotOpen=Trace project is not open
+TraceBuilderErrorMessages.TraceHasNoLocations=Trace is not used from source files and will be removed when a source is saved
+TraceBuilderErrorMessages.NoTracesToDelete=No traces to delete
+TraceBuilderErrorMessages.NoTracesToExport=Project does not have any traces -> No files were written
+TraceBuilderErrorMessages.FileDoesNotExist=File does not exist
+TraceBuilderErrorMessages.NoTraceGroups=Cannot add a new trace before a trace group has been created
+TraceBuilderErrorMessages.UnexpectedException=Unknown error occurred
+TraceBuilderErrorMessages.NotEnoughParameters=Trace does not have enough parameters
+TraceBuilderErrorMessages.NoContextForLocation=Class / function name for trace could not be determined
+TraceBuilderErrorMessages.TraceDoesNotExist=Trace will be created when the source file is saved
+TraceBuilderErrorMessages.TraceNeedsConversionPrefix=Trace needs conversion to 
+TraceBuilderErrorMessages.ParameterCountMismatch=Parameter count in source does not match the parameter count in trace
+TraceBuilderErrorMessages.ParameterCountDoesNotMatchApi=The number of parameters in source does not match the API macro
+TraceBuilderErrorMessages.ParameterFormatNotSupportedInMacro=Extension macro needs to be used with this parameter format type
+TraceBuilderErrorMessages.ParameterFormatUnnecessaryExtMacro=Trace does not need to use extension macro
+TraceBuilderErrorMessages.ParameterFormatNotSupportedInMacroPrefix=Extension macro needs to be used with parameter 
+TraceBuilderErrorMessages.ParameterFormatNotSupportedInMacroPostfix=
+TraceBuilderErrorMessages.ParameterFormatNotSupportedInArrayPrefix=Parameter format 
+TraceBuilderErrorMessages.ParameterFormatNotSupportedInArrayPostfix=\ cannot be used as an array
+TraceBuilderErrorMessages.ParameterFormatNotSupportedInArray=Parameter format cannot be used as an array
+TraceBuilderErrorMessages.PropertyFileElementNotSupportedPrefix=Property file element 
+TraceBuilderErrorMessages.PropertyFileElementNotSupportedPostfix=\ is not supported and was ignored
+TraceBuilderErrorMessages.PropertyFileElementMisplacedPrefix=Property file element 
+TraceBuilderErrorMessages.PropertyFileElementMisplacedPostfix=\ was unexpected
+TraceBuilderErrorMessages.PropertyFileAttributeInvalidPrefix=Property file attribute 
+TraceBuilderErrorMessages.PropertyFileAttributeInvalidPostfix=\ did not have a valid value
+TraceBuilderErrorMessages.RunOutOfGroupIDs=Run out of user defined Group IDs
+TraceBuilderErrorMessages.VarArgListParameterFound=Parameters were not added to the trace because one of the variables is a variable argument list.
+TraceBuilderErrorMessages.UnkownOstVersion=Unknown OST version.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/package.html	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,3 @@
+<html><body>
+Contains the main control logic of Trace Builder plug-in.
+</body></html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/plugin/PluginEngine.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,216 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 plugin manager, which delegates calls to plug-ins
+*
+*/
+package com.nokia.tracebuilder.engine.plugin;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import com.nokia.tracebuilder.engine.TraceBuilderConfiguration;
+import com.nokia.tracebuilder.engine.TraceBuilderEngine;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorMessages;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.TraceBuilderErrorCode;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceModel;
+import com.nokia.tracebuilder.model.TraceObjectPropertyVerifier;
+import com.nokia.tracebuilder.plugin.TraceAPIPlugin;
+import com.nokia.tracebuilder.plugin.TraceBuilderExport;
+import com.nokia.tracebuilder.plugin.TraceBuilderImport;
+import com.nokia.tracebuilder.plugin.TraceBuilderPlugin;
+
+/**
+ * Plugin engine, which delegates calls to plug-ins
+ * 
+ */
+public final class PluginEngine extends TraceBuilderEngine {
+
+	/**
+	 * List of plug-ins
+	 */
+	private ArrayList<TraceBuilderPlugin> plugins = new ArrayList<TraceBuilderPlugin>();
+
+	/**
+	 * Property verifier
+	 */
+	private PluginTracePropertyVerifier verifier = new PluginTracePropertyVerifier(
+			this);
+
+	/**
+	 * Trace model
+	 */
+	private TraceModel model;
+
+	/**
+	 * Project open flag
+	 */
+	private boolean projectOpen;
+
+	/**
+	 * Sets the trace model. This is not set in constructor, since plug-in
+	 * engine is created before the model
+	 * 
+	 * @param model
+	 *            the trace model
+	 */
+	public void setModel(TraceModel model) {
+		this.model = model;
+	}
+
+	/**
+	 * Gets the started flag
+	 * 
+	 * @return true if started, false if not
+	 */
+	public boolean isProjectOpen() {
+		return projectOpen;
+	}
+
+	/**
+	 * Adds a plugin
+	 * 
+	 * @param plugin
+	 *            the plugin to be added
+	 */
+	public void add(TraceBuilderPlugin plugin) {
+		plugins.add(plugin);
+		if (plugin instanceof TraceAPIPlugin) {
+			TraceAPIPlugin api = (TraceAPIPlugin) plugin;
+			TraceAPIPluginManager manager = model
+					.getExtension(TraceAPIPluginManager.class);
+			manager.addFormatters(api.getFormatters());
+			manager.addParsers(api.getParsers());
+		}
+	}
+
+	/**
+	 * Removes a plugin
+	 * 
+	 * @param plugin
+	 *            the plugin to be removed
+	 */
+	public void remove(TraceBuilderPlugin plugin) {
+		// Formatters / parsers are not removed. Currently this is not a
+		// problem since plug-in's are removed only on shutdown
+		plugins.remove(plugin);
+	}
+
+	/**
+	 * Gets the property verifier interface
+	 * 
+	 * @return the verifier
+	 */
+	public TraceObjectPropertyVerifier getVerifier() {
+		return verifier;
+	}
+
+	/**
+	 * Checks if there are plug-ins
+	 * 
+	 * @return true if plug-ins exist
+	 */
+	public boolean hasPlugins() {
+		return !plugins.isEmpty();
+	}
+
+	/**
+	 * Gets the plug-ins
+	 * 
+	 * @return the plug-ins
+	 */
+	Iterator<TraceBuilderPlugin> getPlugins() {
+		return plugins.iterator();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderEngine#projectExporting()
+	 */
+	@Override
+	public void exportProject() {
+		if (model.hasTraces()) {
+			for (TraceBuilderPlugin plugin : plugins) {
+				if (plugin instanceof TraceBuilderExport) {
+					try {
+						((TraceBuilderExport) plugin).exportTraceProject();
+					} catch (TraceBuilderException e) {
+						TraceBuilderGlobals.getEvents().postError(e);
+					}
+				}
+			}
+		} else {
+			TraceBuilderGlobals.getEvents().postInfoMessage(
+					TraceBuilderErrorMessages.getErrorMessage(
+							TraceBuilderErrorCode.NO_TRACES_TO_EXPORT, null),
+					null);
+		}
+	}
+
+	/**
+	 * Gets the list of TraceBuilderImport interfaces
+	 * 
+	 * @return the import interfaces
+	 */
+	public List<TraceBuilderImport> getImports() {
+		ArrayList<TraceBuilderImport> list = new ArrayList<TraceBuilderImport>();
+		for (TraceBuilderPlugin plugin : plugins) {
+			if (plugin instanceof TraceBuilderImport) {
+				list.add((TraceBuilderImport) plugin);
+			}
+		}
+		return list;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderEngine#projectOpened()
+	 */
+	@Override
+	public void projectOpened() {
+		if (!projectOpen) {
+			for (TraceBuilderPlugin plugin : plugins) {
+				plugin.traceProjectOpened(model);
+			}
+			projectOpen = true;
+		} else {
+			if (TraceBuilderConfiguration.ASSERTIONS_ENABLED) {
+				TraceBuilderGlobals.getEvents().postAssertionFailed(
+						"PluginEngine.traceProjectOpened", null); //$NON-NLS-1$
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderEngine#projectClosing()
+	 */
+	@Override
+	public void projectClosed() {
+		if (projectOpen) {
+			for (TraceBuilderPlugin plugin : plugins) {
+				plugin.traceProjectClosed();
+			}
+			projectOpen = false;
+		}
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/plugin/PluginTracePropertyVerifier.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,352 @@
+/*
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 verifier for trace objects
+*
+*/
+package com.nokia.tracebuilder.engine.plugin;
+
+import java.io.File;
+import java.util.Iterator;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.FileErrorParameters;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.RangeErrorParameters;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.TraceBuilderErrorCode;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceConstantTable;
+import com.nokia.tracebuilder.model.TraceConstantTableEntry;
+import com.nokia.tracebuilder.model.TraceGroup;
+import com.nokia.tracebuilder.model.TraceModel;
+import com.nokia.tracebuilder.model.TraceObjectPropertyVerifier;
+import com.nokia.tracebuilder.model.TraceParameter;
+import com.nokia.tracebuilder.plugin.TraceBuilderPlugin;
+import com.nokia.tracebuilder.project.GroupNameHandlerBase;
+import com.nokia.tracebuilder.source.SourceConstants;
+import com.nokia.tracebuilder.source.SourceUtils;
+
+/**
+ * Property verifier for trace objects
+ * 
+ */
+final class PluginTracePropertyVerifier implements TraceObjectPropertyVerifier {
+
+	/**
+	 * Valid data character range start
+	 */
+	private static final int DATA_CHAR_START = 0x20; // CodForChk_Dis_Magic
+
+	/**
+	 * Valid data character range end
+	 */
+	private static final int DATA_CHAR_END = 0x7E; // CodForChk_Dis_Magic
+
+	/**
+	 * Plugin engine
+	 */
+	private PluginEngine pluginEngine;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param engine
+	 *            plug-in engine
+	 */
+	PluginTracePropertyVerifier(PluginEngine engine) {
+		this.pluginEngine = engine;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceObjectPropertyVerifier#
+	 *      checkConstantProperties(com.nokia.tracebuilder.model.TraceConstantTable,
+	 *      com.nokia.tracebuilder.model.TraceConstantTableEntry, int,
+	 *      java.lang.String)
+	 */
+	public void checkConstantProperties(TraceConstantTable table,
+			TraceConstantTableEntry entry, int id, String value)
+			throws TraceBuilderException {
+		if (!SourceUtils.isValidName(value)) {
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.INVALID_CONSTANT_VALUE);
+		}
+		if (table != null) {
+			// If table exists, the value and ID must be unique
+			TraceConstantTableEntry old = table.findEntryByID(id);
+			if (old != null && old != entry) {
+				throw new TraceBuilderException(
+						TraceBuilderErrorCode.DUPLICATE_CONSTANT_ID);
+			}
+			old = table.findEntryByName(value);
+			if (old != null && old != entry) {
+				throw new TraceBuilderException(
+						TraceBuilderErrorCode.DUPLICATE_CONSTANT_VALUE);
+			}
+		}
+		Iterator<TraceBuilderPlugin> itr = pluginEngine.getPlugins();
+		while (itr.hasNext()) {
+			TraceBuilderPlugin provider = itr.next();
+			if (provider instanceof TraceObjectPropertyVerifier) {
+				((TraceObjectPropertyVerifier) provider)
+						.checkConstantProperties(table, entry, id, value);
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceObjectPropertyVerifier#
+	 *      checkConstantTableProperties(com.nokia.tracebuilder.model.TraceModel,
+	 *      com.nokia.tracebuilder.model.TraceConstantTable, int,
+	 *      java.lang.String)
+	 */
+	public void checkConstantTableProperties(TraceModel model,
+			TraceConstantTable table, int id, String tableName)
+			throws TraceBuilderException {
+		if (!SourceUtils.isValidName(tableName)) {
+			 throw new TraceBuilderException(
+			 TraceBuilderErrorCode.INVALID_CONSTANT_TABLE_NAME, false);
+		}
+		TraceConstantTable old = model.findConstantTableByID(id);
+		if (old != null && old != table) {
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.DUPLICATE_CONSTANT_TABLE_ID);
+		}
+		old = model.findConstantTableByName(tableName);
+		if (old != null && old != table) {
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.DUPLICATE_CONSTANT_TABLE_NAME);
+		}
+		Iterator<TraceBuilderPlugin> itr = pluginEngine.getPlugins();
+		while (itr.hasNext()) {
+			TraceBuilderPlugin provider = itr.next();
+			if (provider instanceof TraceObjectPropertyVerifier) {
+				((TraceObjectPropertyVerifier) provider)
+						.checkConstantTableProperties(model, table, id,
+								tableName);
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceObjectPropertyVerifier#
+	 *      checkTraceGroupProperties(com.nokia.tracebuilder.model.TraceModel,
+	 *      com.nokia.tracebuilder.model.TraceGroup, int, java.lang.String)
+	 */
+	public void checkTraceGroupProperties(TraceModel model, TraceGroup group,
+			int id, String name) throws TraceBuilderException {
+		GroupNameHandlerBase groupNameHandler = TraceBuilderGlobals.getGroupNameHandler();
+		if (!SourceUtils.isValidName(name)) {
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.INVALID_GROUP_NAME);
+		} else if ((id < 0) || (id > groupNameHandler.getMaxGroupId())) {
+			RangeErrorParameters params = new RangeErrorParameters();
+			params.start = 0;
+			params.end = groupNameHandler.getMaxGroupId();
+			params.isHex = true;
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.INVALID_GROUP_ID, params);
+		} else {
+			TraceGroup old = model.findGroupByID(id);
+			if (old != null && old != group) {
+				throw new TraceBuilderException(
+						TraceBuilderErrorCode.DUPLICATE_GROUP_ID);
+			}
+			old = model.findGroupByName(name);
+			if (old != null && old != group) {
+				throw new TraceBuilderException(
+						TraceBuilderErrorCode.DUPLICATE_GROUP_NAME);
+			}
+		}
+		Iterator<TraceBuilderPlugin> itr = pluginEngine.getPlugins();
+		while (itr.hasNext()) {
+			TraceBuilderPlugin provider = itr.next();
+			if (provider instanceof TraceObjectPropertyVerifier) {
+				((TraceObjectPropertyVerifier) provider)
+						.checkTraceGroupProperties(model, group, id, name);
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceObjectPropertyVerifier#
+	 *      checkTraceModelProperties(com.nokia.tracebuilder.model.TraceModel,
+	 *      int, java.lang.String, java.lang.String)
+	 */
+	public void checkTraceModelProperties(TraceModel model, int id,
+			String name, String path) throws TraceBuilderException {
+		if (!SourceUtils.isValidName(name)) {
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.INVALID_MODEL_NAME);
+		}
+		// Path is null when updating model
+		if (path != null) {
+			if (path.length() == 0) {
+				throw new TraceBuilderException(
+						TraceBuilderErrorCode.INVALID_PATH);
+			}
+			File f = new File(path);
+			if (f.exists() && !f.isDirectory()) {
+				FileErrorParameters fp = new FileErrorParameters();
+				fp.file = f.getAbsolutePath();
+				throw new TraceBuilderException(
+						TraceBuilderErrorCode.INVALID_PATH, fp);
+			}
+		}
+		Iterator<TraceBuilderPlugin> itr = pluginEngine.getPlugins();
+		while (itr.hasNext()) {
+			TraceBuilderPlugin provider = itr.next();
+			if (provider instanceof TraceObjectPropertyVerifier) {
+				((TraceObjectPropertyVerifier) provider)
+						.checkTraceModelProperties(model, id, name, path);
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceObjectPropertyVerifier#
+	 *      checkTraceParameterProperties(com.nokia.tracebuilder.model.Trace,
+	 *      com.nokia.tracebuilder.model.TraceParameter, int, java.lang.String,
+	 *      java.lang.String)
+	 */
+	public void checkTraceParameterProperties(Trace owner,
+			TraceParameter parameter, int id, String name, String type)
+			throws TraceBuilderException {
+		if (!SourceUtils.isValidParameterName(name)) {
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.INVALID_PARAMETER_NAME);
+		}
+		TraceParameter old = owner.findParameterByID(id);
+		if (old != null && old != parameter) {
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.DUPLICATE_PARAMETER_ID);
+		}
+		old = owner.findParameterByName(name);
+		if (old != null && old != parameter) {
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.DUPLICATE_PARAMETER_NAME);
+		}
+		Iterator<TraceBuilderPlugin> itr = pluginEngine.getPlugins();
+		while (itr.hasNext()) {
+			TraceBuilderPlugin provider = itr.next();
+			if (provider instanceof TraceObjectPropertyVerifier) {
+				((TraceObjectPropertyVerifier) provider)
+						.checkTraceParameterProperties(owner, parameter, id,
+								name, type);
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceObjectPropertyVerifier#
+	 *      checkTraceProperties(com.nokia.tracebuilder.model.TraceGroup,
+	 *      com.nokia.tracebuilder.model.Trace, int, java.lang.String,
+	 *      java.lang.String)
+	 */
+	public void checkTraceProperties(TraceGroup group, Trace trace, int id,
+			String name, String data) throws TraceBuilderException {
+		if (!isValidData(data)) {
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.INVALID_TRACE_DATA);
+		} else if (!SourceUtils.isValidName(name)) {
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.INVALID_TRACE_NAME);
+		} else if ((id < 0) || (id > TraceBuilderGlobals.MAX_TRACE_ID)) {
+			RangeErrorParameters params = new RangeErrorParameters();
+			params.start = 0;
+			params.end = TraceBuilderGlobals.MAX_TRACE_ID;
+			params.isHex = true;
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.INVALID_TRACE_ID, params);
+		} else {
+			// Verifies the trace name is globally unique
+			Trace old = TraceBuilderGlobals.getTraceModel().findTraceByName(
+					name);
+			if (old != trace && old != null) {
+				throw new TraceBuilderException(
+						TraceBuilderErrorCode.DUPLICATE_TRACE_NAME);
+			}
+			if (group != null) {
+				// If group exists, the trace ID and text must be unique within
+				// the group
+				old = group.findTraceByID(id);
+				if (old != trace && old != null) {
+					// Trace ID's must be unique within group
+					throw new TraceBuilderException(
+							TraceBuilderErrorCode.DUPLICATE_TRACE_ID);
+				}
+			}
+		}
+		Iterator<TraceBuilderPlugin> itr = pluginEngine.getPlugins();
+		while (itr.hasNext()) {
+			TraceBuilderPlugin provider = itr.next();
+			if (provider instanceof TraceObjectPropertyVerifier) {
+				((TraceObjectPropertyVerifier) provider).checkTraceProperties(
+						group, trace, id, name, data);
+			}
+		}
+	}
+
+	/**
+	 * Checks the validity of data
+	 * 
+	 * @param data
+	 *            the data
+	 * @return true if valid
+	 */
+	private boolean isValidData(String data) {
+		boolean retval;
+		if (data != null) {
+			retval = true;
+			for (int i = 0; i < data.length() && retval; i++) {
+				char c = data.charAt(i);
+				// Unescaped quotes are not allowed
+				if (c == SourceConstants.QUOTE_CHAR
+						&& (i == 0 || data.charAt(i - 1) != SourceConstants.BACKSLASH_CHAR)) {
+					retval = false;
+				} else {
+					retval = isValidDataChar(c);
+				}
+			}
+		} else {
+			retval = false;
+		}
+		return retval;
+	}
+
+	/**
+	 * Checks data character validity
+	 * 
+	 * @param c
+	 *            character
+	 * @return true if valid
+	 */
+	private boolean isValidDataChar(char c) {
+		// Special and extended characters are not allowed
+		return c >= DATA_CHAR_START && c <= DATA_CHAR_END;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/plugin/TraceAPIPluginManager.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 API plug-in manager interface
+*
+*/
+package com.nokia.tracebuilder.engine.plugin;
+
+import com.nokia.tracebuilder.model.TraceModelExtension;
+import com.nokia.tracebuilder.plugin.TraceAPIFormatter;
+import com.nokia.tracebuilder.plugin.TraceAPIParser;
+
+/**
+ * Trace API plug-in manager interface
+ * 
+ */
+public interface TraceAPIPluginManager extends TraceModelExtension {
+
+	/**
+	 * Adds the formatter API's from the plug-in
+	 * 
+	 * @param formatters
+	 *            the formatters
+	 */
+	public void addFormatters(TraceAPIFormatter[] formatters);
+
+	/**
+	 * Adds the parser API's from the plug-in
+	 * 
+	 * @param parsers
+	 *            the parsers
+	 */
+	public void addParsers(TraceAPIParser[] parsers);
+
+	/**
+	 * Sets the default API to the model.
+	 */
+	public void createDefaultAPI();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/plugin/package.html	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,3 @@
+<html><body>
+Plug-in manager and related classes
+</body></html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/project/Messages.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Localization for project package
+*
+*/
+package com.nokia.tracebuilder.engine.project;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * Localization for project package
+ * 
+ */
+class Messages {
+
+	/**
+	 * Bundle name
+	 */
+	private static final String BUNDLE_NAME = "com.nokia.tracebuilder.engine.project.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/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/project/ProjectEngine.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,185 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 project file manager
+*
+*/
+package com.nokia.tracebuilder.engine.project;
+
+import java.io.File;
+import com.nokia.tracebuilder.engine.TraceBuilderEngine;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.TraceBuilderErrorCode;
+import com.nokia.tracebuilder.engine.plugin.TraceAPIPluginManager;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceModel;
+
+/**
+ * Trace project engine
+ * 
+ */
+public final class ProjectEngine extends TraceBuilderEngine {
+
+	/**
+	 * Parameters for create project
+	 * 
+	 */
+	private class CreateProjectParameters {
+
+		/**
+		 * Trace project path
+		 */
+		String traceProjectPath;
+
+		/**
+		 * Trace project name
+		 */
+		String traceProjectName;
+
+		/**
+		 * Trace project ID
+		 */
+		int traceProjectID;
+
+	}
+
+	/**
+	 * Default project ID
+	 */
+	private static final int DEFAULT_PROJECT_ID = 0x0; // CodForChk_Dis_Magic
+
+	/**
+	 * Trace model
+	 */
+	private TraceModel model;
+
+	/**
+	 * Trace directory name
+	 */
+	public static String traceFolderName;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            the trace model
+	 */
+	public ProjectEngine(TraceModel model) {
+		this.model = model;
+	}
+
+	/**
+	 * Opens trace project
+	 * 
+	 * @param projectPath
+	 *            the path to the project to be opened
+	 * @param modelName
+	 *            the name for the model or null to use directory name
+	 * @throws TraceBuilderException
+	 *             if opening fails
+	 */
+	public void openTraceProject(String projectPath, String modelName)
+			throws TraceBuilderException {
+		if (projectPath != null) {
+			CreateProjectParameters parameters = createParameters(projectPath,
+					modelName);
+
+			// Create empty project
+			if (model.getExtension(TraceBuilderProject.class) == null) {
+				createEmptyProjectFile(parameters);
+			}
+		} else {
+			
+			// If fileName is null, there's no open source files. In
+			// that the project cannot be created
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.SOURCE_NOT_OPEN);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderEngine#projectOpened()
+	 */
+	@Override
+	public void projectOpened() {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderEngine#projectClosed()
+	 */
+	@Override
+	public void projectClosed() {
+		model.removeExtensions(TraceBuilderProject.class);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderEngine#exportProject()
+	 */
+	@Override
+	public void exportProject() {
+	}
+
+	/**
+	 * Creates the parameters for new project
+	 * 
+	 * @param projectPath
+	 *            the project path
+	 * @param projectName
+	 *            the name for the project
+	 * @return the parameters
+	 */
+	private CreateProjectParameters createParameters(String projectPath,
+			String projectName) {
+		CreateProjectParameters queryData = new CreateProjectParameters();
+		queryData.traceProjectPath = projectPath + File.separator
+				+ ProjectEngine.traceFolderName;
+		queryData.traceProjectName = projectName;
+		queryData.traceProjectID = DEFAULT_PROJECT_ID;
+		return queryData;
+	}
+
+	/**
+	 * Creates the project file from query results
+	 * 
+	 * @param queryData
+	 *            the query result
+	 */
+	private void createEmptyProjectFile(CreateProjectParameters queryData) {
+		model.setName(queryData.traceProjectName);
+		model.setID(queryData.traceProjectID);
+		String componentName = model.getName();
+		TraceBuilderProject file = new TraceBuilderProject(
+				queryData.traceProjectPath, componentName);
+		createAPI(file);
+	}
+
+	/**
+	 * Creates the project API
+	 * 
+	 * @param file
+	 *            the project file
+	 */
+	private void createAPI(TraceBuilderProject file) {
+		model.addExtension(file);
+		TraceAPIPluginManager plugin = model
+				.getExtension(TraceAPIPluginManager.class);
+		plugin.createDefaultAPI();
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/project/TraceBuilderProject.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,97 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* TraceBuilder project file properties
+*
+*/
+package com.nokia.tracebuilder.engine.project;
+
+import com.nokia.tracebuilder.file.FileUtils;
+import com.nokia.tracebuilder.project.TraceProjectFile;
+import com.nokia.tracebuilder.source.SourceConstants;
+
+/**
+ * TraceBuilder project file properties
+ * 
+ */
+final class TraceBuilderProject extends TraceProjectFile {
+
+	/**
+	 * Title shown in UI
+	 */
+	private static final String TITLE = Messages
+			.getString("TraceBuilderProject.Title"); //$NON-NLS-1$
+
+	/**
+	 * Constructor
+	 * 
+	 * @param absolutePath
+	 *            the path to the file, including file name
+	 */
+	TraceBuilderProject(String absolutePath) {
+		super(absolutePath, true);
+	}
+
+	/**
+	 * Constructor
+	 * 
+	 * @param path
+	 *            the path to the file
+	 * @param name
+	 *            the file name
+	 */
+	TraceBuilderProject(String path, String name) {
+		super(path, name);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.project.TraceProjectFile#getFileExtension()
+	 */
+	@Override
+	protected String getFileExtension() {
+		return null;
+	}
+
+	/**
+	 * Creates a project file path from path and name
+	 * 
+	 * @param path
+	 *            the path
+	 * @param name
+	 *            the file name
+	 * @return the absolute path
+	 */
+	static String createAbsolutePath(String path, String name) {
+		StringBuffer sb = new StringBuffer();
+		sb.append(FileUtils.convertSeparators(
+				SourceConstants.FORWARD_SLASH_CHAR, path, true));
+		sb.append(name);
+		return sb.toString();
+	}
+
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.project.TraceProjectFile#getTitle()
+	 */
+	@Override
+	public String getTitle() {
+		return TITLE;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/project/messages.properties	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,3 @@
+ProjectFileParser.SourceFileDoesNotExist=Source file referenced by traces does not exist
+ProjectFileParser.ErrorWhileProcessing=An error occurred while processing the project file
+TraceBuilderProject.Title=Project File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/project/package.html	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,3 @@
+<html><body>
+TraceBuilder project file management
+</body></html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/ContextBasedTemplate.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 that can be implemented by property dialog templates to support context-specific availability
+*
+*/
+package com.nokia.tracebuilder.engine.propertydialog;
+
+import com.nokia.tracebuilder.source.SourceContext;
+
+/**
+ * Interface that can be implemented by property dialog templates to support
+ * context-specific availability. The code instrumenter will not instrument
+ * functions where this template is not available and this template will not be
+ * shown in "Add Trace" dialog if not available in the function
+ * 
+ */
+public interface ContextBasedTemplate {
+
+	/**
+	 * Checks if this template can be used in the given source context
+	 * 
+	 * @param context
+	 *            the context to be checked
+	 * @return true if context is supported, false if not
+	 */
+	public boolean isAvailableInContext(SourceContext context);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/CreateConstantCallback.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,76 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Callback for add constant property dialog
+*
+*/
+package com.nokia.tracebuilder.engine.propertydialog;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialog;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceConstantTable;
+import com.nokia.tracebuilder.model.TraceConstantTableEntry;
+import com.nokia.tracebuilder.model.TraceModel;
+import com.nokia.tracebuilder.model.TraceModelExtension;
+
+/**
+ * Callback for add constant property dialog
+ * 
+ */
+final class CreateConstantCallback extends PropertyDialogCallback {
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            the trace model
+	 */
+	CreateConstantCallback(TraceModel model) {
+		super(model);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.PropertyDialogManagerCallback#
+	 *      okSelected(com.nokia.tracebuilder.engine.TraceObjectPropertyDialog)
+	 */
+	public void okSelected(TraceObjectPropertyDialog dialog)
+			throws TraceBuilderException {
+		int id = dialog.getID();
+		String name = dialog.getName();
+		String tableName = dialog.getTarget();
+		try {
+			model.startProcessing();
+			TraceConstantTable table = model.findConstantTableByName(tableName);
+			if (table == null) {
+				// If table does not exist, it is created
+				int tableId = model.getNextConstantTableID();
+				model.getVerifier().checkConstantTableProperties(model, null,
+						tableId, tableName);
+				table = model.getFactory().createConstantTable(id, tableName, null);
+			}
+			model.getVerifier().checkConstantProperties(table, null, id, name);
+			TraceModelExtension[] extensions = createExtensions(table, dialog);
+			TraceConstantTableEntry entry = model.getFactory()
+					.createConstantTableEntry(table, id, name, extensions);
+			TraceBuilderGlobals.getTraceBuilder().traceObjectSelected(entry,
+					true, false);
+		} finally {
+			model.processingComplete();
+		}
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/CreateConstantTableCallback.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Callback for add constant table property dialog
+*
+*/
+package com.nokia.tracebuilder.engine.propertydialog;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialog;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceConstantTable;
+import com.nokia.tracebuilder.model.TraceModel;
+import com.nokia.tracebuilder.model.TraceModelExtension;
+
+/**
+ * Callback for add constant table property dialog
+ * 
+ */
+final class CreateConstantTableCallback extends PropertyDialogCallback {
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            the trace model
+	 */
+	CreateConstantTableCallback(TraceModel model) {
+		super(model);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.PropertyDialogManagerCallback#
+	 *      okSelected(com.nokia.tracebuilder.engine.TraceObjectPropertyDialog)
+	 */
+	public void okSelected(TraceObjectPropertyDialog dialog)
+			throws TraceBuilderException {
+		int id = dialog.getID();
+		String name = dialog.getName();
+		model.getVerifier().checkConstantTableProperties(model, null, id, name);
+		TraceModelExtension[] extensions = createExtensions(null, dialog);
+		TraceConstantTable table = model.getFactory().createConstantTable(id,
+				name, extensions);
+		TraceBuilderGlobals.getTraceBuilder().traceObjectSelected(table, true, false);
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/CreateGroupCallback.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Callback for add group property dialog
+*
+*/
+package com.nokia.tracebuilder.engine.propertydialog;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialog;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceGroup;
+import com.nokia.tracebuilder.model.TraceModel;
+import com.nokia.tracebuilder.model.TraceModelExtension;
+
+/**
+ * Callback for add group property dialog
+ * 
+ */
+final class CreateGroupCallback extends PropertyDialogCallback {
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            the trace model
+	 */
+	CreateGroupCallback(TraceModel model) {
+		super(model);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.PropertyDialogManagerCallback#
+	 *      okSelected(com.nokia.tracebuilder.engine.TraceObjectPropertyDialog)
+	 */
+	public void okSelected(TraceObjectPropertyDialog dialog)
+			throws TraceBuilderException {
+		int id = dialog.getID();
+		String name = dialog.getName();
+		model.getVerifier().checkTraceGroupProperties(model, null, id, name);
+		TraceModelExtension[] extensions = createExtensions(null, dialog);
+		TraceGroup group = model.getFactory().createTraceGroup(id, name,
+				extensions);
+		TraceBuilderGlobals.getTraceBuilder().traceObjectSelected(group, true, false);
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/CreateParameterCallback.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,87 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Callback for add parameter property dialog
+*
+*/
+package com.nokia.tracebuilder.engine.propertydialog;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialog;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceModel;
+import com.nokia.tracebuilder.model.TraceModelExtension;
+import com.nokia.tracebuilder.model.TraceParameter;
+
+/**
+ * Callback for add parameter property dialog
+ * 
+ */
+final class CreateParameterCallback extends PropertyDialogCallback {
+
+	/**
+	 * Trace parameter is returned after creation
+	 */
+	private TraceParameter parameter;
+
+	/**
+	 * Owning trace
+	 */
+	private Trace trace;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            the trace model
+	 * @param trace
+	 *            the trace where parameter is added
+	 */
+	CreateParameterCallback(TraceModel model, Trace trace) {
+		super(model);
+		this.trace = trace;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.PropertyDialogManagerCallback#
+	 *      okSelected(com.nokia.tracebuilder.engine.TraceObjectPropertyDialog)
+	 */
+	public void okSelected(TraceObjectPropertyDialog dialog)
+			throws TraceBuilderException {
+		int id = dialog.getID();
+		String name = dialog.getName();
+		String type = dialog.getValue();
+		model.getVerifier().checkTraceParameterProperties(trace, null, id,
+				name, type);
+		TraceModelExtension[] extensions = createExtensions(trace, dialog);
+		parameter = model.getFactory().createTraceParameter(trace, id, name,
+				type, extensions);
+		TraceBuilderGlobals.getTraceBuilder().traceObjectSelected(parameter,
+				true, false);
+	}
+
+	/**
+	 * Gets the parameter that was created
+	 * 
+	 * @return the new parameter
+	 */
+	TraceParameter getParameter() {
+		return parameter;
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/CreateTraceCallback.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ * Callback for add trace property dialog
+ *
+ */
+package com.nokia.tracebuilder.engine.propertydialog;
+
+import java.util.List;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialog;
+import com.nokia.tracebuilder.engine.rules.PerformanceEventTemplate;
+import com.nokia.tracebuilder.engine.rules.RuleUtils;
+import com.nokia.tracebuilder.engine.rules.StateTraceTemplate;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceGroup;
+import com.nokia.tracebuilder.model.TraceModel;
+import com.nokia.tracebuilder.model.TraceModelExtension;
+import com.nokia.tracebuilder.project.FormattingUtils;
+
+/**
+ * Callback for add trace property dialog
+ * 
+ */
+final class CreateTraceCallback extends PropertyDialogCallback {
+
+	/**
+	 * New trace
+	 */
+	private Trace trace;
+
+	/**
+	 * List of extensions to be added to the trace
+	 */
+	private List<TraceModelExtension> extensions;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            the trace model
+	 * @param extensions
+	 *            the extensions to be added to the new trace
+	 */
+	CreateTraceCallback(TraceModel model, List<TraceModelExtension> extensions) {
+		super(model);
+		this.extensions = extensions;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.PropertyDialogManagerCallback#
+	 *      okSelected(com.nokia.tracebuilder.engine.TraceObjectPropertyDialog)
+	 */
+	public void okSelected(TraceObjectPropertyDialog dialog)
+			throws TraceBuilderException {
+		String groupName = dialog.getTarget();
+		try {
+			model.startProcessing();
+			TraceGroup group = model.findGroupByName(groupName);
+			if (group == null) {
+				// If group does not exist, it is created
+				int id = FormattingUtils.getGroupID(model, groupName);
+				model.getVerifier().checkTraceGroupProperties(model, null, id,
+						groupName);
+				group = model.getFactory()
+						.createTraceGroup(id, groupName, null);
+			}
+			String name = dialog.getName();
+
+			// In case of Performance Event trace and State trace add prefix and
+			// suffix to trace name
+			if (dialog.getTemplate() instanceof PerformanceEventTemplate) {
+				name = RuleUtils.ENTRY_NAME_PREFIXES[RuleUtils.TYPE_PERF_EVENT]
+						+ name
+						+ RuleUtils.ENTRY_NAME_SUFFIXES[RuleUtils.TYPE_PERF_EVENT];
+			} else if (dialog.getTemplate() instanceof StateTraceTemplate) {
+				name = RuleUtils.ENTRY_NAME_PREFIXES[RuleUtils.TYPE_STATE_TRACE]
+						+ name;
+			}
+
+			String data = dialog.getValue();
+			int id = group.getNextTraceID();
+			group.getModel().getVerifier().checkTraceProperties(group, null,
+					id, name, data);
+			TraceModelExtension[] extArray = createExtensions(group, dialog,
+					extensions);
+			trace = group.getModel().getFactory().createTrace(group, id, name,
+					data, extArray);
+			TraceBuilderGlobals.getTraceBuilder().traceObjectSelected(trace,
+					true, false);
+		} finally {
+			model.processingComplete();
+		}
+	}
+
+	/**
+	 * Gets the trace
+	 * 
+	 * @return trace
+	 */
+	public Trace getTrace() {
+		return trace;
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/DeleteConstantCallback.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,75 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 table entry deletion query processor
+*
+*/
+package com.nokia.tracebuilder.engine.propertydialog;
+
+import com.nokia.tracebuilder.engine.TraceBuilderDialogs.DeleteObjectQueryParameters;
+import com.nokia.tracebuilder.engine.TraceBuilderDialogs.QueryDialogParameters;
+import com.nokia.tracebuilder.engine.TraceBuilderDialogs.QueryDialogType;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceConstantTableEntry;
+import com.nokia.tracebuilder.model.TraceObject;
+
+/**
+ * Constant table entry deletion query processor
+ * 
+ */
+public final class DeleteConstantCallback extends DeleteObjectCallback {
+
+	/**
+	 * Constructor
+	 * 
+	 * @param entry
+	 *            the constant table entry to be removed
+	 */
+	public DeleteConstantCallback(TraceConstantTableEntry entry) {
+		super(entry);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.propertydialog.DeleteObjectCallback#
+	 *      buildQuery(com.nokia.tracebuilder.model.TraceObject)
+	 */
+	@Override
+	protected QueryDialogParameters buildQuery(TraceObject object)
+			throws TraceBuilderException {
+		DeleteObjectQueryParameters params = new DeleteObjectQueryParameters();
+		TraceConstantTableEntry entry = (TraceConstantTableEntry) object;
+		params.objectName = entry.getName();
+		params.ownerName = entry.getTable().getName();
+		params.dialogType = QueryDialogType.DELETE_CONSTANT;
+		return params;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.propertydialog.DeleteObjectCallback#
+	 *      deleteObject(com.nokia.tracebuilder.model.TraceObject,
+	 *      com.nokia.tracebuilder.engine.propertydialog.DeleteObjectCallback.QueryDialogProperties)
+	 */
+	@Override
+	protected void deleteObject(TraceObject object,
+			QueryDialogParameters queryResults) {
+		TraceConstantTableEntry entry = (TraceConstantTableEntry) object;
+		entry.getTable().removeEntry(entry);
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/DeleteConstantTableCallback.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,74 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 table deletion query processor
+*
+*/
+package com.nokia.tracebuilder.engine.propertydialog;
+
+import com.nokia.tracebuilder.engine.TraceBuilderDialogs.DeleteObjectQueryParameters;
+import com.nokia.tracebuilder.engine.TraceBuilderDialogs.QueryDialogParameters;
+import com.nokia.tracebuilder.engine.TraceBuilderDialogs.QueryDialogType;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceConstantTable;
+import com.nokia.tracebuilder.model.TraceObject;
+
+/**
+ * Constant table deletion query processor
+ * 
+ */
+public final class DeleteConstantTableCallback extends DeleteObjectCallback {
+
+	/**
+	 * Constructor
+	 * 
+	 * @param table
+	 *            the table to be deleted
+	 */
+	public DeleteConstantTableCallback(TraceConstantTable table) {
+		super(table);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.propertydialog.DeleteObjectCallback#
+	 *      buildQuery(com.nokia.tracebuilder.model.TraceObject)
+	 */
+	@Override
+	protected QueryDialogParameters buildQuery(TraceObject object)
+			throws TraceBuilderException {
+		TraceConstantTable table = (TraceConstantTable) object;
+		DeleteObjectQueryParameters params = new DeleteObjectQueryParameters();
+		params.objectName = table.getName();
+		params.dialogType = QueryDialogType.DELETE_CONSTANT_TABLE;
+		return params;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.propertydialog.DeleteObjectCallback#
+	 *      deleteObject(com.nokia.tracebuilder.model.TraceObject,
+	 *      com.nokia.tracebuilder.engine.TraceBuilderDialogs.QueryDialogParameters)
+	 */
+	@Override
+	protected void deleteObject(TraceObject object,
+			QueryDialogParameters queryResults) {
+		TraceConstantTable table = (TraceConstantTable) object;
+		table.getModel().removeConstantTable(table);
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/DeleteGroupCallback.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,78 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 deletion query processor
+*
+*/
+package com.nokia.tracebuilder.engine.propertydialog;
+
+import com.nokia.tracebuilder.engine.TraceBuilderDialogs.DeleteObjectQueryParameters;
+import com.nokia.tracebuilder.engine.TraceBuilderDialogs.QueryDialogParameters;
+import com.nokia.tracebuilder.engine.TraceBuilderDialogs.QueryDialogType;
+import com.nokia.tracebuilder.engine.source.SourceEngine;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceGroup;
+import com.nokia.tracebuilder.model.TraceObject;
+
+/**
+ * Group deletion query processor
+ * 
+ */
+public final class DeleteGroupCallback extends DeleteTraceFromSourceCallback {
+
+	/**
+	 * Constructor
+	 * 
+	 * @param group
+	 *            the group to be deleted
+	 * @param sourceEngine
+	 *            the source engine for trace removal
+	 */
+	public DeleteGroupCallback(TraceGroup group, SourceEngine sourceEngine) {
+		super(group, sourceEngine);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.propertydialog.DeleteObjectCallback#
+	 *      buildQuery(com.nokia.tracebuilder.model.TraceObject)
+	 */
+	@Override
+	protected QueryDialogParameters buildQuery(TraceObject object) {
+		DeleteObjectQueryParameters params = new DeleteObjectQueryParameters();
+		params.objectName = object.getName();
+		params.dialogType = QueryDialogType.DELETE_GROUP;
+		return params;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.propertydialog.DeleteObjectCallback#deleteObject(
+	 *      com.nokia.tracebuilder.model.TraceObject,
+	 *      com.nokia.tracebuilder.engine.TraceBuilderDialogs.QueryDialogParameters)
+	 */
+	@Override
+	protected void deleteObject(TraceObject object,
+			QueryDialogParameters queryResults) {
+		TraceGroup group = (TraceGroup) object;
+		for (Trace trace : group) {
+			removeTraceFromSource(trace);
+		}
+		group.getModel().removeGroup(group);
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/DeleteMultipleTracesCallback.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,324 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Deletes multiple traces
+*
+*/
+package com.nokia.tracebuilder.engine.propertydialog;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import com.nokia.tracebuilder.engine.CheckListDialogEntry;
+import com.nokia.tracebuilder.engine.LocationProperties;
+import com.nokia.tracebuilder.engine.TraceBuilderDialogs;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceLocationList;
+import com.nokia.tracebuilder.engine.TraceBuilderDialogs.CheckListDialogParameters;
+import com.nokia.tracebuilder.engine.TraceBuilderDialogs.CheckListDialogType;
+import com.nokia.tracebuilder.engine.TraceBuilderDialogs.QueryDialogParameters;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.TraceBuilderErrorCode;
+import com.nokia.tracebuilder.engine.source.SourceEngine;
+import com.nokia.tracebuilder.engine.source.SourceProperties;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceGroup;
+import com.nokia.tracebuilder.model.TraceModel;
+import com.nokia.tracebuilder.model.TraceObject;
+
+/**
+ * Deletes multiple traces
+ * 
+ */
+public final class DeleteMultipleTracesCallback extends
+		DeleteTraceFromSourceCallback {
+
+	/**
+	 * Instrumentation engine contains sets of instrumented traces
+	 */
+	private InstrumentationEngine instrumentationEngine;
+
+	/**
+	 * Trace model
+	 */
+	private TraceModel model;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            trace model
+	 * @param sourceEngine
+	 *            source engine
+	 * @param instrumentationEngine
+	 *            instrumentation engine
+	 */
+	public DeleteMultipleTracesCallback(TraceModel model,
+			SourceEngine sourceEngine,
+			InstrumentationEngine instrumentationEngine) {
+		super(model, sourceEngine);
+		this.model = model;
+		this.instrumentationEngine = instrumentationEngine;
+	}
+
+	/**
+	 * Shows the delete dialog
+	 * 
+	 * @return the dialog result
+	 * @throws TraceBuilderException
+	 *             if traces cannot be deleted
+	 */
+	@Override
+	public int delete() throws TraceBuilderException {
+		int retval;
+		ArrayList<Trace> traces = new ArrayList<Trace>();
+		showDialog(traces);
+		if (traces.size() > 0) {
+			model.startProcessing();
+			try {
+				for (int i = 0; i < traces.size(); i++) {
+					deleteTrace(traces.get(i));
+				}
+			} finally {
+				model.processingComplete();
+			}
+			retval = TraceBuilderDialogs.OK;
+		} else {
+			retval = TraceBuilderDialogs.CANCEL;
+		}
+		return retval;
+	}
+
+	/**
+	 * Deletes a trace
+	 * 
+	 * @param trace
+	 *            the trace to be deleted
+	 */
+	private void deleteTrace(Trace trace) {
+		removeTraceFromSource(trace);
+		trace.getGroup().removeTrace(trace);
+	}
+
+	/**
+	 * Shows the dialog
+	 * 
+	 * @param traces
+	 *            the list for traces to be removed
+	 * @throws TraceBuilderException
+	 *             if processing fails
+	 */
+	private void showDialog(List<Trace> traces) throws TraceBuilderException {
+		List<CheckListDialogEntry> rootEntries = null;
+		CheckListDialogEntry groups = createGroups();
+		CheckListDialogEntry instrumentations = createInstrumentations(groups);
+		if (instrumentations.hasChildren()) {
+			rootEntries = new ArrayList<CheckListDialogEntry>();
+			rootEntries.add(instrumentations);
+			rootEntries.add(groups);
+		} else if (groups.hasChildren()) {
+			rootEntries = new ArrayList<CheckListDialogEntry>();
+			rootEntries.add(groups);
+		}
+		if (rootEntries != null) {
+			CheckListDialogParameters parameters = buildParameters(instrumentations
+					.hasChildren());
+			parameters.rootItems = rootEntries;
+			parameters.dialogType = CheckListDialogType.DELETE_TRACES;
+			int ret = TraceBuilderGlobals.getDialogs()
+					.showCheckList(parameters);
+			if (ret == TraceBuilderDialogs.OK) {
+				// Deletes the checked traces
+				for (CheckListDialogEntry entry : rootEntries) {
+					addToList(entry, traces);
+				}
+			}
+		} else {
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.NO_TRACES_TO_DELETE);
+		}
+	}
+
+	/**
+	 * Builds the parameter list
+	 * 
+	 * @param hasInstrumentation
+	 *            true if there are instrumentation entries
+	 * @return the list
+	 */
+	private CheckListDialogParameters buildParameters(boolean hasInstrumentation) {
+		CheckListDialogParameters parameters = new CheckListDialogParameters();
+		parameters.expandLevel = 0;
+		parameters.showRoot = hasInstrumentation;
+		return parameters;
+	}
+
+	/**
+	 * Creates instrumentations list
+	 * 
+	 * @param groupRoot
+	 *            the root of groups list
+	 * @return the root entry for instrumentations
+	 */
+	private CheckListDialogEntry createInstrumentations(
+			CheckListDialogEntry groupRoot) {
+		Iterator<String> instrumentations = instrumentationEngine
+				.getInstrumenterIDs();
+		CheckListDialogEntry instrumenterRoot = new CheckListDialogEntry();
+		instrumenterRoot.setObject("Traces from instrumentations"); //$NON-NLS-1$
+		while (instrumentations.hasNext()) {
+			String instrumenterID = instrumentations.next();
+			addInstrumentation(instrumenterRoot, instrumenterID, groupRoot);
+		}
+		return instrumenterRoot;
+	}
+
+	/**
+	 * Adds traces from given instrumentation to the list
+	 * 
+	 * @param entry
+	 *            the root entry for instrumentations
+	 * @param instrumenterID
+	 *            the instrumenter ID
+	 * @param groupRoot
+	 *            the root of groups list
+	 */
+	private void addInstrumentation(CheckListDialogEntry entry,
+			String instrumenterID, CheckListDialogEntry groupRoot) {
+		Iterator<InstrumentedTraceRule> instrumentedTraces = instrumentationEngine
+				.getInstrumentedTraces(instrumenterID);
+		CheckListDialogEntry instrumenterEntry = new CheckListDialogEntry();
+		instrumenterEntry.setObject(instrumenterID);
+		while (instrumentedTraces.hasNext()) {
+			Trace trace = (Trace) instrumentedTraces.next().getOwner();
+			addTrace(instrumenterEntry, trace);
+		}
+		if (instrumenterEntry.hasChildren()) {
+			entry.addChild(instrumenterEntry);
+		}
+	}
+
+	/**
+	 * Adds a trace to given entry
+	 * 
+	 * @param entry
+	 *            the root entry
+	 * @param trace
+	 *            the trace
+	 * @return the trace entry
+	 */
+	private CheckListDialogEntry addTrace(CheckListDialogEntry entry,
+			Trace trace) {
+		CheckListDialogEntry traceEntry = new CheckListDialogEntry();
+
+		TraceLocationList list = trace.getExtension(TraceLocationList.class);
+		if (list != null) {
+			for (LocationProperties loc : list) {
+				String traceLocationFileName = loc.getFileName();
+				Iterator<SourceProperties> sources = TraceBuilderGlobals
+						.getTraceBuilder().getOpenSources();
+				while (sources.hasNext()) {
+					SourceProperties source = sources.next();
+					if (traceLocationFileName.equals(source.getFileName())) {
+						traceEntry.setObject(trace);
+						entry.addChild(traceEntry);
+						break;
+					}
+				}
+			}
+		}
+
+		return traceEntry;
+	}
+
+	/**
+	 * Adds groups to the list
+	 * 
+	 * @return the root of group entries
+	 */
+	private CheckListDialogEntry createGroups() {
+		CheckListDialogEntry groupRoot = new CheckListDialogEntry();
+		groupRoot.setObject("Traces from groups"); //$NON-NLS-1$
+		for (TraceGroup group : model) {
+			addGroup(groupRoot, group);
+		}
+		return groupRoot;
+	}
+
+	/**
+	 * Adds a group to the list
+	 * 
+	 * @param rootEntry
+	 *            the root entry
+	 * @param group
+	 *            the group
+	 */
+	private void addGroup(CheckListDialogEntry rootEntry, TraceGroup group) {
+		CheckListDialogEntry groupEntry = new CheckListDialogEntry();
+		groupEntry.setObject(group);
+		for (Trace trace : group) {
+			addTrace(groupEntry, trace);
+		}
+		if (groupEntry.hasChildren()) {
+			rootEntry.addChild(groupEntry);
+		}
+	}
+
+	/**
+	 * Recursively adds children of given entry to the list of traces to be
+	 * removed
+	 * 
+	 * @param entry
+	 *            an entry
+	 * @param traces
+	 *            the list of traces
+	 */
+	private void addToList(CheckListDialogEntry entry, List<Trace> traces) {
+		if (entry.isChecked() && entry.getObject() instanceof Trace) {
+			traces.add((Trace) entry.getObject());
+		}
+		for (CheckListDialogEntry child : entry) {
+			addToList(child, traces);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.propertydialog.DeleteObjectCallback#
+	 *      buildQuery(com.nokia.tracebuilder.model.TraceObject)
+	 */
+	@Override
+	protected QueryDialogParameters buildQuery(TraceObject object)
+			throws TraceBuilderException {
+		// Not used, this class overrides the delete method
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.propertydialog.DeleteObjectCallback#
+	 *      deleteObject(com.nokia.tracebuilder.model.TraceObject,
+	 *      com.nokia.tracebuilder.engine.TraceBuilderDialogs.QueryDialogParameters)
+	 */
+	@Override
+	protected void deleteObject(TraceObject object,
+			QueryDialogParameters queryResults) {
+		// Not used, this class overrides the delete method
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/DeleteObjectCallback.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 trace object deletion
+*
+*/
+package com.nokia.tracebuilder.engine.propertydialog;
+
+import com.nokia.tracebuilder.engine.TraceBuilderDialogs;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceBuilderDialogs.QueryDialogParameters;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceObject;
+
+/**
+ * Base class for trace object deletion
+ * 
+ */
+public abstract class DeleteObjectCallback {
+
+	/**
+	 * The object to be deleted
+	 */
+	private TraceObject object;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param object
+	 *            the object to be deleted
+	 */
+	DeleteObjectCallback(TraceObject object) {
+		this.object = object;
+	}
+
+	/**
+	 * Deletes the object.
+	 * 
+	 * @return TraceBuilderDialogs.YES if object was deleted
+	 * @throws TraceBuilderException
+	 *             if object cannot be deleted
+	 */
+	public int delete() throws TraceBuilderException {
+		int res = PropertyDialogCallback.showLocationConfirmationQuery(object);
+		if (res == TraceBuilderDialogs.OK) {
+			QueryDialogParameters props = buildQuery(object);
+			res = TraceBuilderGlobals.getDialogs().showConfirmationQuery(props);
+			if (res == TraceBuilderDialogs.OK) {
+				deleteObject(object, props);
+			}
+		}
+		return res;
+	}
+
+	/**
+	 * Builds the query that is shown to the user before deleting
+	 * 
+	 * @param object
+	 *            the object to be deleted
+	 * @return the dialog parameters
+	 * @throws TraceBuilderException
+	 *             if the object cannot be deleted
+	 */
+	protected abstract QueryDialogParameters buildQuery(TraceObject object)
+			throws TraceBuilderException;
+
+	/**
+	 * Called to delete the object if user selected YES to the query
+	 * 
+	 * @param object
+	 *            the object to be deleted
+	 * @param queryResults
+	 *            the query results, modified by the UI
+	 */
+	protected abstract void deleteObject(TraceObject object,
+			QueryDialogParameters queryResults);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/DeleteParameterCallback.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,140 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 parameter deletion query processor
+*
+*/
+package com.nokia.tracebuilder.engine.propertydialog;
+
+import java.util.Iterator;
+
+import com.nokia.tracebuilder.engine.LocationProperties;
+import com.nokia.tracebuilder.engine.TraceLocation;
+import com.nokia.tracebuilder.engine.TraceLocationList;
+import com.nokia.tracebuilder.engine.TraceBuilderDialogs.DeleteObjectQueryParameters;
+import com.nokia.tracebuilder.engine.TraceBuilderDialogs.QueryDialogParameters;
+import com.nokia.tracebuilder.engine.TraceBuilderDialogs.QueryDialogType;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.TraceBuilderErrorCode;
+import com.nokia.tracebuilder.engine.source.TraceFormattingRule;
+import com.nokia.tracebuilder.engine.source.TraceParameterFormattingRule;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceObject;
+import com.nokia.tracebuilder.model.TraceParameter;
+import com.nokia.tracebuilder.rules.TraceParameterRestrictionRule;
+
+/**
+ * Trace parameter deletion query processor
+ * 
+ */
+public final class DeleteParameterCallback extends DeleteObjectCallback {
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parameter
+	 *            the parameter to be deleted
+	 */
+	public DeleteParameterCallback(TraceParameter parameter) {
+		super(parameter);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.propertydialog.DeleteObjectCallback#
+	 *      buildQuery(com.nokia.tracebuilder.model.TraceObject)
+	 */
+	@Override
+	protected QueryDialogParameters buildQuery(TraceObject object)
+			throws TraceBuilderException {
+		TraceParameter parameter = (TraceParameter) object;
+		// If the owner prevents parameter deletion, it is not deleted
+		TraceParameterRestrictionRule rule = parameter.getTrace().getExtension(
+				TraceParameterRestrictionRule.class);
+		DeleteObjectQueryParameters params;
+		if (rule == null || rule.canRemoveParameters()) {
+			params = new DeleteObjectQueryParameters();
+			params.dialogType = QueryDialogType.DELETE_PARAMETER;
+			params.objectName = parameter.getName();
+			params.ownerName = parameter.getTrace().getName();
+		} else {
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.PARAMETER_REMOVE_NOT_ALLOWED);
+		}
+		return params;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.propertydialog.DeleteObjectCallback#
+	 *      deleteObject(com.nokia.tracebuilder.model.TraceObject,
+	 *      com.nokia.tracebuilder.engine.TraceBuilderDialogs.QueryDialogParameters)
+	 */
+	@Override
+	protected void deleteObject(TraceObject object,
+			QueryDialogParameters queryResults) {
+		TraceParameter parameter = (TraceParameter) object;
+		Trace owner = parameter.getTrace();
+		Iterator<TraceParameter> parameters = owner.getParameters();
+		int index = 0;
+		boolean found = false;
+		// Calculates the index of the parameter in source
+		while (parameters.hasNext() && !found) {
+			TraceParameter param = parameters.next();
+			TraceParameterFormattingRule rule = param
+					.getExtension(TraceParameterFormattingRule.class);
+			if (rule == null || rule.isShownInSource()) {
+				// Only parameters that are shown in source are checked
+				if (parameter == param) {
+					found = true;
+				} else {
+					index++;
+				}
+			} else {
+				// If the parameter to be removed is not shown in source, there
+				// is no need to update the locations
+				if (parameter == param) {
+					found = true;
+					index = -1;
+				}
+			}
+		}
+		if (found && index >= 0) {
+			// If index in source was found, the parameter lists in locations of
+			// the trace are updated. When the source is updated, the location
+			// gets the correct parameter list
+			TraceLocationList list = owner
+					.getExtension(TraceLocationList.class);
+			if (list != null) {
+				for (LocationProperties loc : list) {
+					((TraceLocation) loc).removeParameterAt(index);
+				}
+			}
+		}
+		TraceFormattingRule rule = owner
+				.getExtension(TraceFormattingRule.class);
+		if (rule == null) {
+			rule = owner.getModel().getExtension(TraceFormattingRule.class);
+		}
+		if (rule != null) {
+			// Remove parameter text from trace text
+			rule.parameterAboutToBeRemoved(parameter, index);
+		}
+		parameter.getTrace().removeParameter(parameter);
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/DeleteTraceCallback.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 deletion query processor
+*
+*/
+package com.nokia.tracebuilder.engine.propertydialog;
+
+import com.nokia.tracebuilder.engine.TraceBuilderDialogs.DeleteObjectQueryParameters;
+import com.nokia.tracebuilder.engine.TraceBuilderDialogs.QueryDialogParameters;
+import com.nokia.tracebuilder.engine.TraceBuilderDialogs.QueryDialogType;
+import com.nokia.tracebuilder.engine.source.SourceEngine;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceGroup;
+import com.nokia.tracebuilder.model.TraceObject;
+
+/**
+ * Trace deletion query processor
+ * 
+ */
+public final class DeleteTraceCallback extends DeleteTraceFromSourceCallback {
+
+	/**
+	 * Constructor
+	 * 
+	 * @param trace
+	 *            the trace to be deleted
+	 * @param sourceEngine
+	 *            the source engine for trace removal
+	 */
+	public DeleteTraceCallback(Trace trace, SourceEngine sourceEngine) {
+		super(trace, sourceEngine);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.propertydialog.DeleteObjectCallback#
+	 *      buildQuery(com.nokia.tracebuilder.model.TraceObject)
+	 */
+	@Override
+	protected QueryDialogParameters buildQuery(TraceObject object) {
+		Trace trace = (Trace) object;
+		TraceGroup group = trace.getGroup();
+		DeleteObjectQueryParameters params = new DeleteObjectQueryParameters();
+		params.objectName = trace.getName();
+		params.ownerName = group.getName();
+		params.dialogType = QueryDialogType.DELETE_TRACE;
+		return params;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.propertydialog.DeleteObjectCallback#
+	 *      deleteObject(com.nokia.tracebuilder.model.TraceObject,
+	 *      com.nokia.tracebuilder.engine.TraceBuilderDialogs.QueryDialogParameters)
+	 */
+	@Override
+	protected void deleteObject(TraceObject object,
+			QueryDialogParameters queryResults) {
+		Trace trace = (Trace) object;
+		removeTraceFromSource(trace);
+		trace.getGroup().removeTrace(trace);
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/DeleteTraceFromSourceCallback.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 deleter classes that remove traces from source file
+*
+*/
+package com.nokia.tracebuilder.engine.propertydialog;
+
+import com.nokia.tracebuilder.engine.LocationProperties;
+import com.nokia.tracebuilder.engine.TraceLocation;
+import com.nokia.tracebuilder.engine.TraceLocationList;
+import com.nokia.tracebuilder.engine.source.SourceEngine;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceObject;
+
+/**
+ * Base class for deleter classes that remove traces from source file
+ * 
+ */
+abstract class DeleteTraceFromSourceCallback extends DeleteObjectCallback {
+
+	/**
+	 * The source engine for trace removal
+	 */
+	private SourceEngine sourceEngine;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param object
+	 *            the object to be removed
+	 * @param sourceEngine
+	 *            the source engine for trace removal
+	 */
+	DeleteTraceFromSourceCallback(TraceObject object, SourceEngine sourceEngine) {
+		super(object);
+		this.sourceEngine = sourceEngine;
+	}
+
+	/**
+	 * Removes a trace from source files
+	 * 
+	 * @param trace
+	 *            the trace to be removed
+	 */
+	protected void removeTraceFromSource(Trace trace) {
+		TraceLocationList list = trace.getExtension(TraceLocationList.class);
+		if (list != null) {
+			for (LocationProperties loc : list) {
+				sourceEngine.removeLocation((TraceLocation) loc);
+			}
+		}
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/InstrumentationEngine.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,326 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Instrumentation manager groups traces that were instrumented within a single run
+*
+*/
+package com.nokia.tracebuilder.engine.propertydialog;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.TraceBuilderErrorCode;
+import com.nokia.tracebuilder.engine.source.SourceEngine;
+import com.nokia.tracebuilder.engine.source.SourceProperties;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceGroup;
+import com.nokia.tracebuilder.model.TraceModel;
+import com.nokia.tracebuilder.model.TraceModelExtension;
+import com.nokia.tracebuilder.model.TraceModelExtensionListener;
+import com.nokia.tracebuilder.model.TraceModelListener;
+import com.nokia.tracebuilder.model.TraceModelResetListener;
+import com.nokia.tracebuilder.model.TraceObject;
+import com.nokia.tracebuilder.source.SourceContext;
+
+/**
+ * Instrumentation engine groups traces that were instrumented within a single
+ * run.
+ * 
+ */
+public final class InstrumentationEngine {
+
+	/**
+	 * Model listener for instrumenter
+	 * 
+	 */
+	private final class InstrumenterModelListener implements TraceModelListener {
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see com.nokia.tracebuilder.model.TraceModelListener#
+		 *      objectAdded(com.nokia.tracebuilder.model.TraceObject,
+		 *      com.nokia.tracebuilder.model.TraceObject)
+		 */
+		public void objectAdded(TraceObject owner, TraceObject object) {
+		}
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see com.nokia.tracebuilder.model.TraceModelListener#
+		 *      objectCreationComplete(com.nokia.tracebuilder.model.TraceObject)
+		 */
+		public void objectCreationComplete(TraceObject object) {
+		}
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see com.nokia.tracebuilder.model.TraceModelListener#
+		 *      objectRemoved(com.nokia.tracebuilder.model.TraceObject,
+		 *      com.nokia.tracebuilder.model.TraceObject)
+		 */
+		public void objectRemoved(TraceObject owner, TraceObject object) {
+			if (object instanceof Trace) {
+				removeInstrumentedTrace(object);
+			} else if (object instanceof TraceGroup) {
+				Iterator<Trace> itr = ((TraceGroup) object).getTraces();
+				while (itr.hasNext()) {
+					removeInstrumentedTrace(itr.next());
+				}
+			}
+		}
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see com.nokia.tracebuilder.model.TraceModelListener#
+		 *      propertyUpdated(com.nokia.tracebuilder.model.TraceObject, int)
+		 */
+		public void propertyUpdated(TraceObject object, int property) {
+		}
+
+	}
+
+	/**
+	 * Extension listener for instrumenter
+	 * 
+	 */
+	private final class InstrumenterExtensionListener implements
+			TraceModelExtensionListener {
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see com.nokia.tracebuilder.model.TraceModelExtensionListener#
+		 *      extensionAdded(com.nokia.tracebuilder.model.TraceObject,
+		 *      com.nokia.tracebuilder.model.TraceModelExtension)
+		 */
+		public void extensionAdded(TraceObject object,
+				TraceModelExtension extension) {
+			if (extension instanceof InstrumentedTraceRule) {
+				addInstrumentedTrace((InstrumentedTraceRule) extension);
+			}
+		}
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see com.nokia.tracebuilder.model.TraceModelExtensionListener#
+		 *      extensionRemoved(com.nokia.tracebuilder.model.TraceObject,
+		 *      com.nokia.tracebuilder.model.TraceModelExtension)
+		 */
+		public void extensionRemoved(TraceObject object,
+				TraceModelExtension extension) {
+			if (extension instanceof InstrumentedTraceRule) {
+				removeInstrumentedTrace((InstrumentedTraceRule) extension);
+			}
+		}
+
+	}
+
+	/**
+	 * Clears the instrumenter IDs when model is reset
+	 * 
+	 */
+	private final class InstrumenterModelResetListener implements
+			TraceModelResetListener {
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see com.nokia.tracebuilder.model.TraceModelResetListener#modelReset()
+		 */
+		public void modelReset() {
+			clearInstrumentation();
+		}
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see com.nokia.tracebuilder.model.TraceModelResetListener#modelResetting()
+		 */
+		public void modelResetting() {
+		}
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see com.nokia.tracebuilder.model.TraceModelResetListener#modelValid(boolean)
+		 */
+		public void modelValid(boolean valid) {
+		}
+	}
+
+	/**
+	 * List of instrumented traces
+	 */
+	private HashMap<String, List<InstrumentedTraceRule>> instrumentedTraces;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            the trace model
+	 */
+	public InstrumentationEngine(TraceModel model) {
+		model.addResetListener(new InstrumenterModelResetListener());
+		model.addModelListener(new InstrumenterModelListener());
+		model.addExtensionListener(new InstrumenterExtensionListener());
+	}
+
+	/**
+	 * Gets a unique ID for instrumentation
+	 * 
+	 * @return instrumenter ID
+	 */
+	public String getNewInstrumenterID() {
+		SimpleDateFormat format = new SimpleDateFormat("yy-MMM-dd, hh:mm:ss"); //$NON-NLS-1$
+		return format.format(Calendar.getInstance().getTime());
+	}
+
+	/**
+	 * Checks that there are source files that can be instrumented
+	 * 
+	 * @param sourceEngine
+	 *            the source engine
+	 * @throws TraceBuilderException
+	 *             if sources are not valid
+	 */
+	public void checkSourceFunctions(SourceEngine sourceEngine)
+			throws TraceBuilderException {
+		Iterator<SourceProperties> sources = sourceEngine.getSources();
+		if (sources.hasNext()) {
+			boolean hasFunctions = false;
+			while (!hasFunctions && sources.hasNext()) {
+				SourceProperties source = sources.next();
+				Iterator<SourceContext> contexts = source.getSourceEditor()
+						.getContexts();
+				if (contexts.hasNext()) {
+					hasFunctions = true;
+				}
+			}
+			if (!hasFunctions) {
+				throw new TraceBuilderException(
+						TraceBuilderErrorCode.NO_FUNCTIONS_TO_INSTRUMENT);
+			}
+		} else {
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.SOURCE_NOT_OPEN);
+		}
+	}
+
+	/**
+	 * Instrumented trace was added to the model
+	 * 
+	 * @param rule
+	 *            the trace rule
+	 */
+	private void addInstrumentedTrace(InstrumentedTraceRule rule) {
+		if (instrumentedTraces == null) {
+			instrumentedTraces = new HashMap<String, List<InstrumentedTraceRule>>();
+		}
+		List<InstrumentedTraceRule> list = instrumentedTraces.get(rule
+				.getInstrumenterID());
+		if (list == null) {
+			list = new ArrayList<InstrumentedTraceRule>();
+			instrumentedTraces.put(rule.getInstrumenterID(), list);
+		}
+		list.add(rule);
+	}
+
+	/**
+	 * Instrumented trace was removed
+	 * 
+	 * @param rule
+	 *            the trace rule
+	 */
+	private void removeInstrumentedTrace(InstrumentedTraceRule rule) {
+		if (instrumentedTraces != null) {
+			List<InstrumentedTraceRule> list = instrumentedTraces.get(rule
+					.getInstrumenterID());
+			if (list != null) {
+				list.remove(rule);
+				if (list.isEmpty()) {
+					instrumentedTraces.remove(rule.getInstrumenterID());
+				}
+			}
+		}
+	}
+
+	/**
+	 * Checks if a trace contains the InstrumentedTraceRule extension and
+	 * removes it from the list if it does
+	 * 
+	 * @param trace
+	 *            the trace
+	 */
+	private void removeInstrumentedTrace(TraceObject trace) {
+		InstrumentedTraceRule rule = trace
+				.getExtension(InstrumentedTraceRule.class);
+		if (rule != null) {
+			removeInstrumentedTrace(rule);
+		}
+	}
+
+	/**
+	 * Removes all instrumented traces from the list
+	 */
+	private void clearInstrumentation() {
+		if (instrumentedTraces != null) {
+			instrumentedTraces.clear();
+		}
+	}
+
+	/**
+	 * Gets the instrumentation ID list
+	 * 
+	 * @return the instrumentation IDs
+	 */
+	Iterator<String> getInstrumenterIDs() {
+		Set<String> set;
+		if (instrumentedTraces != null) {
+			set = instrumentedTraces.keySet();
+		} else {
+			set = Collections.emptySet();
+		}
+		return set.iterator();
+	}
+
+	/**
+	 * Gets the instrumented traces for given ID
+	 * 
+	 * @param instrumenterID
+	 *            the instrumenter ID
+	 * @return instrumented trace list
+	 */
+	Iterator<InstrumentedTraceRule> getInstrumentedTraces(String instrumenterID) {
+		List<InstrumentedTraceRule> list;
+		if (instrumentedTraces != null) {
+			list = instrumentedTraces.get(instrumenterID);
+		} else {
+			list = Collections.emptyList();
+		}
+		return list.iterator();
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/InstrumentedTraceRule.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 that is added to traces created by the instrumentation tool
+*
+*/
+package com.nokia.tracebuilder.engine.propertydialog;
+
+import com.nokia.tracebuilder.model.TraceObjectRule;
+
+/**
+ * Interface that is added to traces created by the instrumentation tool
+ * 
+ */
+public interface InstrumentedTraceRule extends TraceObjectRule {
+
+	/**
+	 * Gets the ID of the instrumenter that created this trace
+	 * 
+	 * @return the instrumenter ID
+	 */
+	public String getInstrumenterID();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/Messages.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Localization for property dialog package
+*
+*/
+package com.nokia.tracebuilder.engine.propertydialog;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * Localization for property dialog package
+ * 
+ */
+class Messages {
+
+	/**
+	 * Bundle name
+	 */
+	private static final String BUNDLE_NAME = "com.nokia.tracebuilder.engine.propertydialog.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/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/PropertyDialogCallback.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,239 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 dialog manager callbacks
+*
+*/
+package com.nokia.tracebuilder.engine.propertydialog;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import com.nokia.tracebuilder.engine.LastKnownLocationList;
+import com.nokia.tracebuilder.engine.TraceBuilderDialogs;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialog;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialogFlag;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate;
+import com.nokia.tracebuilder.engine.TraceBuilderDialogs.QueryDialogParameters;
+import com.nokia.tracebuilder.engine.TraceBuilderDialogs.QueryDialogType;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.TraceBuilderErrorCode;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceGroup;
+import com.nokia.tracebuilder.model.TraceModel;
+import com.nokia.tracebuilder.model.TraceModelExtension;
+import com.nokia.tracebuilder.model.TraceObject;
+import com.nokia.tracebuilder.model.TraceParameter;
+import com.nokia.tracebuilder.rules.SingletonParameterRule;
+
+/**
+ * Base class for property dialog manager callbacks
+ * 
+ */
+abstract class PropertyDialogCallback implements PropertyDialogEngineCallback {
+
+	/**
+	 * Trace model
+	 */
+	protected TraceModel model;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            the trace model
+	 */
+	PropertyDialogCallback(TraceModel model) {
+		this.model = model;
+	}
+
+	/**
+	 * Shows a location confirmation query
+	 * 
+	 * @param root
+	 *            the root trace object
+	 * @return YES / NO
+	 */
+	static int showLocationConfirmationQuery(TraceObject root) {
+		int queryResult = TraceBuilderDialogs.OK;
+		boolean hasLocations;
+		if (root instanceof TraceModel) {
+			hasLocations = checkModelForLocations((TraceModel) root);
+		} else if (root instanceof TraceGroup) {
+			hasLocations = checkGroupForLocations((TraceGroup) root);
+		} else if (root instanceof Trace) {
+			hasLocations = checkTraceForLocations((Trace) root);
+		} else if (root instanceof TraceParameter) {
+			hasLocations = checkTraceForLocations(((TraceParameter) root)
+					.getTrace());
+		} else {
+			hasLocations = false;
+		}
+		if (hasLocations) {
+			QueryDialogParameters params = new QueryDialogParameters();
+			params.dialogType = QueryDialogType.UPDATE_WHEN_SOURCE_NOT_OPEN;
+			queryResult = TraceBuilderGlobals.getDialogs()
+					.showConfirmationQuery(params);
+		}
+		return queryResult;
+	}
+
+	/**
+	 * Checks a trace for last known locations
+	 * 
+	 * @param trace
+	 *            the trace
+	 * @return true if there are last known locations
+	 */
+	private static boolean checkTraceForLocations(Trace trace) {
+		boolean hasLocations = false;
+		LastKnownLocationList list = trace
+				.getExtension(LastKnownLocationList.class);
+		if (list != null && list.hasLocations()) {
+			hasLocations = true;
+		}
+		return hasLocations;
+	}
+
+	/**
+	 * Checks a trace group for last known locations
+	 * 
+	 * @param group
+	 *            the group
+	 * @return true if there are last known locations
+	 */
+	private static boolean checkGroupForLocations(TraceGroup group) {
+		boolean hasLocations = false;
+		Iterator<Trace> traceItr = group.getTraces();
+		while (traceItr.hasNext() && !hasLocations) {
+			hasLocations = checkTraceForLocations(traceItr.next());
+		}
+		return hasLocations;
+	}
+
+	/**
+	 * Checks the model for last known locations
+	 * 
+	 * @param model
+	 *            the model
+	 * @return true if there are last known locations
+	 */
+	private static boolean checkModelForLocations(TraceModel model) {
+		boolean hasLocations = false;
+		Iterator<TraceGroup> groupItr = model.getGroups();
+		while (groupItr.hasNext() && !hasLocations) {
+			hasLocations = checkGroupForLocations(groupItr.next());
+		}
+		return hasLocations;
+	}
+
+	/**
+	 * Creates the extensions array from the dialog flags, selected template and
+	 * an existing list of extensions
+	 * 
+	 * @param owner
+	 *            the owner of the new object
+	 * @param dialog
+	 *            the dialog
+	 * @param extList
+	 *            the list of extensions
+	 * @return the extensions array
+	 * @throws TraceBuilderException
+	 *             if the extensions list is not valid
+	 */
+	protected TraceModelExtension[] createExtensions(TraceObject owner,
+			TraceObjectPropertyDialog dialog, List<TraceModelExtension> extList)
+			throws TraceBuilderException {
+		TraceModelExtension[] retval = null;
+		ArrayList<TraceModelExtension> extensions = new ArrayList<TraceModelExtension>();
+		List<TraceObjectPropertyDialogFlag> flags = dialog.getFlags();
+		if (flags != null) {
+			for (int i = 0; i < flags.size(); i++) {
+				TraceObjectPropertyDialogFlag flag = flags.get(i);
+				if (flag.isEnabled()) {
+					flag.createExtensions(extensions);
+				}
+			}
+		}
+		TraceObjectPropertyDialogTemplate template = dialog.getTemplate();
+		if (template != null) {
+			template.createExtensions(extensions);
+		}
+		if (extList != null) {
+			extensions.addAll(extList);
+		}
+		checkExtensionValidity(owner, extensions);
+		int extensionCount = extensions.size();
+		if (extensionCount > 0) {
+			retval = new TraceModelExtension[extensionCount];
+			extensions.toArray(retval);
+		}
+		return retval;
+	}
+
+	/**
+	 * Creates the extensions array from the dialog flags and selected template
+	 * 
+	 * @param owner
+	 *            the owner of the new object
+	 * @param dialog
+	 *            the dialog
+	 * @return the extensions array
+	 * @throws TraceBuilderException
+	 *             if the extensions list is not valid
+	 */
+	protected TraceModelExtension[] createExtensions(TraceObject owner,
+			TraceObjectPropertyDialog dialog) throws TraceBuilderException {
+		return createExtensions(owner, dialog, null);
+	}
+
+	/**
+	 * Checks the validity of the list of extensions to be added to a new trace
+	 * object
+	 * 
+	 * @param owner
+	 *            the owner of the new trace object
+	 * @param extensions
+	 *            the list of extensions
+	 * @throws TraceBuilderException
+	 *             if the extension list is not valid
+	 */
+	private void checkExtensionValidity(TraceObject owner,
+			ArrayList<TraceModelExtension> extensions)
+			throws TraceBuilderException {
+		if (owner instanceof Trace) {
+			for (TraceParameter oldParam : (Trace) owner) {
+				Iterator<SingletonParameterRule> singletons = oldParam
+						.getExtensions(SingletonParameterRule.class);
+				while (singletons.hasNext()) {
+					SingletonParameterRule singleton = singletons.next();
+					for (int i = 0; i < extensions.size(); i++) {
+						TraceModelExtension extension = extensions.get(i);
+						if (extension instanceof SingletonParameterRule
+								&& singleton.getClass().equals(
+										extension.getClass())) {
+							throw new TraceBuilderException(
+									TraceBuilderErrorCode.PARAMETER_TEMPLATE_ALREADY_IN_USE,
+									null, null);
+						}
+					}
+				}
+			}
+		}
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/PropertyDialogConfigurationNames.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,142 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Storage names for property dialog
+*
+*/
+package com.nokia.tracebuilder.engine.propertydialog;
+
+/**
+ * Storage names for property dialog
+ * 
+ */
+interface PropertyDialogConfigurationNames {
+
+	/**
+	 * Storage name prefix for all trace flags
+	 */
+	String PROPERTY_DIALOG_TRACE_FLAG = "PropertyDialog.TraceFlag"; //$NON-NLS-1$
+
+	/**
+	 * Storage name prefix for all parameter flags
+	 */
+	String PROPERTY_DIALOG_PARAMETER_FLAG = "PropertyDialog.ParameterFlag"; //$NON-NLS-1$
+
+	/**
+	 * Storage name prefix for all constant table flags
+	 */
+	String PROPERTY_DIALOG_CONSTANT_TABLE_FLAG = "PropertyDialog.ConstantTableFlag"; //$NON-NLS-1$
+
+	/**
+	 * Storage name prefix for all constant flags
+	 */
+	String PROPERTY_DIALOG_CONSTANT_FLAG = "PropertyDialog.ConstantFlag"; //$NON-NLS-1$
+
+	/**
+	 * Storage name prefix for all component flags
+	 */
+	String PROPERTY_DIALOG_COMPONENT_FLAG = "PropertyDialog.ComponentFlag"; //$NON-NLS-1$
+	
+	/**
+	 * Storage name prefix for all instrumenter flags
+	 */
+	String PROPERTY_DIALOG_INSTRUMENTER_FLAG = "PropertyDialog.InstrumenterFlag"; //$NON-NLS-1$
+
+	/**
+	 * Storage name for selected constant table template
+	 */
+	String PROPERTY_DIALOG_CONSTANT_TABLE_TEMPLATE = "PropertyDialog.ConstantTableTemplate"; //$NON-NLS-1$
+
+	/**
+	 * Select component template
+	 */
+	String PROPERTY_DIALOG_SELECT_COMPONENT_TEMPLATE = "PropertyDialog.SelectComponentTemplate"; //$NON-NLS-1$
+	
+	/**
+	 * Storage name for selected constant template
+	 */
+	String PROPERTY_DIALOG_CONSTANT_TEMPLATE = "PropertyDialog.ConstantTemplate"; //$NON-NLS-1$
+
+	/**
+	 * Storage name for selected parameter template
+	 */
+	String PROPERTY_DIALOG_PARAMETER_TEMPLATE = "PropertyDialog.ParameterTemplate"; //$NON-NLS-1$
+
+	/**
+	 * Storage name for selected instrumenter template
+	 */
+	String PROPERTY_DIALOG_INSTRUMENTER_TEMPLATE = "PropertyDialog.InstrumenterTemplate"; //$NON-NLS-1$
+
+	/**
+	 * Storage name for selected trace template
+	 */
+	String PROPERTY_DIALOG_TRACE_TEMPLATE = "PropertyDialog.TraceTemplate"; //$NON-NLS-1$
+
+	/**
+	 * Storage name for constant name
+	 */
+	String PROPERTY_DIALOG_CONSTANT_NAME = "PropertyDialog.ConstantName"; //$NON-NLS-1$
+	
+	/**
+	 * Storage name for component name
+	 */
+	String PROPERTY_DIALOG_COMPONENT_NAME = "PropertyDialog.ComponentName"; //$NON-NLS-1$
+
+	/**
+	 * Storage name for parameter type
+	 */
+	String PROPERTY_DIALOG_PARAMETER_TYPE = "PropertyDialog.ParameterType"; //$NON-NLS-1$
+
+	/**
+	 * Storage name for constant table name
+	 */
+	String PROPERTY_DIALOG_CONSTANT_TABLE_NAME = "PropertyDialog.ConstantTableName"; //$NON-NLS-1$
+
+	/**
+	 * Storage name for instrumenter dialog name format
+	 */
+	String PROPERTY_DIALOG_INSTRUMENTER_NAME_FORMAT = "PropertyDialog.InstrumenterNameFormat"; //$NON-NLS-1$
+
+	/**
+	 * Storage name for instrumenter dialog trace format
+	 */
+	String PROPERTY_DIALOG_INSTRUMENTER_TRACE_FORMAT = "PropertyDialog.InstrumenterTraceFormat"; //$NON-NLS-1$
+
+	/**
+	 * Storage name for parameter name
+	 */
+	String PROPERTY_DIALOG_PARAMETER_NAME = "PropertyDialog.ParameterName"; //$NON-NLS-1$
+
+	/**
+	 * Storage name for trace text
+	 */
+	String PROPERTY_DIALOG_TRACE_TEXT = "PropertyDialog.TraceText"; //$NON-NLS-1$
+
+	/**
+	 * Storage name for trace name
+	 */
+	String PROPERTY_DIALOG_TRACE_NAME = "PropertyDialog.TraceName"; //$NON-NLS-1$
+
+	/**
+	 * Storage name for target group in "Add Trace" dialog
+	 */
+	String PROPERTY_DIALOG_TRACE_GROUP = "PropertyDialog.TraceGroup"; //$NON-NLS-1$
+
+	/**
+	 * Storage name for target group in "Instrumenter" dialog
+	 */
+	String PROPERTY_DIALOG_INSTRUMENTER_TRACE_GROUP = "PropertyDialog.InstrumenterTraceGroup"; //$NON-NLS-1$
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/PropertyDialogEnabler.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,166 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 Builder
+*
+*/
+package com.nokia.tracebuilder.engine.propertydialog;
+
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialogEnabler;
+import com.nokia.tracebuilder.model.TraceObject;
+
+/**
+ * Property dialog enabler interface implementation. This is used with the "Add"
+ * methods of the property dialog manager, but is not added to the objects
+ * created by them.
+ * 
+ */
+public final class PropertyDialogEnabler implements
+		TraceObjectPropertyDialogEnabler {
+
+	/**
+	 * ID enabled bit
+	 */
+	public static final int ENABLE_ID = 0x1; // CodForChk_Dis_Magic
+
+	/**
+	 * Name enabled bit
+	 */
+	public static final int ENABLE_NAME = 0x2; // CodForChk_Dis_Magic
+
+	/**
+	 * Value enabled bit
+	 */
+	public static final int ENABLE_VALUE = 0x4; // CodForChk_Dis_Magic
+
+	/**
+	 * Type enabled bit
+	 */
+	public static final int ENABLE_TYPE = 0x8; // CodForChk_Dis_Magic
+
+	/**
+	 * Template enabled bit
+	 */
+	public static final int ENABLE_TEMPLATE = 0x10; // CodForChk_Dis_Magic
+
+	/**
+	 * Flags enabled bit
+	 */
+	public static final int ENABLE_FLAGS = 0x20; // CodForChk_Dis_Magic
+	
+	/**
+	 * Target enabled bit
+	 */
+	public static final int ENABLE_TARGET = 0x40; // CodForChk_Dis_Magic	
+
+	/**
+	 * Enable flags
+	 */
+	private int flags;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param flags
+	 *            enabler flags
+	 */
+	public PropertyDialogEnabler(int flags) {
+		this.flags = flags;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogEnabler#isTargetEnabled()
+	 */
+	public boolean isTargetEnabled() {
+		return (flags & ENABLE_TARGET) != 0;
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogEnabler#isIdEnabled()
+	 */
+	public boolean isIdEnabled() {
+		return (flags & ENABLE_ID) != 0;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogEnabler#isNameEnabled()
+	 */
+	public boolean isNameEnabled() {
+		return (flags & ENABLE_NAME) != 0;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogEnabler#isTypeEnabled()
+	 */
+	public boolean isTypeEnabled() {
+		return (flags & ENABLE_TYPE) != 0;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogEnabler#isValueEnabled()
+	 */
+	public boolean isValueEnabled() {
+		return (flags & ENABLE_VALUE) != 0;
+	}
+
+	/**
+	 * Internal flag which tells the property dialog manager to set the
+	 * templates used in "Add" dialog to null if this returns false
+	 * 
+	 * @return true if templates are enabled
+	 */
+	boolean isTemplateEnabled() {
+		return (flags & ENABLE_TEMPLATE) != 0;
+	}
+
+	/**
+	 * Internal flag which tells the property dialog manager to set the flags
+	 * used in "Add" dialog to null if this returns false
+	 * 
+	 * @return true if flags are enabled
+	 */
+	boolean isFlagsEnabled() {
+		return (flags & ENABLE_FLAGS) != 0;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelExtension#getOwner()
+	 */
+	public TraceObject getOwner() {
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelExtension#
+	 *      setOwner(com.nokia.tracebuilder.model.TraceObject)
+	 */
+	public void setOwner(TraceObject owner) {
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/PropertyDialogEngine.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,698 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Control logic for property dialog
+*
+*/
+package com.nokia.tracebuilder.engine.propertydialog;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.nokia.tracebuilder.engine.SourceContextManager;
+import com.nokia.tracebuilder.engine.TraceBuilderConfiguration;
+import com.nokia.tracebuilder.engine.TraceBuilderDialogs;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceLocation;
+import com.nokia.tracebuilder.engine.TraceLocationList;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialog;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialogConfiguration;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialogEnabler;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialogFlag;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.TraceBuilderErrorCode;
+import com.nokia.tracebuilder.engine.utils.TraceUtils;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceConstantTable;
+import com.nokia.tracebuilder.model.TraceConstantTableEntry;
+import com.nokia.tracebuilder.model.TraceGroup;
+import com.nokia.tracebuilder.model.TraceModel;
+import com.nokia.tracebuilder.model.TraceModelExtension;
+import com.nokia.tracebuilder.model.TraceObject;
+import com.nokia.tracebuilder.model.TraceObjectUtils;
+import com.nokia.tracebuilder.model.TraceParameter;
+import com.nokia.tracebuilder.rules.ReadOnlyObjectRule;
+import com.nokia.tracebuilder.rules.TraceParameterRestrictionRule;
+
+/**
+ * Control logic for property dialog. Separated from TraceBuilder, since it was
+ * getting too complex
+ * 
+ */
+public class PropertyDialogEngine implements PropertyDialogConfigurationNames {
+
+	/**
+	 * Properties dialog is used to add and edit trace objects
+	 */
+	private TraceObjectPropertyDialog propertyDialog;
+
+	/**
+	 * Interface which is used to configure the property dialog
+	 */
+	private TraceObjectPropertyDialogConfiguration propertyDialogConfiguration;
+
+	/**
+	 * Property dialog verifier
+	 */
+	private PropertyDialogVerifier propertyDialogVerifier;
+
+	/**
+	 * Trace model
+	 */
+	private TraceModel model;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            the trace model
+	 * @param dialogConfiguration
+	 *            dialog configuration interface
+	 */
+	public PropertyDialogEngine(TraceModel model,
+			TraceObjectPropertyDialogConfiguration dialogConfiguration) {
+		this.model = model;
+		propertyDialogConfiguration = dialogConfiguration;
+		propertyDialogVerifier = new PropertyDialogVerifier(model,
+				propertyDialog);
+	}
+
+	/**
+	 * Changes the property dialog
+	 * 
+	 * @param propertyDialog
+	 *            the new property dialog
+	 */
+	public void setPropertyDialog(TraceObjectPropertyDialog propertyDialog) {
+		this.propertyDialog = propertyDialog;
+		propertyDialogVerifier.setPropertyDialog(propertyDialog);
+	}
+
+	/**
+	 * Shows "Add Trace" dialog.
+	 * 
+	 * @param group
+	 *            group proposal
+	 * @param name
+	 *            name proposal
+	 * @param value
+	 *            value proposal
+	 * @param enabler
+	 *            dialog enabler interface
+	 * @return the new trace
+	 */
+	public Trace showAddTraceDialog(TraceGroup group, String name,
+			String value, PropertyDialogEnabler enabler) {
+		return showAddTraceDialog(group, name, value, null, enabler);
+	}
+
+	/**
+	 * Shows "Add Trace" dialog.
+	 * 
+	 * @param group
+	 *            group proposal
+	 * @param name
+	 *            name proposal
+	 * @param value
+	 *            value proposal
+	 * @param extensions
+	 *            extensions for the next object
+	 * @param enabler
+	 *            dialog enabler interface
+	 * @return the new trace
+	 */
+	public Trace showAddTraceDialog(TraceGroup group, String name,
+			String value, List<TraceModelExtension> extensions,
+			PropertyDialogEnabler enabler) {
+		TraceBuilderConfiguration config = TraceBuilderGlobals
+				.getConfiguration();
+		// If a group has been selected, the selection is set to the dialog
+		int id;
+		if (group != null) {
+			id = group.getNextTraceID();
+		} else {
+			id = 1;
+		}
+		if (name == null) {
+			name = config.getText(PROPERTY_DIALOG_TRACE_NAME);
+		}
+		if (value == null) {
+			value = config.getText(PROPERTY_DIALOG_TRACE_TEXT);
+		}
+		if (group == null) {
+			group = model.findGroupByName(config
+					.getText(PROPERTY_DIALOG_TRACE_GROUP));
+		}
+		name = TraceObjectUtils.modifyDuplicateTraceName(model,
+				TraceUtils.convertName(name)).getData();
+		setAddDialogDefaults(TraceObjectPropertyDialog.ADD_TRACE, id, name,
+				value, group, enabler);
+		propertyDialog.setEnabler(enabler);
+		CreateTraceCallback callback = new CreateTraceCallback(model,
+				extensions);
+		showDialog(callback);
+		return callback.getTrace();
+	}
+
+	/**
+	 * Shows the instrumenter dialog
+	 * 
+	 * @param target
+	 *            the selected group
+	 * @param enabler
+	 *            dialog enabler interface
+	 * @param callback
+	 *            callback processing the instrumentation
+	 */
+	public void showInstrumenterDialog(TraceGroup target,
+			PropertyDialogEnabler enabler, RunInstrumenterCallback callback) {
+		TraceBuilderConfiguration config = TraceBuilderGlobals
+				.getConfiguration();
+		String name = config.getText(PROPERTY_DIALOG_INSTRUMENTER_NAME_FORMAT);
+		if (name == null || name.length() == 0) {
+			name = TraceUtils.getDefaultNameFormat();
+		}
+		String trace = config
+				.getText(PROPERTY_DIALOG_INSTRUMENTER_TRACE_FORMAT);
+		if (trace == null || trace.length() == 0) {
+			trace = TraceUtils.getDefaultTraceFormat();
+		}
+		if (target == null) {
+			target = model.findGroupByName(config
+					.getText(PROPERTY_DIALOG_INSTRUMENTER_TRACE_GROUP));
+		}
+		setAddDialogDefaults(TraceObjectPropertyDialog.INSTRUMENTER, 0, name,
+				trace, target, enabler);
+		SourceContextManager manager = TraceBuilderGlobals
+				.getSourceContextManager();
+		manager.setInstrumenting(true);
+		try {
+			showDialog(callback);
+		} finally {
+			manager.setInstrumenting(false);
+		}
+	}
+
+	/**
+	 * Shows "Add Parameter" dialog
+	 * 
+	 * @param trace
+	 *            owner of the new parameter
+	 * @param enabler
+	 *            dialog enabler interface
+	 * @return the new parameter
+	 * @throws TraceBuilderException
+	 *             if dialog cannot be shown
+	 */
+	public TraceParameter showAddParameterDialog(Trace trace,
+			PropertyDialogEnabler enabler) throws TraceBuilderException {
+		TraceParameter retval = null;
+		// Trace rules are checked first
+		TraceParameterRestrictionRule restriction = trace
+				.getExtension(TraceParameterRestrictionRule.class);
+		ReadOnlyObjectRule readOnly = trace
+				.getExtension(ReadOnlyObjectRule.class);
+		if (readOnly == null
+				&& (restriction == null || restriction.canAddParameters())) {
+			int result = PropertyDialogCallback
+					.showLocationConfirmationQuery(trace);
+			if (result == TraceBuilderDialogs.OK) {
+				retval = internalShowAddParameterDialog(trace, enabler);
+			}
+		} else {
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.PARAMETER_ADD_NOT_ALLOWED);
+		}
+		return retval;
+	}
+
+	/**
+	 * Shows "Select component" dialog
+	 */
+	public void showSelectComponentDialog() {
+
+		if (propertyDialog != null) {
+
+			// Create enabler
+			PropertyDialogEnabler enabler = new PropertyDialogEnabler(
+					PropertyDialogEnabler.ENABLE_TARGET);
+			TraceBuilderConfiguration config = TraceBuilderGlobals
+					.getConfiguration();
+			String name = config.getText(PROPERTY_DIALOG_COMPONENT_NAME);
+			setAddDialogDefaults(TraceObjectPropertyDialog.SELECT_COMPONENT, 0,
+					name, null, model, enabler);
+			// Set default target to be same as previous software component
+			propertyDialog.setTarget(TraceBuilderGlobals
+					.getPreviousSoftwareComponentName());
+			showDialog(new SelectComponentCallback(model));
+		}
+	}
+
+	/**
+	 * Shows "Add Parameter" dialog
+	 * 
+	 * @param trace
+	 *            owner of the new parameter
+	 * @param enabler
+	 *            dialog enabler interface
+	 * @return the new parameter
+	 */
+	private TraceParameter internalShowAddParameterDialog(Trace trace,
+			PropertyDialogEnabler enabler) {
+		TraceBuilderConfiguration config = TraceBuilderGlobals
+				.getConfiguration();
+		int id = trace.getNextParameterID();
+		// Parameter proposal defaults to last used value
+		String name = config.getText(PROPERTY_DIALOG_PARAMETER_NAME);
+		String type = config.getText(PROPERTY_DIALOG_PARAMETER_TYPE);
+		setAddDialogDefaults(TraceObjectPropertyDialog.ADD_PARAMETER, id,
+				TraceObjectUtils.modifyDuplicateParameterName(trace, name)
+						.getData(), null, trace, enabler);
+		propertyDialog.setValue(type);
+		TraceLocationList list = trace.getExtension(TraceLocationList.class);
+		if (list != null && list.hasLocations()) {
+			TraceLocation loc = (TraceLocation) list.iterator().next();
+			if (loc.getParameterCount() > trace.getParameterCount()) {
+				String proposal = loc.getParameter(trace.getParameterCount());
+				if (proposal.length() > 0) {
+					propertyDialog.setName(proposal);
+					propertyDialog.setValue(proposal);
+				}
+			}
+		}
+		CreateParameterCallback callback = new CreateParameterCallback(model,
+				trace);
+		showDialog(callback);
+		return callback.getParameter();
+	}
+
+	/**
+	 * Shows "Add Constant" dialog
+	 * 
+	 * @param table
+	 *            target constant table
+	 * @param enabler
+	 *            dialog enabler interface
+	 */
+	public void showAddConstantDialog(TraceConstantTable table,
+			PropertyDialogEnabler enabler) {
+		TraceBuilderConfiguration config = TraceBuilderGlobals
+				.getConfiguration();
+		String name = config.getText(PROPERTY_DIALOG_CONSTANT_NAME);
+		int id = 0;
+		if (table != null) {
+			id = table.getNextEntryID();
+		}
+		setAddDialogDefaults(TraceObjectPropertyDialog.ADD_CONSTANT, id,
+				TraceObjectUtils.modifyDuplicateConstantName(table, name)
+						.getData(), null, table, enabler);
+		showDialog(new CreateConstantCallback(model));
+	}
+
+	/**
+	 * Shows the "Edit Group" dialog
+	 * 
+	 * @param group
+	 *            group to be edited
+	 */
+	public void showEditGroupDialog(TraceGroup group) {
+		int result = PropertyDialogCallback
+				.showLocationConfirmationQuery(group);
+		if (result == TraceBuilderDialogs.OK) {
+			setEditDialogDefaults(TraceObjectPropertyDialog.EDIT_GROUP, group);
+			showDialog(new UpdateGroupCallback(model, group));
+		}
+	}
+
+	/**
+	 * Shows the "Edit Trace" dialog
+	 * 
+	 * @param trace
+	 *            trace to be edited
+	 */
+	public void showEditTraceDialog(Trace trace) {
+		int result = PropertyDialogCallback
+				.showLocationConfirmationQuery(trace);
+		if (result == TraceBuilderDialogs.OK) {
+			setEditDialogDefaults(TraceObjectPropertyDialog.EDIT_TRACE, trace);
+			propertyDialog.setValue(trace.getTrace());
+			showDialog(new UpdateTraceCallback(model, trace));
+		}
+	}
+
+	/**
+	 * Shows the "Edit Constant Table" dialog
+	 * 
+	 * @param table
+	 *            the table to be edited
+	 */
+	public void showEditConstantTableDialog(TraceConstantTable table) {
+		setEditDialogDefaults(TraceObjectPropertyDialog.EDIT_CONSTANT_TABLE,
+				table);
+		showDialog(new UpdateConstantTableCallback(model, table));
+	}
+
+	/**
+	 * Shows the "Edit Constant" dialog
+	 * 
+	 * @param entry
+	 *            entry to be edited
+	 */
+	public void showEditConstantDialog(TraceConstantTableEntry entry) {
+		setEditDialogDefaults(TraceObjectPropertyDialog.EDIT_CONSTANT, entry);
+		showDialog(new UpdateConstantCallback(model, entry));
+	}
+
+	/**
+	 * Sets the default values for the dialog
+	 * 
+	 * @param dialogType
+	 *            the dialog type
+	 * @param id
+	 *            value for ID field
+	 * @param name
+	 *            value for name field
+	 * @param value
+	 *            value for value field
+	 * @param target
+	 *            the target object
+	 * @param enabler
+	 *            dialog enabler interface
+	 */
+	private void setAddDialogDefaults(int dialogType, int id, String name,
+			String value, TraceObject target, PropertyDialogEnabler enabler) {
+		ArrayList<TraceObjectPropertyDialogFlag> flags = initFlags(dialogType,
+				enabler);
+		ArrayList<TraceObjectPropertyDialogTemplate> templates = initTemplates(
+				dialogType, enabler);
+		TraceObjectPropertyDialogTemplate selectedTemplate = findTemplateByTitle(
+				dialogType, templates);
+		propertyDialog.setVerifier(propertyDialogVerifier);
+		propertyDialog.setTargetObject(target);
+		propertyDialog.setEnabler(enabler);
+		propertyDialog.setDialogType(dialogType);
+		propertyDialog.setFlags(flags);
+		propertyDialog.setTemplates(templates, selectedTemplate);
+		propertyDialog.setID(id);
+		propertyDialog.setName(name);
+		propertyDialog.setValue(value);
+	}
+
+	/**
+	 * Creates the dialog templates array
+	 * 
+	 * @param dialogType
+	 *            the dialog type
+	 * @param enabler
+	 *            the dialog enabler interface
+	 * @return the templates array
+	 */
+	private ArrayList<TraceObjectPropertyDialogTemplate> initTemplates(
+			int dialogType, PropertyDialogEnabler enabler) {
+		ArrayList<TraceObjectPropertyDialogTemplate> templates;
+		if (enabler == null || enabler.isTemplateEnabled()) {
+			templates = new ArrayList<TraceObjectPropertyDialogTemplate>();
+			addViewTemplates(dialogType, templates);
+		} else {
+			// If enabler interface exists and disables templates, the templates
+			// are not added to the dialog
+			templates = null;
+		}
+		return templates;
+	}
+
+	/**
+	 * Creates the dialog flags array
+	 * 
+	 * @param dialogType
+	 *            the dialog type
+	 * @param enabler
+	 *            dialog enabler interface
+	 * @return the flags array
+	 */
+	private ArrayList<TraceObjectPropertyDialogFlag> initFlags(int dialogType,
+			PropertyDialogEnabler enabler) {
+		ArrayList<TraceObjectPropertyDialogFlag> flags;
+		if (enabler == null || enabler.isFlagsEnabled()) {
+			flags = new ArrayList<TraceObjectPropertyDialogFlag>();
+			propertyDialogConfiguration.addViewFlags(flags, dialogType);
+		} else {
+			// If enabler interface exists and disables flags, the flags
+			// are not added to the dialog
+			flags = null;
+		}
+		if (flags != null) {
+			String flagPrefix = null;
+			switch (dialogType) {
+			case TraceObjectPropertyDialog.ADD_TRACE:
+				flagPrefix = PROPERTY_DIALOG_TRACE_FLAG;
+				break;
+			case TraceObjectPropertyDialog.ADD_PARAMETER:
+				flagPrefix = PROPERTY_DIALOG_PARAMETER_FLAG;
+				break;
+			case TraceObjectPropertyDialog.ADD_CONSTANT:
+				flagPrefix = PROPERTY_DIALOG_CONSTANT_FLAG;
+				break;
+			case TraceObjectPropertyDialog.INSTRUMENTER:
+				flagPrefix = PROPERTY_DIALOG_INSTRUMENTER_FLAG;
+				break;
+			}
+			// The flag values are set to what has been stored into preferences
+			if (flagPrefix != null) {
+				TraceBuilderConfiguration config = TraceBuilderGlobals
+						.getConfiguration();
+				for (TraceObjectPropertyDialogFlag flag : flags) {
+					String flagName = flagPrefix + flag.getText();
+					if (config.hasEntry(flagName)) {
+						flag.setEnabled(config.getFlag(flagName));
+					}
+				}
+			}
+		}
+		return flags;
+	}
+
+	/**
+	 * Finds a template from given list by title stored into configuration
+	 * 
+	 * @param dialogType
+	 *            the dialog type
+	 * @param templates
+	 *            the templates list
+	 * @return the template that should be activated
+	 */
+	private TraceObjectPropertyDialogTemplate findTemplateByTitle(
+			int dialogType, List<TraceObjectPropertyDialogTemplate> templates) {
+		TraceBuilderConfiguration config = TraceBuilderGlobals
+				.getConfiguration();
+		String templateTitle = null;
+		switch (dialogType) {
+		case TraceObjectPropertyDialog.ADD_TRACE:
+			templateTitle = config.getText(PROPERTY_DIALOG_TRACE_TEMPLATE);
+			break;
+		case TraceObjectPropertyDialog.ADD_PARAMETER:
+			templateTitle = config.getText(PROPERTY_DIALOG_PARAMETER_TEMPLATE);
+			break;
+		case TraceObjectPropertyDialog.ADD_CONSTANT:
+			templateTitle = config.getText(PROPERTY_DIALOG_CONSTANT_TEMPLATE);
+			break;
+		case TraceObjectPropertyDialog.INSTRUMENTER:
+			templateTitle = config
+					.getText(PROPERTY_DIALOG_INSTRUMENTER_TEMPLATE);
+			break;
+		}
+		// Selects the template which has the title stored into preferences
+		TraceObjectPropertyDialogTemplate template = null;
+		if (templateTitle != null && templates != null) {
+			for (TraceObjectPropertyDialogTemplate temp : templates) {
+				if (temp.getTitle().equals(templateTitle)) {
+					template = temp;
+					break;
+				}
+			}
+		}
+		return template;
+	}
+
+	/**
+	 * Adds the templates to "Add" dialog
+	 * 
+	 * @param dialogType
+	 *            the dialog type
+	 * @param templates
+	 *            the list of templates
+	 */
+	private void addViewTemplates(int dialogType,
+			ArrayList<TraceObjectPropertyDialogTemplate> templates) {
+		propertyDialogConfiguration.addViewTemplates(templates, dialogType);
+		if (dialogType != TraceObjectPropertyDialog.INSTRUMENTER) {
+			// Removes all templates that are not available in current context
+			// Instrumenter affects multiple contexts, so templates are always
+			// available at this point
+			for (int i = 0; i < templates.size(); i++) {
+				TraceObjectPropertyDialogTemplate template = templates.get(i);
+				if (template instanceof ContextBasedTemplate) {
+					if (!((ContextBasedTemplate) template)
+							.isAvailableInContext(TraceBuilderGlobals
+									.getSourceContextManager().getContext())) {
+						templates.remove(i);
+						i--;
+					}
+				}
+			}
+		}
+	}
+
+	/**
+	 * Initializes the edit dialog with values from object
+	 * 
+	 * @param dialogType
+	 *            the dialog type
+	 * @param object
+	 *            the object to be edited
+	 */
+	private void setEditDialogDefaults(int dialogType, TraceObject object) {
+		ArrayList<TraceObjectPropertyDialogFlag> list = new ArrayList<TraceObjectPropertyDialogFlag>();
+		propertyDialogConfiguration.addViewFlags(list, dialogType);
+		propertyDialog.setVerifier(propertyDialogVerifier);
+		propertyDialog.setTargetObject(object);
+		propertyDialog.setEnabler(object
+				.getExtension(TraceObjectPropertyDialogEnabler.class));
+		propertyDialog.setDialogType(dialogType);
+		propertyDialog.setFlags(list);
+		propertyDialog.setTemplates(null, null);
+		propertyDialog.setID(object.getID());
+		propertyDialog.setName(object.getName());
+		propertyDialog.setValue(null);
+	}
+
+	/**
+	 * Shows the property dialog
+	 * 
+	 * @param callback
+	 *            the callback for OK processing
+	 */
+	private void showDialog(PropertyDialogEngineCallback callback) {
+		TraceBuilderErrorCode valid;
+		do {
+			int res = propertyDialog.open();
+			if (res == TraceObjectPropertyDialog.OK) {
+				valid = TraceBuilderErrorCode.OK;
+				try {
+					callback.okSelected(propertyDialog);
+					saveData();
+				} catch (TraceBuilderException e) {
+					valid = (TraceBuilderErrorCode) e.getErrorCode();
+					TraceBuilderGlobals.getEvents().postError(e);
+				}
+			} else {
+				valid = TraceBuilderErrorCode.OK;
+			}
+		} while (valid != TraceBuilderErrorCode.OK);
+	}
+
+	/**
+	 * Saves the data into properties for later use
+	 */
+	private void saveData() {
+		TraceBuilderConfiguration config = TraceBuilderGlobals
+				.getConfiguration();
+		String templateTitle = null;
+		TraceObjectPropertyDialogTemplate template = propertyDialog
+				.getTemplate();
+		// Template is saved based on localized title -> Not so good but works
+		if (template != null) {
+			templateTitle = template.getTitle();
+		}
+		if (templateTitle == null) {
+			templateTitle = ""; //$NON-NLS-1$
+		}
+		String flagPrefix = getFlagPrefix(config, templateTitle);
+		if (flagPrefix != null) {
+			List<TraceObjectPropertyDialogFlag> flags = propertyDialog
+					.getFlags();
+			if (flags != null) {
+				for (int i = 0; i < flags.size(); i++) {
+					TraceObjectPropertyDialogFlag flag = flags.get(i);
+					config.setFlag(flagPrefix + flag.getText(), flag
+							.isEnabled());
+				}
+			}
+		}
+	}
+
+	/**
+	 * Gets the prefix for flags and saves other properties
+	 * 
+	 * @param config
+	 *            the configuration
+	 * @param templateTitle
+	 *            the template title
+	 * @return the prefix
+	 */
+	private String getFlagPrefix(TraceBuilderConfiguration config,
+			String templateTitle) {
+		String flagPrefix = null;
+		// Each dialog type is separately saved
+		switch (propertyDialog.getDialogType()) {
+		case TraceObjectPropertyDialog.ADD_TRACE:
+			config
+					.setText(PROPERTY_DIALOG_TRACE_NAME, propertyDialog
+							.getName());
+			config.setText(PROPERTY_DIALOG_TRACE_TEXT, propertyDialog
+					.getValue());
+			config.setText(PROPERTY_DIALOG_TRACE_TEMPLATE, templateTitle);
+			config.setText(PROPERTY_DIALOG_TRACE_GROUP, propertyDialog
+					.getTarget());
+			flagPrefix = PROPERTY_DIALOG_TRACE_FLAG;
+			break;
+		case TraceObjectPropertyDialog.ADD_PARAMETER:
+			config.setText(PROPERTY_DIALOG_PARAMETER_NAME, propertyDialog
+					.getName());
+			config.setText(PROPERTY_DIALOG_PARAMETER_TYPE, propertyDialog
+					.getValue());
+			config.setText(PROPERTY_DIALOG_PARAMETER_TEMPLATE, templateTitle);
+			flagPrefix = PROPERTY_DIALOG_PARAMETER_FLAG;
+			break;
+		case TraceObjectPropertyDialog.SELECT_COMPONENT:
+			config.setText(PROPERTY_DIALOG_COMPONENT_NAME, propertyDialog
+					.getName());
+			config.setText(PROPERTY_DIALOG_SELECT_COMPONENT_TEMPLATE,
+					templateTitle);
+			flagPrefix = PROPERTY_DIALOG_COMPONENT_FLAG;
+			break;
+		case TraceObjectPropertyDialog.ADD_CONSTANT:
+			config.setText(PROPERTY_DIALOG_CONSTANT_NAME, propertyDialog
+					.getName());
+			config.setText(PROPERTY_DIALOG_CONSTANT_TEMPLATE, templateTitle);
+			flagPrefix = PROPERTY_DIALOG_CONSTANT_FLAG;
+			break;
+		case TraceObjectPropertyDialog.INSTRUMENTER:
+			config.setText(PROPERTY_DIALOG_INSTRUMENTER_NAME_FORMAT,
+					propertyDialog.getName());
+			config.setText(PROPERTY_DIALOG_INSTRUMENTER_TRACE_FORMAT,
+					propertyDialog.getValue());
+			config
+					.setText(PROPERTY_DIALOG_INSTRUMENTER_TEMPLATE,
+							templateTitle);
+			flagPrefix = PROPERTY_DIALOG_INSTRUMENTER_FLAG;
+			config.setText(PROPERTY_DIALOG_INSTRUMENTER_TRACE_GROUP,
+					propertyDialog.getTarget());
+			break;
+		}
+		return flagPrefix;
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/PropertyDialogEngineCallback.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Control logic for property dialog
+*
+*/
+package com.nokia.tracebuilder.engine.propertydialog;
+
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialog;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+
+/**
+ * Callback for property dialog engine
+ * 
+ */
+interface PropertyDialogEngineCallback {
+
+	/**
+	 * Called when OK is selected from the dialog. If this throws an exception,
+	 * an error message is shown to user and the dialog stays open
+	 * 
+	 * @param dialog
+	 *            the property dialog properties
+	 * @throws TraceBuilderException
+	 *             if OK processing fails
+	 */
+	void okSelected(TraceObjectPropertyDialog dialog)
+			throws TraceBuilderException;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/PropertyDialogVerifier.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,264 @@
+/*
+ * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ * Verifies the contents of a property dialog
+ *
+ */
+package com.nokia.tracebuilder.engine.propertydialog;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialog;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialogVerifier;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.TraceBuilderErrorCode;
+import com.nokia.tracebuilder.engine.rules.PerformanceEventTemplate;
+import com.nokia.tracebuilder.engine.rules.StateTraceTemplate;
+import com.nokia.tracebuilder.engine.utils.TraceUtils;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceConstantTable;
+import com.nokia.tracebuilder.model.TraceConstantTableEntry;
+import com.nokia.tracebuilder.model.TraceGroup;
+import com.nokia.tracebuilder.model.TraceModel;
+import com.nokia.tracebuilder.model.TraceObjectPropertyVerifier;
+import com.nokia.tracebuilder.plugin.TraceFormatConstants;
+import com.nokia.tracebuilder.project.FormattingUtils;
+import com.nokia.tracebuilder.project.GroupNameHandlerBase;
+
+/**
+ * Verifies the contents of a property dialog
+ * 
+ */
+final class PropertyDialogVerifier implements TraceObjectPropertyDialogVerifier {
+
+	/**
+	 * Property dialog
+	 */
+	private TraceObjectPropertyDialog propertyDialog;
+
+	/**
+	 * Trace model
+	 */
+	private TraceModel model;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            the trace model
+	 * @param propertyDialog
+	 *            the property dialog to be verified
+	 */
+	PropertyDialogVerifier(TraceModel model,
+			TraceObjectPropertyDialog propertyDialog) {
+		this.propertyDialog = propertyDialog;
+		this.model = model;
+	}
+
+	/**
+	 * Changes the property dialog
+	 * 
+	 * @param propertyDialog
+	 *            new property dialog
+	 */
+	void setPropertyDialog(TraceObjectPropertyDialog propertyDialog) {
+		this.propertyDialog = propertyDialog;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @seecom.nokia.tracebuilder.engine.TraceObjectPropertyDialogVerifier#
+	 * verifyContents()
+	 */
+	public void verifyContents() throws TraceBuilderException {
+		int type = propertyDialog.getDialogType();
+		String target = propertyDialog.getTarget();
+		TraceObjectPropertyVerifier verifier = model.getVerifier();
+		TraceGroup group;
+		TraceConstantTable table;
+		Trace trace;
+		int nextTraceID;
+		switch (type) {
+		case TraceObjectPropertyDialog.ADD_CONSTANT:
+			table = model.findConstantTableByName(target);
+			verifier.checkConstantProperties(table, null, propertyDialog
+					.getID(), propertyDialog.getName());
+			break;
+		case TraceObjectPropertyDialog.EDIT_CONSTANT:
+			TraceConstantTableEntry entry = (TraceConstantTableEntry) propertyDialog
+					.getTargetObject();
+			verifier.checkConstantProperties(entry.getTable(), entry,
+					propertyDialog.getID(), propertyDialog.getName());
+			break;
+		case TraceObjectPropertyDialog.ADD_PARAMETER:
+			trace = (Trace) propertyDialog.getTargetObject();
+			verifier.checkTraceParameterProperties(trace, null, propertyDialog
+					.getID(), propertyDialog.getName(), propertyDialog
+					.getValue());
+			break;
+		case TraceObjectPropertyDialog.ADD_TRACE:
+			nextTraceID = verifyGroupName(target, verifier);
+			group = model.findGroupByName(target);
+			verifier.checkTraceProperties(group, null, nextTraceID, propertyDialog
+					.getName(), propertyDialog.getValue());
+			break;
+		case TraceObjectPropertyDialog.EDIT_TRACE:
+			trace = (Trace) propertyDialog.getTargetObject();
+			verifier.checkTraceProperties(trace.getGroup(), trace,
+					propertyDialog.getID(), propertyDialog.getName(),
+					propertyDialog.getValue());
+			break;
+		case TraceObjectPropertyDialog.EDIT_GROUP:
+			group = model.findGroupByName(target);
+			verifier.checkTraceGroupProperties(model, group, propertyDialog
+					.getID(), propertyDialog.getName());
+			break;
+
+		case TraceObjectPropertyDialog.EDIT_CONSTANT_TABLE:
+			table = model.findConstantTableByName(target);
+			verifier.checkConstantTableProperties(model, table, propertyDialog
+					.getID(), propertyDialog.getName());
+			break;
+		case TraceObjectPropertyDialog.INSTRUMENTER:
+			nextTraceID = verifyGroupName(target, verifier);
+
+			// In case of instrumentation the formatting is verified
+			verifyInstrumentation();
+			break;
+		}
+	}
+
+	/**
+	 * Verify Group Name
+	 * 
+	 * @param groupName
+	 *            the name of the trace group
+	 * @param verifier
+	 *            the verifier
+	 * @return next trace ID
+	 * @throws TraceBuilderException
+	 */
+	private int verifyGroupName(String groupName,
+			TraceObjectPropertyVerifier verifier) throws TraceBuilderException {
+		TraceGroup group;
+		int nextTraceID;
+		preverifyGroupName();
+
+		// If group does not exist, the group properties must also be
+		// checked since it will be created
+		group = model.findGroupByName(groupName);
+		nextTraceID = 1;
+		if (group != null) {
+			nextTraceID = group.getNextTraceID();
+		} else {
+			int groupId = FormattingUtils.getGroupID(model, propertyDialog
+					.getTarget());
+
+			verifier.checkTraceGroupProperties(model, null, groupId,
+					propertyDialog.getTarget());
+		}
+		return nextTraceID;
+	}
+
+	/**
+	 * Preverify group name
+	 * 
+	 * @throws TraceBuilderException
+	 */
+	private void preverifyGroupName() throws TraceBuilderException {
+
+		// Group name TRACE_STATE is allowed only if selected template is State
+		// Trace
+		// Group name TRACE_PERFORMANCE is allowed only if selected template is
+		// Performnce
+		// Event Entry-Exist
+		String groupName = propertyDialog.getTarget();
+		GroupNameHandlerBase groupNameHandler = TraceBuilderGlobals
+				.getGroupNameHandler();
+		String[] defaultGroups = groupNameHandler.getDefaultGroups();
+		if ((!(propertyDialog.getTemplate() instanceof StateTraceTemplate) && groupName
+				.equals(defaultGroups[groupNameHandler.getStateGroupIdIndex()]))
+				|| (!(propertyDialog.getTemplate() instanceof PerformanceEventTemplate) && groupName
+						.equals(defaultGroups[groupNameHandler
+								.getPerformanceGroupIdIndex()]))) {
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.INVALID_GROUP_NAME);
+		}
+	}
+
+	/**
+	 * Verifies that instrumentation dialog contents are valid
+	 * 
+	 * @throws TraceBuilderException
+	 *             if contents are not valid
+	 */
+	private void verifyInstrumentation() throws TraceBuilderException {
+		String nameFormat = propertyDialog.getName();
+		String traceFormat = propertyDialog.getValue();
+		if (nameFormat != null && traceFormat != null) {
+			if (hasFunctionName(nameFormat)) {
+				checkInstrumentationFormat(nameFormat, traceFormat);
+			} else {
+				throw new TraceBuilderException(
+						TraceBuilderErrorCode.TRACE_NAME_FORMAT_MISSING_FUNCTION);
+			}
+		} else {
+			if (nameFormat == null) {
+				throw new TraceBuilderException(
+						TraceBuilderErrorCode.INVALID_TRACE_NAME_FORMAT);
+			}
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.INVALID_TRACE_TEXT_FORMAT);
+		}
+	}
+
+	/**
+	 * Formats the instrumentation dialog contents and checks the formatted data
+	 * 
+	 * @param nameFormat
+	 *            the name format
+	 * @param traceFormat
+	 *            the trace text format
+	 * @throws TraceBuilderException
+	 *             if data is not valid
+	 */
+	private void checkInstrumentationFormat(String nameFormat,
+			String traceFormat) throws TraceBuilderException {
+		// Removes tags and checks the remaining data
+		String name = TraceUtils.formatTrace(nameFormat, "_", "_"); //$NON-NLS-1$ //$NON-NLS-2$
+		String text = TraceUtils.formatTrace(traceFormat, "_", "_"); //$NON-NLS-1$ //$NON-NLS-2$
+		String target = propertyDialog.getTarget();
+		TraceGroup group = model.findGroupByName(target);
+		int id = 1;
+		if (group != null) {
+			id = group.getNextTraceID();
+		}
+		model.getVerifier().checkTraceProperties(group, null, id, name, text);
+	}
+
+	/**
+	 * Checks if the format has the function name
+	 * 
+	 * @param format
+	 *            the format
+	 * @return true if it has the function name
+	 */
+	private boolean hasFunctionName(String format) {
+		String nc = TraceFormatConstants.FORMAT_FUNCTION_NAME_NORMAL_CASE;
+		String uc = TraceFormatConstants.FORMAT_FUNCTION_NAME_UPPER_CASE;
+		return format.contains(nc) || format.contains(uc);
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/RunInstrumenterCallback.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,333 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Dialog callback to process instrumentation
+*
+*/
+package com.nokia.tracebuilder.engine.propertydialog;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import com.nokia.tracebuilder.engine.CheckListDialogEntry;
+import com.nokia.tracebuilder.engine.SourceContextManager;
+import com.nokia.tracebuilder.engine.TraceBuilderDialogs;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialog;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate;
+import com.nokia.tracebuilder.engine.TraceBuilderDialogs.CheckListDialogParameters;
+import com.nokia.tracebuilder.engine.TraceBuilderDialogs.CheckListDialogType;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.StringErrorParameters;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.TraceBuilderErrorCode;
+import com.nokia.tracebuilder.engine.source.SourceEngine;
+import com.nokia.tracebuilder.engine.source.SourceProperties;
+import com.nokia.tracebuilder.engine.utils.TraceUtils;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceGroup;
+import com.nokia.tracebuilder.model.TraceModel;
+import com.nokia.tracebuilder.model.TraceModelExtension;
+import com.nokia.tracebuilder.model.TraceObjectModifier;
+import com.nokia.tracebuilder.model.TraceObjectUtils;
+import com.nokia.tracebuilder.project.FormattingUtils;
+import com.nokia.tracebuilder.source.SourceContext;
+import com.nokia.tracebuilder.source.SourceParser;
+
+/**
+ * Dialog callback to process instrumentation
+ * 
+ */
+public final class RunInstrumenterCallback extends PropertyDialogCallback {
+
+	/**
+	 * Duplicate name changed warning
+	 */
+	private static final String DUPLICATE_NAME_CHANGED = Messages
+			.getString("RunInstrumenterCallback.DuplicateName"); //$NON-NLS-1$
+
+	/**
+	 * Source engine for trace additions
+	 */
+	private SourceEngine sourceEngine;
+
+	/**
+	 * Context manager
+	 */
+	private SourceContextManager contextManager;
+
+	/**
+	 * Instrumenter ID
+	 */
+	private String instrumenterID;
+
+	/**
+	 * Creates a new instrumenter callback
+	 * 
+	 * @param model
+	 *            the trace model
+	 * @param sourceEngine
+	 *            the source engine
+	 * @param contextManager
+	 *            the source context manager
+	 * @param instrumenterID
+	 *            the instrumenter ID
+	 */
+	public RunInstrumenterCallback(TraceModel model, SourceEngine sourceEngine,
+			SourceContextManager contextManager, String instrumenterID) {
+		super(model);
+		this.sourceEngine = sourceEngine;
+		this.contextManager = contextManager;
+		this.instrumenterID = instrumenterID;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.PropertyDialogManagerCallback#
+	 *      okSelected(com.nokia.tracebuilder.engine.TraceObjectPropertyDialog)
+	 */
+	public void okSelected(TraceObjectPropertyDialog dialog)
+			throws TraceBuilderException {
+		String groupName = dialog.getTarget();
+		// If group does not exist, it will be created
+		TraceGroup group = model.findGroupByName(groupName);
+		int groupId = 0;
+		if (group == null) {
+			groupId = FormattingUtils.getGroupID(model, groupName);
+			model.getVerifier().checkTraceGroupProperties(model, null, groupId,
+					groupName);
+		}
+		Iterator<SourceContext> contexts = showFunctionQueryDialog(dialog);
+		if (contexts != null) {
+			String oldCategory = TraceBuilderGlobals.getEvents()
+					.setEventCategory("Instrumenter"); //$NON-NLS-1$
+			contextManager.setInstrumenterID(instrumenterID);
+			model.startProcessing();
+			try {
+				// Group is created if it does not exist
+				if (group == null && contexts.hasNext()) {
+					group = model.getFactory().createTraceGroup(groupId,
+							groupName, null);
+				}
+				while (contexts.hasNext()) {
+					SourceContext context = contexts.next();
+					contextManager.setContext(context);
+					processContext(dialog, group, context);
+				}
+			} finally {
+				model.processingComplete();
+				// These must be reset even if errors occurs
+				contextManager.setContext(null);
+				contextManager.setInstrumenterID(""); //$NON-NLS-1$
+				TraceBuilderGlobals.getEvents().setEventCategory(oldCategory);
+			}
+		}
+	}
+
+	/**
+	 * Shows the function tree view, which can be used to select the functions
+	 * to be instrumented
+	 * 
+	 * @param dialog
+	 *            the property dialog
+	 * @return the iterator of functions to be instrumented
+	 * @throws TraceBuilderException
+	 *             if instrumenter fails
+	 */
+	private Iterator<SourceContext> showFunctionQueryDialog(
+			TraceObjectPropertyDialog dialog) throws TraceBuilderException {
+		Iterator<SourceContext> retval = null;
+		CheckListDialogEntry root = createFunctionQueryDialogTree(dialog);
+		if (root.hasChildren()) {
+			ArrayList<CheckListDialogEntry> rootItems = new ArrayList<CheckListDialogEntry>();
+			rootItems.add(root);
+			CheckListDialogParameters params = new CheckListDialogParameters();
+			params.dialogType = CheckListDialogType.INSTRUMENT_FILES;
+			params.rootItems = rootItems;
+			params.expandLevel = 1;
+			params.showRoot = false;
+			int res = TraceBuilderGlobals.getDialogs().showCheckList(params);
+			if (res == TraceBuilderDialogs.OK) {
+				retval = getCheckedContexts(root);
+			}
+		} else {
+			StringErrorParameters sp = new StringErrorParameters();
+			sp.string = dialog.getTemplate().getTitle();
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.NO_FUNCTIONS_TO_INSTRUMENT_WITH_TEMPLATE,
+					sp);
+		}
+		return retval;
+	}
+
+	/**
+	 * Creates the tree for the query dialog
+	 * 
+	 * @param dialog
+	 *            the property dialog
+	 * @return the root of the tree
+	 */
+	private CheckListDialogEntry createFunctionQueryDialogTree(
+			TraceObjectPropertyDialog dialog) {
+		TraceObjectPropertyDialogTemplate template = dialog.getTemplate();
+		CheckListDialogEntry root = new CheckListDialogEntry();
+		// Tells the dialog to go through children and check those that are
+		// checked
+		root.setChecked(true);
+		for (SourceProperties source : sourceEngine) {
+			ArrayList<String> nonSourceFiles = sourceEngine.getNonSourceFiles();
+			if (!nonSourceFiles.contains(source.getFilePath()+ source.getFileName())) {
+				addSourceToList(template, root, source);
+			}
+		}
+		return root;
+	}
+
+	/**
+	 * Adds a source to the query dialog tree
+	 * 
+	 * @param template
+	 *            the template from the property dialog
+	 * @param root
+	 *            the root entry
+	 * @param source
+	 *            the source properties
+	 */
+	private void addSourceToList(TraceObjectPropertyDialogTemplate template,
+			CheckListDialogEntry root, SourceProperties source) {
+		if (!source.isReadOnly()) {
+			SourceParser parser = source.getSourceEditor();
+			CheckListDialogEntry sourceEntry = new CheckListDialogEntry();
+			sourceEntry.setObject(source.getFileName());
+			Iterator<SourceContext> contexts = parser.getContexts();
+			while (contexts.hasNext()) {
+				addContextToList(template, sourceEntry, contexts.next());
+			}
+			if (sourceEntry.hasChildren()) {
+				root.addChild(sourceEntry);
+			}
+		}
+	}
+
+	/**
+	 * Adds a context to the query dialog tree
+	 * 
+	 * @param template
+	 *            the template from the property dialog
+	 * @param sourceEntry
+	 *            the source where the context is to be added
+	 * @param context
+	 *            the source context to be added
+	 */
+	private void addContextToList(TraceObjectPropertyDialogTemplate template,
+			CheckListDialogEntry sourceEntry, SourceContext context) {
+		boolean available = true;
+		if (template instanceof ContextBasedTemplate) {
+			available = ((ContextBasedTemplate) template)
+					.isAvailableInContext(context);
+		}
+		if (available) {
+			CheckListDialogEntry contextEntry = new CheckListDialogEntry();
+			contextEntry.setObject(context);
+			contextEntry.setChecked(true);
+			sourceEntry.addChild(contextEntry);
+		}
+	}
+
+	/**
+	 * Gets the checked contexts from the query tree
+	 * 
+	 * @param root
+	 *            the root of the tree
+	 * @return iterator of checked contexts
+	 */
+	private Iterator<SourceContext> getCheckedContexts(CheckListDialogEntry root) {
+		ArrayList<SourceContext> contextList = new ArrayList<SourceContext>();
+		for (CheckListDialogEntry entry : root) {
+			for (CheckListDialogEntry context : entry) {
+				if (context.isChecked()) {
+					contextList.add((SourceContext) context.getObject());
+				}
+			}
+		}
+		Iterator<SourceContext> retval;
+		if (!contextList.isEmpty()) {
+			retval = contextList.iterator();
+		} else {
+			retval = null;
+		}
+		return retval;
+	}
+
+	/**
+	 * Processes the given context
+	 * 
+	 * @param dialog
+	 *            the flags from the dialog
+	 * @param group
+	 *            the target trace group
+	 * @param context
+	 *            the context to be processed
+	 */
+	private void processContext(TraceObjectPropertyDialog dialog,
+			TraceGroup group, SourceContext context) {
+		try {
+			int id = group.getNextTraceID();
+			String name = TraceUtils.convertName(formatTrace(dialog.getName(),
+					context));
+			String value = formatTrace(dialog.getValue(), context);
+			TraceObjectModifier nameModifier = TraceObjectUtils
+					.modifyDuplicateTraceName(group.getModel(), name);
+			group.getModel().getVerifier().checkTraceProperties(group, null,
+					id, nameModifier.getData(), value);
+			TraceModelExtension[] extArray = createExtensions(group, dialog);
+			Trace trace = group.getModel().getFactory().createTrace(group, id,
+					nameModifier.getData(), value, extArray);
+			if (nameModifier.hasChanged()) {
+				TraceBuilderGlobals.getEvents().postWarningMessage(
+						DUPLICATE_NAME_CHANGED + name, trace);
+			}
+			sourceEngine.insertTrace(trace, sourceEngine
+					.getSourceOfContext(context), context.getOffset());
+			TraceUtils.multiplyTrace(trace, context.getOffset(), sourceEngine);
+
+			SourceProperties properties = sourceEngine
+					.getSourceOfContext(context);
+			String fileName = context.getFileName();
+			if (fileName != null) {
+				String headerFileName = TraceBuilderGlobals.getHeaderFileName(fileName);
+				sourceEngine.addInclude(properties, headerFileName);
+			}
+
+		} catch (TraceBuilderException e) {
+			TraceBuilderGlobals.getEvents().postError(e);
+		}
+	}
+
+	/**
+	 * Formats the trace specified into instrumenter dialog
+	 * 
+	 * @param format
+	 *            the formatting
+	 * @param context
+	 *            the context where trace is added
+	 * @return the formatted trace
+	 */
+	private String formatTrace(String format, SourceContext context) {
+		String cname = context.getClassName();
+		String fname = context.getFunctionName();
+		return TraceUtils.formatTrace(format, cname, fname);
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/SelectComponentCallback.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Callback for select component dialog
+*
+*/
+package com.nokia.tracebuilder.engine.propertydialog;
+
+import java.util.Iterator;
+
+import com.nokia.tracebuilder.engine.SoftwareComponent;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialog;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceModel;
+
+/**
+ * Callback for select component dialog
+ * 
+ */
+final class SelectComponentCallback extends PropertyDialogCallback {
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            the trace model
+	 */
+	SelectComponentCallback(TraceModel model) {
+		super(model);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.PropertyDialogManagerCallback#
+	 *      okSelected(com.nokia.tracebuilder.engine.TraceObjectPropertyDialog)
+	 */
+	public void okSelected(TraceObjectPropertyDialog dialog)
+			throws TraceBuilderException {
+		int index = 0;
+		String componentName = dialog.getTarget();
+		Iterator<SoftwareComponent> components = TraceBuilderGlobals.getSoftwareComponents();
+		while (components.hasNext()) {
+			SoftwareComponent component = components.next();
+			if (component.getName().equals(componentName)) {
+				TraceBuilderGlobals.setCurrentSoftwareComponentIndex(index);
+				break;
+			}
+			index++;
+		}
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/UpdateConstantCallback.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Callback for update constant property dialog
+*
+*/
+package com.nokia.tracebuilder.engine.propertydialog;
+
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialog;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceConstantTableEntry;
+import com.nokia.tracebuilder.model.TraceModel;
+
+/**
+ * Callback for update constant property dialog
+ * 
+ */
+final class UpdateConstantCallback extends PropertyDialogCallback {
+
+	/**
+	 * The constant table entry to be updated
+	 */
+	private TraceConstantTableEntry entry;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            the trace model
+	 * @param entry
+	 *            the entry to be updated
+	 */
+	UpdateConstantCallback(TraceModel model, TraceConstantTableEntry entry) {
+		super(model);
+		this.entry = entry;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.PropertyDialogManagerCallback#
+	 *      okSelected(com.nokia.tracebuilder.engine.TraceObjectPropertyDialog)
+	 */
+	public void okSelected(TraceObjectPropertyDialog dialog)
+			throws TraceBuilderException {
+		int id = dialog.getID();
+		String name = dialog.getName();
+		entry.getModel().getVerifier().checkConstantProperties(
+				entry.getTable(), entry, id, name);
+		entry.setID(id);
+		entry.setName(name);
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/UpdateConstantTableCallback.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 dialog callback to modify constant tables
+*
+*/
+package com.nokia.tracebuilder.engine.propertydialog;
+
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialog;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceConstantTable;
+import com.nokia.tracebuilder.model.TraceModel;
+
+/**
+ * Property dialog callback to modify constant tables
+ * 
+ */
+final class UpdateConstantTableCallback extends PropertyDialogCallback {
+
+	/**
+	 * The constant table to be updated
+	 */
+	private TraceConstantTable table;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            the trace model
+	 * @param table
+	 *            the constant table to be updated
+	 */
+	UpdateConstantTableCallback(TraceModel model, TraceConstantTable table) {
+		super(model);
+		this.table = table;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.PropertyDialogManagerCallback#
+	 *      okSelected(com.nokia.tracebuilder.engine.TraceObjectPropertyDialog)
+	 */
+	public void okSelected(TraceObjectPropertyDialog dialog)
+			throws TraceBuilderException {
+		String name = dialog.getName();
+		int id = dialog.getID();
+		table.getModel().getVerifier().checkConstantTableProperties(
+				table.getModel(), table, id, name);
+		table.setName(name);
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/UpdateGroupCallback.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Callback for update group property dialog
+*
+*/
+package com.nokia.tracebuilder.engine.propertydialog;
+
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialog;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceGroup;
+import com.nokia.tracebuilder.model.TraceModel;
+
+/**
+ * Callback for update group property dialog
+ * 
+ */
+final class UpdateGroupCallback extends PropertyDialogCallback {
+
+	/**
+	 * The group to be updated
+	 */
+	private TraceGroup group;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            the trace model
+	 * @param group
+	 *            the group to be updated
+	 */
+	UpdateGroupCallback(TraceModel model, TraceGroup group) {
+		super(model);
+		this.group = group;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.PropertyDialogManagerCallback#
+	 *      okSelected(com.nokia.tracebuilder.engine.TraceObjectPropertyDialog)
+	 */
+	public void okSelected(TraceObjectPropertyDialog dialog)
+			throws TraceBuilderException {
+		int id = dialog.getID();
+		String name = dialog.getName();
+		group.getModel().getVerifier().checkTraceGroupProperties(
+				group.getModel(), group, id, name);
+		group.setID(id);
+		group.setName(name);
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/UpdateTraceCallback.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Callback for update trace property dialog
+*
+*/
+package com.nokia.tracebuilder.engine.propertydialog;
+
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialog;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceModel;
+
+/**
+ * Callback for update trace property dialog
+ * 
+ */
+final class UpdateTraceCallback extends PropertyDialogCallback {
+
+	/**
+	 * Trace to be updated
+	 */
+	private Trace trace;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            the trace model
+	 * @param trace
+	 *            the trace to be updated
+	 */
+	UpdateTraceCallback(TraceModel model, Trace trace) {
+		super(model);
+		this.trace = trace;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.PropertyDialogManagerCallback#
+	 *      okSelected(com.nokia.tracebuilder.engine.TraceObjectPropertyDialog)
+	 */
+	public void okSelected(TraceObjectPropertyDialog dialog)
+			throws TraceBuilderException {
+		int id = dialog.getID();
+		String name = dialog.getName();
+		String value = dialog.getValue();
+		trace.getModel().getVerifier().checkTraceProperties(trace.getGroup(),
+				trace, id, name, value);
+		trace.setTrace(value);
+		trace.setID(id);
+		trace.setName(name);
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/messages.properties	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,1 @@
+RunInstrumenterCallback.DuplicateName=Duplicate name changed, original was 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/package.html	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,3 @@
+<html><body>
+Property dialog control logic
+</body></html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertyfile/ComponentElementParser.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Parser for component element
+*
+*/
+package com.nokia.tracebuilder.engine.propertyfile;
+
+import org.w3c.dom.Element;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceModel;
+
+/**
+ * Parser for component element
+ * 
+ */
+final class ComponentElementParser implements PropertyFileElementParser {
+
+	/**
+	 * Property file parser
+	 */
+	private final PropertyFileParser propertyFileParser;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param propertyFileParser
+	 *            the parser
+	 */
+	ComponentElementParser(PropertyFileParser propertyFileParser) {
+		this.propertyFileParser = propertyFileParser;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.propertyfile.PropertyFileElementParser#
+	 *      parse(java.lang.Object, org.w3c.dom.Element)
+	 */
+	public void parse(Object owner, Element element)
+			throws TraceBuilderException {
+		// Adds the properties directly to the model
+		TraceModel model = TraceBuilderGlobals.getTraceModel();
+		TraceObjectPropertyListImpl propertyList = model
+				.getExtension(TraceObjectPropertyListImpl.class);
+		if (propertyList == null) {
+			propertyList = new TraceObjectPropertyListImpl();
+			model.addExtension(propertyList);
+		}
+		propertyFileParser.parseChildren(propertyList, element);
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertyfile/DocumentElementWrapper.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Extension wrapper for XML document element
+*
+*/
+package com.nokia.tracebuilder.engine.propertyfile;
+
+import org.w3c.dom.Element;
+
+import com.nokia.tracebuilder.model.TraceModelExtension;
+import com.nokia.tracebuilder.model.TraceObject;
+
+/**
+ * Extension wrapper for XML document element
+ * 
+ */
+final class DocumentElementWrapper implements TraceModelExtension {
+
+	/**
+	 * Owner
+	 */
+	private TraceObject owner;
+
+	/**
+	 * Wrapped element
+	 */
+	private Element element;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param element
+	 *            the document element
+	 */
+	DocumentElementWrapper(Element element) {
+		this.element = element;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelExtension#getOwner()
+	 */
+	public TraceObject getOwner() {
+		return owner;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelExtension#setOwner(com.nokia.tracebuilder.model.TraceObject)
+	 */
+	public void setOwner(TraceObject owner) {
+		this.owner = owner;
+	}
+
+	/**
+	 * Gets the element
+	 * 
+	 * @return the element
+	 */
+	Element getElement() {
+		return element;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertyfile/EnumElementParser.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,70 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Parser for enum element
+*
+*/
+package com.nokia.tracebuilder.engine.propertyfile;
+
+import org.w3c.dom.Element;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceConstantTable;
+import com.nokia.tracebuilder.model.TraceModel;
+import com.nokia.tracebuilder.model.TraceModelExtension;
+
+/**
+ * Parser for enum element
+ * 
+ */
+final class EnumElementParser implements PropertyFileElementParser {
+
+	/**
+	 * Property file parser
+	 */
+	private final PropertyFileParser propertyFileParser;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param propertyFileParser
+	 *            the parser
+	 */
+	EnumElementParser(PropertyFileParser propertyFileParser) {
+		this.propertyFileParser = propertyFileParser;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.propertyfile.PropertyFileElementParser#
+	 *      parse(java.lang.Object, org.w3c.dom.Element)
+	 */
+	public void parse(Object owner, Element element)
+			throws TraceBuilderException {
+		TraceModel model = TraceBuilderGlobals.getTraceModel();
+		String name = element
+				.getAttribute(PropertyFileConstants.NAME_ATTRIBUTE);
+		int id = model.getNextConstantTableID();
+		model.getVerifier().checkConstantTableProperties(model, null, id, name);
+		// Document element reference is stored to the model
+		TraceModelExtension[] exts = new TraceModelExtension[] { new DocumentElementWrapper(
+				element) };
+		TraceConstantTable table = model.getFactory().createConstantTable(id,
+				name, exts);
+		propertyFileParser.parseChildren(table, element);
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertyfile/FileElementParser.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 element parser
+*
+*/
+package com.nokia.tracebuilder.engine.propertyfile;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+
+import org.w3c.dom.Element;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.project.ProjectEngine;
+import com.nokia.tracebuilder.engine.source.SourceEngine;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+
+/**
+ * File element parser
+ * 
+ */
+final class FileElementParser implements PropertyFileElementParser {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.propertyfile.PropertyFileElementParser#
+	 *      parse(java.lang.Object, org.w3c.dom.Element)
+	 */
+	public void parse(Object owner, Element element)
+			throws TraceBuilderException {
+		String filePath = element.getTextContent();
+		SourceEngine sourceEngine = TraceBuilderGlobals.getSourceEngine();
+		ArrayList<String> list = sourceEngine.getNonSourceFiles();
+
+		String projectPath = TraceBuilderGlobals.getProjectPath();
+
+		File file = new File(projectPath + File.separatorChar
+				+ ProjectEngine.traceFolderName + File.separatorChar + filePath);
+
+		try {
+			filePath = file.getCanonicalPath();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+
+		if (!list.contains(filePath)) {
+			sourceEngine.addNonSourceFile(filePath);
+		}
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertyfile/GroupElementParser.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Parser for group element
+*
+*/
+package com.nokia.tracebuilder.engine.propertyfile;
+
+/**
+ * Parser for group element
+ * 
+ */
+final class GroupElementParser extends ObjectElementParser {
+
+	/**
+	 * Constructor
+	 * 
+	 * @param propertyFileParser
+	 *            the parser
+	 */
+	GroupElementParser(PropertyFileParser propertyFileParser) {
+		super(propertyFileParser);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.propertyfile.ObjectElementParser#findPropertyList(java.lang.String)
+	 */
+	@Override
+	TraceObjectPropertyListImpl findPropertyList(String name) {
+		return propertyFileParser.getGroupPropertyList(name);
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertyfile/Messages.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Localization for property file package
+*
+*/
+package com.nokia.tracebuilder.engine.propertyfile;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * Localization for property file package
+ * 
+ */
+class Messages {
+
+	/**
+	 * Bundle name
+	 */
+	private static final String BUNDLE_NAME = "com.nokia.tracebuilder.engine.propertyfile.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/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertyfile/ObjectElementParser.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Parser for component, group and trace
+*
+*/
+package com.nokia.tracebuilder.engine.propertyfile;
+
+import org.w3c.dom.Element;
+
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.StringErrorParameters;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.TraceBuilderErrorCode;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+
+/**
+ * Parser for component, group and trace
+ * 
+ */
+abstract class ObjectElementParser implements PropertyFileElementParser {
+
+	/**
+	 * Property file parser
+	 */
+	protected final PropertyFileParser propertyFileParser;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param propertyFileParser
+	 *            the parser
+	 */
+	ObjectElementParser(PropertyFileParser propertyFileParser) {
+		this.propertyFileParser = propertyFileParser;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.propertyfile.PropertyFileElementParser#
+	 *      parse(java.lang.Object, org.w3c.dom.Element)
+	 */
+	public void parse(Object owner, Element element)
+			throws TraceBuilderException {
+		String name = element
+				.getAttribute(PropertyFileConstants.NAME_ATTRIBUTE);
+		if (name != null && name.length() > 0) {
+			TraceObjectPropertyListImpl propertyList = findPropertyList(name);
+			// Adds the properties to the object
+			propertyFileParser.parseChildren(propertyList, element);
+		} else {
+			StringErrorParameters parameter = new StringErrorParameters();
+			parameter.string = PropertyFileConstants.NAME_ATTRIBUTE;
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.PROPERTY_FILE_ATTRIBUTE_INVALID,
+					parameter, null);
+		}
+	}
+
+	/**
+	 * Finds a property list by name
+	 * 
+	 * @param name
+	 *            the name
+	 * @return the property list
+	 */
+	abstract TraceObjectPropertyListImpl findPropertyList(String name);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertyfile/PropertyElementParser.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Parser for property element
+*
+*/
+package com.nokia.tracebuilder.engine.propertyfile;
+
+import org.w3c.dom.Element;
+
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.StringErrorParameters;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.TraceBuilderErrorCode;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+
+/**
+ * Parser for property element
+ * 
+ */
+final class PropertyElementParser implements PropertyFileElementParser {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.propertyfile.PropertyFileElementParser#
+	 *      parse(java.lang.Object, org.w3c.dom.Element)
+	 */
+	public void parse(Object owner, Element element)
+			throws TraceBuilderException {
+		// Property must be parsed within context of property list
+		if (owner instanceof TraceObjectPropertyListImpl) {
+			String name = element
+					.getAttribute(PropertyFileConstants.NAME_ATTRIBUTE);
+			if (name != null && name.length() > 0) {
+				String value = element.getTextContent();
+				TraceObjectPropertyImpl property = new TraceObjectPropertyImpl(
+						name, value);
+				((TraceObjectPropertyListImpl) owner).addProperty(property);
+			} else {
+				StringErrorParameters parameter = new StringErrorParameters();
+				parameter.string = PropertyFileConstants.NAME_ATTRIBUTE;
+				throw new TraceBuilderException(
+						TraceBuilderErrorCode.PROPERTY_FILE_ATTRIBUTE_INVALID,
+						parameter, null);
+			}
+		} else {
+			StringErrorParameters parameter = new StringErrorParameters();
+			parameter.string = PropertyFileConstants.PROPERTY_ELEMENT;
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.PROPERTY_FILE_ELEMENT_MISPLACED,
+					parameter, null);
+		}
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertyfile/PropertyFileConstants.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,118 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 property file engine
+*
+*/
+package com.nokia.tracebuilder.engine.propertyfile;
+
+
+/**
+ * Constants for property file engine
+ * 
+ */
+public interface PropertyFileConstants {
+
+	/**
+	 * File name
+	 */
+	String PROPERTY_FILE_NAME = "trace.properties"; //$NON-NLS-1$
+
+	/**
+	 * Number of backup files to keep
+	 */
+	int BACKUP_COUNT = 10; // CodForChk_Dis_Magic
+
+	/**
+	 * Last of the backup headers
+	 */
+	String LAST_BACKUP = "9.properties.bak"; //$NON-NLS-1$
+
+	/**
+	 * Backup extension
+	 */
+	String BACKUP_EXTENSION = ".bak"; //$NON-NLS-1$
+
+	/**
+	 * Root element name
+	 */
+	String ROOT_ELEMENT = "trace_properties"; //$NON-NLS-1$
+
+	/**
+	 * Enum element name
+	 */
+	String ENUM_ELEMENT = "enum"; //$NON-NLS-1$
+
+	/**
+	 * Struct element name
+	 */
+	String STRUCT_ELEMENT = "struct"; //$NON-NLS-1$
+
+	/**
+	 * Component element name
+	 */
+	String COMPONENT_ELEMENT = "component"; //$NON-NLS-1$
+
+	/**
+	 * Component element name
+	 */
+	String GROUP_ELEMENT = "group"; //$NON-NLS-1$
+
+	/**
+	 * Trace element name
+	 */
+	String TRACE_ELEMENT = "trace"; //$NON-NLS-1$
+
+	/**
+	 * Value element name
+	 */
+	String VALUE_ELEMENT = "value"; //$NON-NLS-1$
+
+	/**
+	 * Property element name
+	 */
+	String PROPERTY_ELEMENT = "property"; //$NON-NLS-1$
+
+	/**
+	 * File element name
+	 */
+	String FILE_ELEMENT = "file"; //$NON-NLS-1$
+	
+	/**
+	 * Name attribute
+	 */
+	String NAME_ATTRIBUTE = "name"; //$NON-NLS-1$
+
+	/**
+	 * Format attribute
+	 */
+	String FORMAT_ATTRIBUTE = "format"; //$NON-NLS-1$
+
+	/**
+	 * ID attribute
+	 */
+	String ID_ATTRIBUTE = "id"; //$NON-NLS-1$
+
+	/**
+	 * Type attribute
+	 */
+	String TYPE_ATTRIBUTE = "type"; //$NON-NLS-1$
+
+	/**
+	 * Size attribute
+	 */
+	String SIZE_ATTRIBUTE = "size"; //$NON-NLS-1$
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertyfile/PropertyFileElementParser.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 file element parser interface
+*
+*/
+package com.nokia.tracebuilder.engine.propertyfile;
+
+import org.w3c.dom.Element;
+
+import com.nokia.tracebuilder.model.TraceBuilderException;
+
+/**
+ * Property file element parser interface
+ * 
+ */
+interface PropertyFileElementParser {
+
+	/**
+	 * Parses the given element
+	 * 
+	 * @param owner
+	 *            the owning object
+	 * @param element
+	 *            the element to be parsed
+	 * @throws TraceBuilderException
+	 *             if parser fails
+	 */
+	void parse(Object owner, Element element) throws TraceBuilderException;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertyfile/PropertyFileEngine.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,348 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 file management engine
+*
+*/
+package com.nokia.tracebuilder.engine.propertyfile;
+
+import java.io.File;
+import java.io.OutputStream;
+
+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.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import com.nokia.tracebuilder.engine.TraceBuilderEngine;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorMessages;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.TraceBuilderErrorCode;
+import com.nokia.tracebuilder.engine.project.ProjectEngine;
+import com.nokia.tracebuilder.file.FileUtils;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceConstantTable;
+import com.nokia.tracebuilder.model.TraceConstantTableEntry;
+import com.nokia.tracebuilder.model.TraceModel;
+import com.nokia.tracebuilder.model.TraceModelListener;
+import com.nokia.tracebuilder.model.TraceObject;
+import com.nokia.tracebuilder.model.TraceProcessingListener;
+import com.nokia.tracebuilder.project.ProjectUtils;
+import com.nokia.tracebuilder.source.SourceConstants;
+
+/**
+ * Property file management engine
+ * 
+ */
+public final class PropertyFileEngine extends TraceBuilderEngine implements
+		TraceModelListener, TraceProcessingListener {
+
+	/**
+	 * Trace model
+	 */
+	private TraceModel model;
+
+	/**
+	 * Model processing flag prevents unnecessary saves
+	 */
+	private boolean processing;
+
+	/**
+	 * Backup created flag. This is initially set to false and when backup is
+	 * created, changes to true
+	 */
+	private boolean backupCreated;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            the trace model
+	 */
+	public PropertyFileEngine(TraceModel model) {
+		this.model = model;
+		model.addModelListener(this);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderEngine#projectOpened()
+	 */
+	@Override
+	public void projectOpened() {
+		TracePropertyFile propertyFile = model
+				.getExtension(TracePropertyFile.class);
+		if (propertyFile == null) {
+			String fileName = null;
+			try {
+				fileName = ProjectUtils.getLocationForFile(model,
+						ProjectEngine.traceFolderName,
+						PropertyFileConstants.PROPERTY_FILE_NAME, false);
+			} catch (TraceBuilderException e) {
+				// Model should always be open when traceProjectOpened is
+				// called
+			}
+			if (fileName != null) {
+				propertyFile = parsePropertyFile(fileName);
+				// Backup flag is reset when model is opened
+				backupCreated = false;
+			}
+		}
+		if (propertyFile == null) {
+			String msg = Messages
+					.getString("PropertyFileEngine.FailedToAttachFile"); //$NON-NLS-1$
+			TraceBuilderGlobals.getEvents().postErrorMessage(msg, null, true);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderEngine#projectClosing()
+	 */
+	@Override
+	public void projectClosed() {
+		model.removeExtensions(TracePropertyFile.class);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderEngine#exportProject()
+	 */
+	@Override
+	public void exportProject() {
+	}
+
+	/**
+	 * Parses the property file
+	 * 
+	 * @param fileName
+	 *            the file path
+	 * @return the property file
+	 */
+	private TracePropertyFile parsePropertyFile(String fileName) {
+		DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+		factory.setValidating(false);
+		DocumentBuilder builder;
+		TracePropertyFile propertyFile = null;
+		try {
+			builder = factory.newDocumentBuilder();
+			File file = new File(fileName);
+			if (file.exists()) {
+				try {
+					PropertyFileParser parser = new PropertyFileParser(model,
+							fileName, builder);
+					parser.parse();
+					propertyFile = new TracePropertyFile(file.getParent(),
+							parser.getDocument());
+					propertyFile.setProperties(parser.getGroupProperties(),
+							parser.getTraceProperties());
+				} catch (TraceBuilderException e) {
+					// Problem parsing document -> Backup and create new
+					TraceBuilderGlobals.getEvents().postError(e);
+					createBackup(fileName);
+				}
+			}
+			if (propertyFile == null) {
+				propertyFile = new TracePropertyFile(file.getParent(), builder
+						.newDocument());
+			}
+			model.addExtension(propertyFile);
+		} catch (ParserConfigurationException e) {
+		}
+		return propertyFile;
+	}
+
+	/**
+	 * Writes the property file
+	 */
+	private void writePropertyFile() {
+		if (!processing) {
+			TracePropertyFile propertyFile = model
+					.getExtension(TracePropertyFile.class);
+			if (propertyFile != null) {
+				// Backup flag is checked. If not set, a backup is created and
+				// the flag is set. The flag is reset when project is re-opened
+				String path = propertyFile.getAbsolutePath();
+				if (!backupCreated) {
+					createBackup(path);
+					backupCreated = true;
+				}
+				try {
+					// Uses XML API to write the property file
+					OutputStream fos = FileUtils.createOutputStream(new File(
+							path));
+					Transformer transformer = TransformerFactory.newInstance()
+							.newTransformer();
+					transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$
+					transformer.transform(new DOMSource(propertyFile
+							.getDocument()), new StreamResult(fos));
+					fos.close();
+					propertyFile.postFileWrittenEvent(path);
+				} catch (Exception e) {
+					String msg = TraceBuilderErrorMessages.getErrorMessage(
+							TraceBuilderErrorCode.CANNOT_WRITE_PROJECT_FILE,
+							null);
+					TraceBuilderGlobals.getEvents().postErrorMessage(msg, e, true);
+				}
+			}
+		}
+	}
+
+	/**
+	 * Creates a backup of the property file
+	 * 
+	 * @param path
+	 *            the file to be backed up
+	 */
+	private void createBackup(String path) {
+		boolean backup = false;
+		File file = new File(path);
+		if (file.exists()) {
+			boolean allexist = true;
+			// Checks the existing backup files and renames the old file to
+			// largest available number starting from 0
+			File f = null;
+			for (int i = 0; i < PropertyFileConstants.BACKUP_COUNT && allexist; i++) {
+				f = new File(path + i + PropertyFileConstants.BACKUP_EXTENSION);
+				if (!f.exists()) {
+					backup = FileUtils.copyFile(file, f);
+					allexist = false;
+				}
+			}
+			if (allexist) {
+				// If all backups from 0 to 9 exist, the old ones are moved
+				// back 1 step. The new file is renamed to *9.h
+				for (int i = 0; i < PropertyFileConstants.BACKUP_COUNT; i++) {
+					f = new File(path + i
+							+ PropertyFileConstants.BACKUP_EXTENSION);
+					if (i == 0) {
+						f.delete();
+					} else {
+						f.renameTo(new File(path + (i - 1)
+								+ PropertyFileConstants.BACKUP_EXTENSION));
+					}
+				}
+				f = new File(path + PropertyFileConstants.LAST_BACKUP);
+				backup = FileUtils.copyFile(file, f);
+			}
+			if (f != null && backup) {
+				String msg = Messages
+						.getString("PropertyFileEngine.PropertyFileBackUpPrefix") //$NON-NLS-1$
+						+ FileUtils.convertSeparators(
+								SourceConstants.FORWARD_SLASH_CHAR, f
+										.getAbsolutePath(), false);
+				TraceBuilderGlobals.getEvents().postInfoMessage(msg, null);
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelListener#
+	 *      objectAdded(com.nokia.tracebuilder.model.TraceObject,
+	 *      com.nokia.tracebuilder.model.TraceObject)
+	 */
+	public void objectAdded(TraceObject owner, TraceObject object) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelListener#
+	 *      objectCreationComplete(com.nokia.tracebuilder.model.TraceObject)
+	 */
+	public void objectCreationComplete(TraceObject object) {
+		if (model.isValid()) {
+			if (object instanceof TraceConstantTable
+					|| object instanceof TraceConstantTableEntry) {
+				TracePropertyFile propertyFile = model
+						.getExtension(TracePropertyFile.class);
+				if (propertyFile != null) {
+					propertyFile.addElement(object);
+					writePropertyFile();
+				}
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelListener#
+	 *      objectRemoved(com.nokia.tracebuilder.model.TraceObject,
+	 *      com.nokia.tracebuilder.model.TraceObject)
+	 */
+	public void objectRemoved(TraceObject owner, TraceObject object) {
+		if (model.isValid()) {
+			if (object instanceof TraceConstantTable
+					|| object instanceof TraceConstantTableEntry) {
+				TracePropertyFile propertyFile = model
+						.getExtension(TracePropertyFile.class);
+				if (propertyFile != null) {
+					propertyFile.removeElement(object);
+					writePropertyFile();
+				}
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelListener#
+	 *      propertyUpdated(com.nokia.tracebuilder.model.TraceObject, int)
+	 */
+	public void propertyUpdated(TraceObject object, int property) {
+		if (object.isComplete()
+				&& (object instanceof TraceConstantTable || object instanceof TraceConstantTableEntry)) {
+			TracePropertyFile propertyFile = model
+					.getExtension(TracePropertyFile.class);
+			if (propertyFile != null) {
+				propertyFile.updateElement(object);
+				writePropertyFile();
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceProcessingListener#processingComplete(boolean)
+	 */
+	public void processingComplete(boolean changed) {
+		processing = false;
+		if (changed) {
+			writePropertyFile();
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceProcessingListener#processingStarted()
+	 */
+	public void processingStarted() {
+		processing = true;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertyfile/PropertyFileParser.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,258 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Parser for trace property files
+*
+*/
+package com.nokia.tracebuilder.engine.propertyfile;
+
+import java.util.HashMap;
+
+import javax.xml.parsers.DocumentBuilder;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import com.nokia.tracebuilder.engine.TraceBuilderErrorMessages;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.StringErrorParameters;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.TraceBuilderErrorCode;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceModel;
+import com.nokia.tracebuilder.project.ProjectFileParser;
+
+/**
+ * Parser for trace property files
+ * 
+ */
+final class PropertyFileParser extends ProjectFileParser {
+
+	/**
+	 * DOM document representing the property file
+	 */
+	private Document document;
+
+	/**
+	 * Parsers for document elements
+	 */
+	private HashMap<String, PropertyFileElementParser> elementParsers = new HashMap<String, PropertyFileElementParser>();
+
+	/**
+	 * Document builder
+	 */
+	private DocumentBuilder builder;
+
+	/**
+	 * Group properties
+	 */
+	private HashMap<String, TraceObjectPropertyListImpl> groupProperties;
+
+	/**
+	 * Trace properties
+	 */
+	private HashMap<String, TraceObjectPropertyListImpl> traceProperties;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            the trace model
+	 * @param fileName
+	 *            the property file name
+	 * @param builder
+	 *            document builder
+	 * @throws TraceBuilderException
+	 *             if parser cannot be created
+	 */
+	protected PropertyFileParser(TraceModel model, String fileName,
+			DocumentBuilder builder) throws TraceBuilderException {
+		super(model, fileName);
+		this.builder = builder;
+		elementParsers.put(PropertyFileConstants.ENUM_ELEMENT,
+				new EnumElementParser(this));
+		elementParsers.put(PropertyFileConstants.VALUE_ELEMENT,
+				new ValueElementParser());
+		elementParsers.put(PropertyFileConstants.PROPERTY_ELEMENT,
+				new PropertyElementParser());
+		elementParsers.put(PropertyFileConstants.COMPONENT_ELEMENT,
+				new ComponentElementParser(this));
+		elementParsers.put(PropertyFileConstants.GROUP_ELEMENT,
+				new GroupElementParser(this));
+		elementParsers.put(PropertyFileConstants.TRACE_ELEMENT,
+				new TraceElementParser(this));
+		elementParsers.put(PropertyFileConstants.FILE_ELEMENT,
+				new FileElementParser());
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.project.ProjectFileParser#createParser()
+	 */
+	@Override
+	protected void createParser() throws TraceBuilderException {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.project.ProjectFileParser#parse()
+	 */
+	@Override
+	public void parse() throws TraceBuilderException {
+		try {
+			document = builder.parse(projectFile);
+			Element rootElement = PropertyFileUtils.findRoot(document);
+			if (rootElement != null) {
+				parseChildren(model, rootElement);
+			} else {
+				throw new TraceBuilderException(
+						TraceBuilderErrorCode.INVALID_PROJECT_FILE);
+			}
+		} catch (TraceBuilderException e) {
+			throw e;
+		} catch (Exception e) {
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.INVALID_PROJECT_FILE, e);
+		}
+	}
+
+	/**
+	 * Parses child elements of given element
+	 * 
+	 * @param owner
+	 *            the owning object
+	 * @param element
+	 *            the element
+	 */
+	void parseChildren(Object owner, Element element) {
+		NodeList list;
+		list = element.getChildNodes();
+		for (int i = 0; i < list.getLength(); i++) {
+			Node node = list.item(i);
+			if (node.getNodeType() == Node.ELEMENT_NODE) {
+				parseElement(owner, (Element) node);
+			}
+		}
+	}
+
+	/**
+	 * Parses an element
+	 * 
+	 * @param owner
+	 *            the owning trace object
+	 * @param element
+	 *            the element to be parsed
+	 */
+	private void parseElement(Object owner, Element element) {
+		String name = element.getNodeName();
+		PropertyFileElementParser parser = elementParsers.get(name);
+		if (parser != null) {
+			try {
+				parser.parse(owner, element);
+			} catch (TraceBuilderException e) {
+				String msg = TraceBuilderErrorMessages.getErrorMessage(e);
+				TraceBuilderGlobals.getEvents().postWarningMessage(msg,
+						e.getErrorSource());
+			}
+		} else {
+			postElementNotSupportedWarning(name);
+		}
+	}
+
+	/**
+	 * Posts element not supported warning
+	 * 
+	 * @param name
+	 *            the element name
+	 */
+	private void postElementNotSupportedWarning(String name) {
+		StringErrorParameters parameter = new StringErrorParameters();
+		parameter.string = name;
+		String msg = TraceBuilderErrorMessages.getErrorMessage(
+				TraceBuilderErrorCode.PROPERTY_FILE_ELEMENT_NOT_SUPPORTED,
+				parameter);
+		TraceBuilderGlobals.getEvents().postWarningMessage(msg, null);
+	}
+
+	/**
+	 * Gets the document representing the property file
+	 * 
+	 * @return the document
+	 */
+	Document getDocument() {
+		return document;
+	}
+
+	/**
+	 * Gets the property list for given group
+	 * 
+	 * @param name
+	 *            the group name
+	 * @return the property list
+	 */
+	TraceObjectPropertyListImpl getGroupPropertyList(String name) {
+		if (groupProperties == null) {
+			groupProperties = new HashMap<String, TraceObjectPropertyListImpl>();
+		}
+		TraceObjectPropertyListImpl propertyList = groupProperties.get(name);
+		if (propertyList == null) {
+			propertyList = new TraceObjectPropertyListImpl();
+			groupProperties.put(name, propertyList);
+		}
+		return propertyList;
+	}
+
+	/**
+	 * Gets the property list for given trace
+	 * 
+	 * @param name
+	 *            the trace name
+	 * @return the property list
+	 */
+	TraceObjectPropertyListImpl getTracePropertyList(String name) {
+		if (traceProperties == null) {
+			traceProperties = new HashMap<String, TraceObjectPropertyListImpl>();
+		}
+		TraceObjectPropertyListImpl propertyList = traceProperties.get(name);
+		if (propertyList == null) {
+			propertyList = new TraceObjectPropertyListImpl();
+			traceProperties.put(name, propertyList);
+		}
+		return propertyList;
+	}
+
+	/**
+	 * Gets the group properties
+	 * 
+	 * @return the group properties
+	 */
+	HashMap<String, TraceObjectPropertyListImpl> getGroupProperties() {
+		return groupProperties;
+	}
+
+	/**
+	 * Gets the trace properties
+	 * 
+	 * @return the trace properties
+	 */
+	public HashMap<String, TraceObjectPropertyListImpl> getTraceProperties() {
+		return traceProperties;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertyfile/PropertyFileUtils.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Utility functions for property file
+*
+*/
+package com.nokia.tracebuilder.engine.propertyfile;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * Utility functions for property file
+ * 
+ */
+final class PropertyFileUtils {
+
+	/**
+	 * Finds the root element from property file document
+	 * 
+	 * @param document
+	 *            the document
+	 * @return the root element
+	 */
+	static Element findRoot(Document document) {
+		NodeList list = document.getChildNodes();
+		Element rootElement = null;
+		for (int i = 0; i < list.getLength(); i++) {
+			Node root = list.item(i);
+			if (root.getNodeType() == Node.ELEMENT_NODE) {
+				if (root.getNodeName().equalsIgnoreCase(
+						PropertyFileConstants.ROOT_ELEMENT)) {
+					rootElement = (Element) root;
+				}
+			}
+		}
+		return rootElement;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertyfile/TraceElementParser.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Parser for trace element
+*
+*/
+package com.nokia.tracebuilder.engine.propertyfile;
+
+/**
+ * Parser for trace element
+ * 
+ */
+final class TraceElementParser extends ObjectElementParser {
+
+	/**
+	 * Constructor
+	 * 
+	 * @param propertyFileParser
+	 *            the parser
+	 */
+	TraceElementParser(PropertyFileParser propertyFileParser) {
+		super(propertyFileParser);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.propertyfile.ObjectElementParser#findPropertyList(java.lang.String)
+	 */
+	@Override
+	TraceObjectPropertyListImpl findPropertyList(String name) {
+		return propertyFileParser.getTracePropertyList(name);
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertyfile/TraceObjectPropertyImpl.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Implementation of the property interface
+*
+*/
+package com.nokia.tracebuilder.engine.propertyfile;
+
+import com.nokia.tracebuilder.model.TraceObjectProperty;
+
+/**
+ * Implementation of the property interface
+ * 
+ */
+class TraceObjectPropertyImpl implements TraceObjectProperty {
+
+	/**
+	 * Property name
+	 */
+	private String name;
+
+	/**
+	 * Property value
+	 */
+	private String value;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param name
+	 *            the property name
+	 * @param value
+	 *            the property value
+	 */
+	TraceObjectPropertyImpl(String name, String value) {
+		this.name = name;
+		this.value = value;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceObjectProperty#getName()
+	 */
+	public String getName() {
+		return name;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceObjectProperty#getValue()
+	 */
+	public String getValue() {
+		return value;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString() {
+		String separator = Messages
+				.getString("TraceObjectPropertyImpl.NameValueSeparator"); //$NON-NLS-1$
+		return name + separator + value;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertyfile/TraceObjectPropertyListImpl.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,159 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* List of properties
+*
+*/
+package com.nokia.tracebuilder.engine.propertyfile;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import com.nokia.tracebuilder.engine.TraceViewExtension;
+import com.nokia.tracebuilder.engine.rules.ExtensionBase;
+import com.nokia.tracebuilder.model.TraceModelExtensionUpdateListener;
+import com.nokia.tracebuilder.model.TraceObjectProperty;
+import com.nokia.tracebuilder.model.TraceObjectPropertyList;
+
+/**
+ * List of properties
+ * 
+ */
+final class TraceObjectPropertyListImpl extends ExtensionBase implements
+		TraceViewExtension, TraceObjectPropertyList {
+
+	/**
+	 * Property map
+	 */
+	private HashMap<String, TraceObjectProperty> properties = new HashMap<String, TraceObjectProperty>();
+
+	/**
+	 * Update listeners
+	 */
+	private ArrayList<TraceModelExtensionUpdateListener> updateListeners = new ArrayList<TraceModelExtensionUpdateListener>();
+
+	/**
+	 * View reference
+	 */
+	private Object viewReference;
+
+	/**
+	 * Adds a property to this list
+	 * 
+	 * @param property
+	 *            the property
+	 */
+	void addProperty(TraceObjectProperty property) {
+		properties.put(property.getName(), property);
+		for (TraceModelExtensionUpdateListener listener : updateListeners) {
+			listener.extensionUpdated();
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceObjectPropertyList#getProperty(java.lang.String)
+	 */
+	public TraceObjectProperty getProperty(String name) {
+		return properties.get(name);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Iterable#iterator()
+	 */
+	public Iterator<TraceObjectProperty> iterator() {
+		return properties.values().iterator();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceViewExtension#getChildren()
+	 */
+	public Iterator<?> getChildren() {
+		return properties.values().iterator();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceViewExtension#getViewReference()
+	 */
+	public Object getViewReference() {
+		return viewReference;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceViewExtension#hasChildren()
+	 */
+	public boolean hasChildren() {
+		return !properties.isEmpty();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceViewExtension#hideWhenEmpty()
+	 */
+	public boolean hideWhenEmpty() {
+		return true;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceViewExtension#setViewReference(java.lang.Object)
+	 */
+	public void setViewReference(Object reference) {
+		this.viewReference = reference;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelUpdatableExtension#
+	 *      addUpdateListener(com.nokia.tracebuilder.model.TraceModelExtensionUpdateListener)
+	 */
+	public void addUpdateListener(TraceModelExtensionUpdateListener listener) {
+		updateListeners.add(listener);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelUpdatableExtension#
+	 *      removeUpdateListener(com.nokia.tracebuilder.model.TraceModelExtensionUpdateListener)
+	 */
+	public void removeUpdateListener(TraceModelExtensionUpdateListener listener) {
+		updateListeners.remove(listener);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString() {
+		return Messages.getString("TraceObjectPropertyList.Title"); //$NON-NLS-1$
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertyfile/TracePropertyFile.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,379 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 file properties
+*
+*/
+package com.nokia.tracebuilder.engine.propertyfile;
+
+import java.util.HashMap;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import com.nokia.tracebuilder.engine.TraceBuilderConfiguration;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceConstantTable;
+import com.nokia.tracebuilder.model.TraceConstantTableEntry;
+import com.nokia.tracebuilder.model.TraceGroup;
+import com.nokia.tracebuilder.model.TraceModelListener;
+import com.nokia.tracebuilder.model.TraceObject;
+import com.nokia.tracebuilder.project.TraceProjectFile;
+
+/**
+ * Trace property file properties
+ * 
+ */
+final class TracePropertyFile extends TraceProjectFile {
+
+	/**
+	 * Title shown in UI
+	 */
+	private static final String PROPERTY_FILE = Messages
+			.getString("TracePropertyFile.Title"); //$NON-NLS-1$
+
+	/**
+	 * Property file document
+	 */
+	private Document document;
+
+	/**
+	 * Group properties
+	 */
+	private HashMap<String, TraceObjectPropertyListImpl> groupProperties;
+
+	/**
+	 * Trace properties
+	 */
+	private HashMap<String, TraceObjectPropertyListImpl> traceProperties;
+
+	/**
+	 * Creates a new property file
+	 * 
+	 * @param filePath
+	 *            path to the file
+	 * @param document
+	 *            the document representing the property file
+	 */
+	TracePropertyFile(String filePath, Document document) {
+		super(filePath, ""); //$NON-NLS-1$
+		this.document = document;
+	}
+
+	/**
+	 * Stores the group property cache. The properties are associated to groups
+	 * when they are created.
+	 * 
+	 * @param groupProperties
+	 *            properties for trace groups
+	 * @param traceProperties
+	 *            properties for traces
+	 */
+	void setProperties(
+			HashMap<String, TraceObjectPropertyListImpl> groupProperties,
+			HashMap<String, TraceObjectPropertyListImpl> traceProperties) {
+		this.groupProperties = groupProperties;
+		this.traceProperties = traceProperties;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.project.TraceProjectFile#getFileExtension()
+	 */
+	@Override
+	protected String getFileExtension() {
+		return PropertyFileConstants.PROPERTY_FILE_NAME;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.project.TraceProjectFile#getTitle()
+	 */
+	@Override
+	public String getTitle() {
+		return PROPERTY_FILE;
+	}
+
+	/**
+	 * Gets the document
+	 * 
+	 * @return the document
+	 */
+	Document getDocument() {
+		return document;
+	}
+
+	/**
+	 * Adds an element to the property file document
+	 * 
+	 * @param object
+	 *            the object to be added
+	 */
+	void addElement(TraceObject object) {
+		if (object instanceof TraceConstantTableEntry) {
+			addConstantTableEntry((TraceConstantTableEntry) object);
+		} else if (object instanceof TraceConstantTable) {
+			addConstantTable((TraceConstantTable) object);
+		}
+	}
+
+	/**
+	 * Removes an element from the property file document
+	 * 
+	 * @param object
+	 *            the object to be added
+	 */
+	void removeElement(TraceObject object) {
+		DocumentElementWrapper wrapper = object
+				.getExtension(DocumentElementWrapper.class);
+		if (wrapper != null) {
+			Element e = wrapper.getElement();
+			e.getParentNode().removeChild(e);
+		} else {
+			if (TraceBuilderConfiguration.ASSERTIONS_ENABLED) {
+				TraceBuilderGlobals.getEvents().postAssertionFailed(
+						"Element wrapper was missing", //$NON-NLS-1$
+						null);
+			}
+		}
+	}
+
+	/**
+	 * Updates an element from the property file document
+	 * 
+	 * @param object
+	 *            the object to be updated
+	 */
+	void updateElement(TraceObject object) {
+		DocumentElementWrapper wrapper = object
+				.getExtension(DocumentElementWrapper.class);
+		if (wrapper != null) {
+			Element e = wrapper.getElement();
+			if (object instanceof TraceConstantTableEntry) {
+				updateConstantTableEntry(e, (TraceConstantTableEntry) object);
+			} else if (object instanceof TraceConstantTable) {
+				updateConstantTable(e, (TraceConstantTable) object);
+			}
+		} else {
+			if (TraceBuilderConfiguration.ASSERTIONS_ENABLED) {
+				TraceBuilderGlobals.getEvents().postAssertionFailed(
+						"Element wrapper was missing", //$NON-NLS-1$
+						null);
+			}
+		}
+	}
+
+	/**
+	 * Adds a constant table to the document
+	 * 
+	 * @param table
+	 *            the table
+	 */
+	void addConstantTable(TraceConstantTable table) {
+		Element rootElement = getRoot();
+		Element tableElement = document
+				.createElement(PropertyFileConstants.ENUM_ELEMENT);
+		updateConstantTable(tableElement, table);
+		rootElement.appendChild(tableElement);
+		// The element reference is stored into the model
+		DocumentElementWrapper wrapper = new DocumentElementWrapper(
+				tableElement);
+		table.addExtension(wrapper);
+		for (TraceConstantTableEntry entry : table) {
+			addConstantTableEntry(tableElement, entry);
+		}
+	}
+
+	/**
+	 * Adds a constant table entry to the document
+	 * 
+	 * @param object
+	 *            the table entry
+	 */
+	void addConstantTableEntry(TraceConstantTableEntry object) {
+		Element tableElement = findNamedElement(object.getTable().getName(),
+				PropertyFileConstants.ENUM_ELEMENT);
+		if (tableElement != null) {
+			addConstantTableEntry(tableElement, object);
+		} else {
+			TraceBuilderGlobals.getEvents().postAssertionFailed(
+					"Enum element was missing from property file", //$NON-NLS-1$
+					null);
+		}
+	}
+
+	/**
+	 * Adds a constant table entry to given element
+	 * 
+	 * @param tableElement
+	 *            the constant table element
+	 * @param entry
+	 *            the constant table entry
+	 */
+	private void addConstantTableEntry(Element tableElement,
+			TraceConstantTableEntry entry) {
+		Element entryElement = document
+				.createElement(PropertyFileConstants.VALUE_ELEMENT);
+		updateConstantTableEntry(entryElement, entry);
+		tableElement.appendChild(entryElement);
+		// The element reference is stored into the model
+		DocumentElementWrapper wrapper = new DocumentElementWrapper(
+				entryElement);
+		entry.addExtension(wrapper);
+	}
+
+	/**
+	 * Updates a constant table
+	 * 
+	 * @param element
+	 *            the element to be updated
+	 * @param table
+	 *            the constant table
+	 */
+	private void updateConstantTable(Element element, TraceConstantTable table) {
+		// TODO: Table type and size are not supported
+		element.setAttribute(PropertyFileConstants.NAME_ATTRIBUTE, table
+				.getName());
+	}
+
+	/**
+	 * Updates a constant table entry
+	 * 
+	 * @param element
+	 *            the element to be updated
+	 * @param entry
+	 *            the table entry
+	 */
+	private void updateConstantTableEntry(Element element,
+			TraceConstantTableEntry entry) {
+		element.setAttribute(PropertyFileConstants.ID_ATTRIBUTE, String
+				.valueOf(entry.getID()));
+		element.setTextContent(entry.getName());
+	}
+
+	/**
+	 * Finds a named element
+	 * 
+	 * @param name
+	 *            the element name
+	 * @param type
+	 *            the element type
+	 * @return the element
+	 */
+	private Element findNamedElement(String name, String type) {
+		Element element = null;
+		Element rootElement = getRoot();
+		NodeList list = rootElement.getChildNodes();
+		for (int i = 0; element == null && i < list.getLength(); i++) {
+			Node node = list.item(i);
+			if (node.getNodeType() == Node.ELEMENT_NODE) {
+				if (node.getNodeName().equals(type)) {
+					String nameAttr = ((Element) node)
+							.getAttribute(PropertyFileConstants.NAME_ATTRIBUTE);
+					if (nameAttr != null && nameAttr.equals(name)) {
+						element = (Element) node;
+					}
+				}
+			}
+		}
+		return element;
+	}
+
+	/**
+	 * Gets the root element and creates if not found
+	 * 
+	 * @return the root
+	 */
+	private Element getRoot() {
+		Element rootElement = PropertyFileUtils.findRoot(document);
+		if (rootElement == null) {
+			rootElement = document
+					.createElement(PropertyFileConstants.ROOT_ELEMENT);
+			document.appendChild(rootElement);
+		}
+		return rootElement;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.project.TraceProjectFile#
+	 *      objectCreationComplete(com.nokia.tracebuilder.model.TraceObject)
+	 */
+	@Override
+	public void objectCreationComplete(TraceObject object) {
+		super.objectCreationComplete(object);
+		linkToProperty(object);
+	}
+
+	/**
+	 * Links an object to properties
+	 * 
+	 * @param object
+	 *            the object
+	 */
+	private void linkToProperty(TraceObject object) {
+		// Links the cached property lists to objects
+		if (object instanceof TraceGroup && groupProperties != null) {
+			TraceObjectPropertyListImpl propertyList = groupProperties
+					.get(object.getName());
+			if (propertyList != null) {
+				object.addExtension(propertyList);
+			}
+		} else if (object instanceof Trace && traceProperties != null) {
+			TraceObjectPropertyListImpl propertyList = traceProperties
+					.get(object.getName());
+			if (propertyList != null) {
+				object.addExtension(propertyList);
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.project.TraceProjectFile#
+	 *      objectRemoved(com.nokia.tracebuilder.model.TraceObject,
+	 *      com.nokia.tracebuilder.model.TraceObject)
+	 */
+	@Override
+	public void objectRemoved(TraceObject owner, TraceObject object) {
+		super.objectRemoved(owner, object);
+		// Removes the properties from the object
+		object.removeExtensions(TraceObjectPropertyListImpl.class);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.project.TraceProjectFile#
+	 *      propertyUpdated(com.nokia.tracebuilder.model.TraceObject, int)
+	 */
+	@Override
+	public void propertyUpdated(TraceObject object, int property) {
+		super.propertyUpdated(object, property);
+		if (property == TraceModelListener.NAME) {
+			// Removes the old properties from the object and links to new ones
+			object.removeExtensions(TraceObjectPropertyListImpl.class);
+			linkToProperty(object);
+		}
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertyfile/ValueElementParser.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,89 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Value element parser
+*
+*/
+package com.nokia.tracebuilder.engine.propertyfile;
+
+import org.w3c.dom.Element;
+
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.StringErrorParameters;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.TraceBuilderErrorCode;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceConstantTable;
+import com.nokia.tracebuilder.model.TraceModelExtension;
+
+/**
+ * Value element parser
+ * 
+ */
+final class ValueElementParser implements PropertyFileElementParser {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.propertyfile.PropertyFileElementParser#
+	 *      parse(java.lang.Object, org.w3c.dom.Element)
+	 */
+	public void parse(Object owner, Element element)
+			throws TraceBuilderException {
+		// Value element must be parsed within context of TraceConstantTable
+		// Struct has not yet been implemented
+		if (owner instanceof TraceConstantTable) {
+			parseConstantTableEntry((TraceConstantTable) owner, element);
+		} else {
+			StringErrorParameters parameter = new StringErrorParameters();
+			parameter.string = PropertyFileConstants.VALUE_ELEMENT;
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.PROPERTY_FILE_ELEMENT_MISPLACED,
+					parameter, null);
+		}
+	}
+
+	/**
+	 * Parses a constant table entry
+	 * 
+	 * @param table
+	 *            the constant table
+	 * @param element
+	 *            the table entry
+	 * @throws TraceBuilderException
+	 *             if entry is not valid
+	 */
+	private void parseConstantTableEntry(TraceConstantTable table,
+			Element element) throws TraceBuilderException {
+		String idstr = element.getAttribute(PropertyFileConstants.ID_ATTRIBUTE);
+		if (idstr != null) {
+			try {
+				int id = Integer.parseInt(idstr);
+				String value = element.getTextContent();
+				table.getModel().getVerifier().checkConstantProperties(table,
+						null, id, value);
+				// Document element reference is stored to the model
+				TraceModelExtension[] exts = new TraceModelExtension[] { new DocumentElementWrapper(
+						element) };
+				table.getModel().getFactory().createConstantTableEntry(table,
+						id, value, exts);
+			} catch (NumberFormatException e) {
+				StringErrorParameters parameter = new StringErrorParameters();
+				parameter.string = PropertyFileConstants.ID_ATTRIBUTE;
+				throw new TraceBuilderException(
+						TraceBuilderErrorCode.PROPERTY_FILE_ATTRIBUTE_INVALID,
+						parameter, null);
+			}
+		}
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertyfile/messages.properties	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,5 @@
+TracePropertyFile.Title=Property File
+PropertyFileEngine.FailedToAttachFile=Failed to attach property file to project
+PropertyFileEngine.PropertyFileBackUpPrefix=Property file back-up created to 
+TraceObjectPropertyList.Title=Properties
+TraceObjectPropertyImpl.NameValueSeparator=: 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/AddFunctionParametersFlag.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,119 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Dialog flag to add function parameter to trace
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.nokia.tracebuilder.engine.SourceContextManager;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate;
+import com.nokia.tracebuilder.model.TraceModelExtension;
+import com.nokia.tracebuilder.source.SourceContext;
+import com.nokia.tracebuilder.source.SourceParameter;
+import com.nokia.tracebuilder.source.SourceParserException;
+
+/**
+ * Dialog flag to add function parameter to trace. This creates a
+ * AutoAddFunctionParametersRule to the trace(s) created by the dialog.
+ * 
+ */
+final class AddFunctionParametersFlag extends DialogDynamicFlagBase {
+
+	/**
+	 * Title shown in UI
+	 */
+	private static final String UI_TITLE = Messages
+			.getString("AddFunctionParametersFlag.Title"); //$NON-NLS-1$
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogFlag#
+	 *      createExtensions(java.util.List)
+	 */
+	public void createExtensions(List<TraceModelExtension> extList) {
+		extList.add(new AutoAddFunctionParametersRule());
+		extList.add(new ComplexHeaderRuleImpl());
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogFlag#getText()
+	 */
+	public String getText() {
+		return UI_TITLE;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.DialogFlagBase#isVisible()
+	 */
+	@Override
+	public boolean isVisible() {
+		SourceContextManager manager = TraceBuilderGlobals
+				.getSourceContextManager();
+		boolean retval = false;
+		if (manager.isInstrumenting()) {
+			retval = true;
+		} else {
+			// If not instrumenting, the current context must
+			// exist and have parameters
+			SourceContext context = manager.getContext();
+			if (context != null) {
+				ArrayList<SourceParameter> list = new ArrayList<SourceParameter>();
+				try {
+					context.parseParameters(list);
+					if (list.size() > 0) {
+						retval = true;
+					}
+				} catch (SourceParserException e) {
+				}
+			}
+		}
+		return retval;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.DialogDynamicFlagBase#
+	 *      templateChanged(com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate)
+	 */
+	@Override
+	public boolean templateChanged(TraceObjectPropertyDialogTemplate template) {
+		boolean changed = false;
+		if (template == null || template instanceof EntryExitTraceTemplate
+				|| template instanceof EntryExitInstrumenterTemplate) {
+			if (!isAvailable()) {
+				changed = true;
+				setAvailable(true);
+			}
+		} else {
+			if (isAvailable()) {
+				changed = true;
+				setAvailable(false);
+			}
+		}
+		return changed;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/AddMatchingTraceFlag.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,125 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Dialog flag to add mathicg exit trace to entry trace
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import java.util.List;
+
+import com.nokia.tracebuilder.engine.SourceContextManager;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate;
+import com.nokia.tracebuilder.model.TraceModelExtension;
+
+/**
+ * Dialog flag to add matching exit trace to entry trace. This creates an
+ * AutoAddMatchingTraceRule to the trace(s) created by the dialog.
+ * 
+ */
+final class AddMatchingTraceFlag extends DialogDynamicFlagBase {
+
+	/**
+	 * Title shown in UI
+	 */
+	private static final String UI_TITLE = Messages
+			.getString("AddMatchingTraceFlag.Title"); //$NON-NLS-1$
+
+	/**
+	 * The template that was selected to create the entry trace
+	 */
+	private TraceObjectPropertyDialogTemplate entryTemplate;
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogFlag#
+	 *      createExtensions(java.util.List)
+	 */
+	public void createExtensions(List<TraceModelExtension> extList) {
+		extList.add(new AutoAddMatchingTraceRule(entryTemplate));
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogFlag#getText()
+	 */
+	public String getText() {
+		return UI_TITLE;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.DialogDynamicFlagBase#
+	 *      templateChanged(com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate)
+	 */
+	@Override
+	public boolean templateChanged(TraceObjectPropertyDialogTemplate template) {
+		boolean changed = false;
+		if (template instanceof EntryExitTraceTemplate
+				|| template instanceof EntryExitInstrumenterTemplate
+				|| template instanceof PerformanceEventTemplate) {
+			if (entryTemplate != template) {
+				changed = true;
+				entryTemplate = template;
+			}
+		} else {
+			if (entryTemplate != null) {
+				changed = true;
+				entryTemplate = null;
+			}
+		}
+		return changed;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.DialogDynamicFlagBase#isAvailable()
+	 */
+	@Override
+	public boolean isAvailable() {
+		// Currently this is never available
+		return false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.DialogDynamicFlagBase#isAlwaysEnabled()
+	 */
+	@Override
+	public boolean isAlwaysEnabled() {
+		return (entryTemplate instanceof EntryExitTraceTemplate)
+				|| (entryTemplate instanceof EntryExitInstrumenterTemplate)
+				|| (entryTemplate instanceof PerformanceEventTemplate);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.DialogFlagBase#isVisible()
+	 */
+	@Override
+	public boolean isVisible() {
+		SourceContextManager manager = TraceBuilderGlobals
+				.getSourceContextManager();
+		return manager.isInstrumenting() || manager.getContext() != null;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/AddReturnParameterFlag.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,99 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Dialog flag to add a return value parameter to trace
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import java.util.List;
+
+import com.nokia.tracebuilder.engine.SourceContextManager;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate;
+import com.nokia.tracebuilder.model.TraceModelExtension;
+import com.nokia.tracebuilder.source.SourceContext;
+
+/**
+ * Dialog flag to add a return value parameter to trace. This creates a
+ * AutoAddReturnParameterRule to the trace(s) created by the dialog.
+ * 
+ */
+final class AddReturnParameterFlag extends DialogDynamicFlagBase {
+
+	/**
+	 * Title shown in UI
+	 */
+	private static final String UI_TITLE = Messages
+			.getString("AddReturnParameterFlag.Title"); //$NON-NLS-1$
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogFlag#
+	 *      createExtensions(java.util.List)
+	 */
+	public void createExtensions(List<TraceModelExtension> extList) {
+		extList.add(new AutoAddReturnParameterRule());
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogFlag#
+	 *      getText()
+	 */
+	public String getText() {
+		return UI_TITLE;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.DialogDynamicFlagBase#
+	 *      templateChanged(com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate)
+	 */
+	@Override
+	public boolean templateChanged(TraceObjectPropertyDialogTemplate template) {
+		boolean changed = false;
+		if (template instanceof EntryExitInstrumenterTemplate
+				|| template instanceof EntryExitTraceTemplate) {
+			if (!isAvailable()) {
+				changed = true;
+				setAvailable(true);
+			}
+		} else {
+			if (isAvailable()) {
+				changed = true;
+				setAvailable(false);
+			}
+		}
+		return changed;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.DialogFlagBase#isVisible()
+	 */
+	@Override
+	public boolean isVisible() {
+		SourceContextManager manager = TraceBuilderGlobals
+				.getSourceContextManager();
+		SourceContext context = manager.getContext();
+		return manager.isInstrumenting()
+				|| (context != null && !context.isVoid());
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/AddThisPtrFlag.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,174 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Dialog flag to add a this pointer parameter to trace
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import java.util.List;
+
+import com.nokia.tracebuilder.engine.SourceContextManager;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialogFlag;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate;
+import com.nokia.tracebuilder.model.TraceModelExtension;
+import com.nokia.tracebuilder.source.SourceContext;
+
+/**
+ * Dialog flag to add a this pointer parameter to trace. This creates a
+ * AutoAddThisPtrRule to the trace(s) created by the dialog.
+ * 
+ */
+final class AddThisPtrFlag extends DialogDynamicFlagBase {
+
+	/**
+	 * Title shown in UI
+	 */
+	private static final String UI_TITLE = Messages
+			.getString("AddThisPtrFlag.Title"); //$NON-NLS-1$
+
+	/**
+	 * Currently selected template
+	 */
+	private TraceObjectPropertyDialogTemplate template;
+
+	/**
+	 * Add function parameters flag enabled
+	 */
+	private boolean addFunctionParametersFlagEnabled;
+
+	/**
+	 * Add return parameter flag enabled
+	 */
+	private boolean addReturnParameterFlagEnabled;
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogFlag#
+	 *      createExtensions(java.util.List)
+	 */
+	public void createExtensions(List<TraceModelExtension> extList) {
+		extList.add(new AutoAddThisPtrRule());
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogFlag#getText()
+	 */
+	public String getText() {
+		return UI_TITLE;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.DialogDynamicFlagBase#
+	 *      templateChanged(com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate)
+	 */
+	@Override
+	public boolean templateChanged(TraceObjectPropertyDialogTemplate template) {
+		this.template = template;
+		return checkAvailability();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.DialogDynamicFlagBase#
+	 *      flagChanged(com.nokia.tracebuilder.engine.TraceObjectPropertyDialogFlag)
+	 */
+	@Override
+	public boolean flagChanged(TraceObjectPropertyDialogFlag flag) {
+		boolean changed = false;
+		if (flag instanceof AddFunctionParametersFlag) {
+			addFunctionParametersFlagEnabled = flag.isEnabled();
+			checkAvailability();
+			changed = true;
+		} else if (flag instanceof AddReturnParameterFlag) {
+			addReturnParameterFlagEnabled = flag.isEnabled();
+			checkAvailability();
+			changed = true;
+		}
+
+		return changed;
+	}
+
+	/**
+	 * Checks the availability of this flag
+	 * 
+	 * @return the flag
+	 */
+	private boolean checkAvailability() {
+		boolean changed = false;
+		if (template instanceof PerformanceEventTemplate) {
+			setAvailable(false);
+			setEnabled(false);
+			changed = true;
+		} else if ((template instanceof EntryExitTraceTemplate || template instanceof EntryExitInstrumenterTemplate)
+				&& (addFunctionParametersFlagEnabled || addReturnParameterFlagEnabled)) {
+			setAvailable(false);
+			setEnabled(true);
+			changed = true;
+		} else {
+			if (!isAvailable()) {
+				setAvailable(true);
+				changed = true;
+			}
+		}
+		return changed;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.DialogDynamicFlagBase#isAlwaysEnabled()
+	 */
+	@Override
+	public boolean isAlwaysEnabled() {
+		// Auto-enabled with entry-exit traces if
+		// function parameters flag is set
+		boolean entry = (template instanceof EntryExitTraceTemplate)
+				|| (template instanceof EntryExitInstrumenterTemplate);
+		return isVisible()
+				&& (addFunctionParametersFlagEnabled || addReturnParameterFlagEnabled)
+				&& entry;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.DialogFlagBase#isVisible()
+	 */
+	@Override
+	public boolean isVisible() {
+		SourceContextManager manager = TraceBuilderGlobals
+				.getSourceContextManager();
+		boolean retval;
+		if (manager.isInstrumenting()) {
+			retval = true;
+		} else {
+			SourceContext context = manager.getContext();
+			if (context != null && !RuleUtils.isStaticFunction(context)) {
+				retval = true;
+			} else {
+				retval = false;
+			}
+		}
+		return retval;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/ArrayParameterFlag.java	Wed Jun 23 14:35:40 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:
+ *
+ * UI flag for array parameter type
+ *
+ */
+package com.nokia.tracebuilder.engine.rules;
+
+import java.util.List;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate;
+import com.nokia.tracebuilder.engine.TraceParameterPropertyDialogDynamicFlag;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceModelExtension;
+import com.nokia.tracebuilder.model.TraceObject;
+import com.nokia.tracebuilder.model.TraceParameter;
+import com.nokia.tracebuilder.project.GroupNameHandlerBase;
+
+/**
+ * UI flag for array parameter type
+ * 
+ */
+final class ArrayParameterFlag extends DialogDynamicFlagBase implements
+		TraceParameterPropertyDialogDynamicFlag {
+
+	/**
+	 * Title shown in UI
+	 */
+	private static final String UI_TITLE = Messages
+			.getString("ArrayParameterFlag.Title"); //$NON-NLS-1$
+
+	/**
+	 * Template has been selected flag
+	 */
+	private boolean hasTemplate;
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogFlag#
+	 * createExtensions(java.util.List)
+	 */
+	public void createExtensions(List<TraceModelExtension> extList) {
+		extList.add(new ArrayParameterRuleImpl());
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.tracebuilder.engine.TraceObjectPropertyDialogFlag#getText()
+	 */
+	public String getText() {
+		return UI_TITLE;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogDynamicFlag#
+	 * templateChanged
+	 * (com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate)
+	 */
+	@Override
+	public boolean templateChanged(TraceObjectPropertyDialogTemplate template) {
+		boolean retval = false;
+		if (template != null) {
+			if (isAvailable()) {
+				setAvailable(false);
+				retval = true;
+			}
+			hasTemplate = true;
+		} else {
+			if (!isAvailable()) {
+				setAvailable(true);
+				retval = true;
+			}
+			hasTemplate = false;
+		}
+
+		// If Performance or State Trace is selected, array types are
+		// not supported
+		if (isPerformaceTraceSelected() || isStateTraceSelected()) {
+			setAvailable(false);
+			retval = true;
+		}
+		return retval;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.tracebuilder.engine.TraceParameterPropertyDialogDynamicFlag
+	 * #typeChanged(int)
+	 */
+	public boolean typeChanged(String newType) {
+		boolean retval = false;
+		if (!hasTemplate) {
+			// String arrays are not supported
+			if (newType != TraceParameter.ASCII
+					&& newType != TraceParameter.UNICODE
+					&& !isPerformaceTraceSelected() && !isStateTraceSelected()) {
+				if (!isAvailable()) {
+					setAvailable(true);
+					retval = true;
+				}
+			} else {
+				if (isAvailable()) {
+					setAvailable(false);
+					retval = true;
+				}
+			}
+		}
+
+		return retval;
+	}
+
+	/**
+	 * Check is Performance Event trace selected
+	 * 
+	 * @return true if Performance Event Trace is selected, otherwise false
+	 */
+	private boolean isPerformaceTraceSelected() {
+		boolean retval = false;
+
+		TraceObject selectedObject = TraceBuilderGlobals.getTraceBuilder()
+				.getSelectedObject();
+
+		if (selectedObject instanceof Trace) {
+			Trace trace = (Trace) selectedObject;
+			GroupNameHandlerBase groupNameHandler = TraceBuilderGlobals.getGroupNameHandler();
+			if (trace.getGroup().getName().equals(
+					groupNameHandler.getDefaultGroups()[groupNameHandler.getPerformanceGroupIdIndex()])) {
+				retval = true;
+			}
+		}
+		return retval;
+	}
+
+	/**
+	 * Check is State trace selected
+	 * 
+	 * @return true if State Trace is selected, otherwise false
+	 */
+	private boolean isStateTraceSelected() {
+		boolean retval = false;
+
+		TraceObject selectedObject = TraceBuilderGlobals.getTraceBuilder()
+				.getSelectedObject();
+
+		if (selectedObject instanceof Trace) {
+			Trace trace = (Trace) selectedObject;
+			GroupNameHandlerBase groupNameHandler = TraceBuilderGlobals.getGroupNameHandler();
+			if (trace.getGroup().getName().equals(
+					groupNameHandler.getDefaultGroups()[groupNameHandler.getStateGroupIdIndex()])) {
+				retval = true;
+			}
+		}
+		return retval;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/ArrayParameterRuleImpl.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,110 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Rule which defines a parameter as array type
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialogEnabler;
+import com.nokia.tracebuilder.model.TraceModelPersistentExtension;
+import com.nokia.tracebuilder.rules.ArrayParameterRule;
+
+/**
+ * Rule which defines a parameter as array type
+ * 
+ */
+final class ArrayParameterRuleImpl extends RuleBase implements
+		ArrayParameterRule, TraceModelPersistentExtension,
+		TraceObjectPropertyDialogEnabler {
+
+	/**
+	 * Storage name for array parameter
+	 */
+	static final String STORAGE_NAME = "Array"; //$NON-NLS-1$
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelPersistentExtension#getData()
+	 */
+	public String getData() {
+		return ""; //$NON-NLS-1$
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelPersistentExtension#getStorageName()
+	 */
+	public String getStorageName() {
+		return STORAGE_NAME;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelPersistentExtension#
+	 *      setData(java.lang.String)
+	 */
+	public boolean setData(String data) {
+		return true;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogEnabler#isIdEnabled()
+	 */
+	public boolean isIdEnabled() {
+		return true;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogEnabler#isNameEnabled()
+	 */
+	public boolean isNameEnabled() {
+		return true;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogEnabler#isTypeEnabled()
+	 */
+	public boolean isTypeEnabled() {
+		return false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogEnabler#isValueEnabled()
+	 */
+	public boolean isValueEnabled() {
+		return true;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogEnabler#isTargetEnabled()
+	 */
+	public boolean isTargetEnabled() {
+		return true;
+	}	
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/AutoAddFunctionParametersRule.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,282 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 rule for automatically adding function parameters to a trace
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import java.util.ArrayList;
+
+import com.nokia.tracebuilder.engine.TraceBuilderErrorMessages;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.StringErrorParameters;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.TraceBuilderErrorCode;
+import com.nokia.tracebuilder.engine.source.TraceParameterFormattingRule;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceConstantTable;
+import com.nokia.tracebuilder.model.TraceObjectRuleCreateObject;
+import com.nokia.tracebuilder.model.TraceObjectRuleRemoveOnCreate;
+import com.nokia.tracebuilder.model.TraceParameter;
+import com.nokia.tracebuilder.source.SourceConstants;
+import com.nokia.tracebuilder.source.SourceContext;
+import com.nokia.tracebuilder.source.SourceParameter;
+import com.nokia.tracebuilder.source.SourceParserException;
+import com.nokia.tracebuilder.source.SourceUtils;
+import com.nokia.tracebuilder.source.TypeMapping;
+
+/**
+ * Trace rule for automatically adding function parameters to a trace
+ * 
+ */
+public final class AutoAddFunctionParametersRule extends RuleBase implements
+		TraceObjectRuleCreateObject, TraceObjectRuleRemoveOnCreate {
+
+	/**
+	 * Warning about value-to-pointer conversion
+	 */
+	private static final String VALUE_TO_POINTER_WARNING = Messages
+			.getString("AutoAddFunctionParametersRule.UnrecognizedTypeWarning"); //$NON-NLS-1$
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.tracebuilder.model.TraceObjectRuleCreateObject#createObject()
+	 */
+	public void createObject() {
+		SourceContext context = TraceBuilderGlobals.getSourceContextManager()
+				.getContext();
+		Trace trace = (Trace) getOwner();
+		if (context != null) {
+			boolean valid = true;
+			ArrayList<SourceParameter> list = tokenizeParameters(context);
+			if (list != null && list.size() > 0) {
+				trace.getModel().startProcessing();
+				try {
+					createParameters(trace, list);
+				} finally {
+					trace.getModel().processingComplete();
+				}
+				// At least one parameter must be parsed from source
+				valid = trace.getParameterCount() > 0;
+			} else {
+				valid = false;
+			}
+			if (!valid) {
+				String msg = TraceBuilderErrorMessages.getErrorMessage(
+						TraceBuilderErrorCode.CANNOT_PARSE_FUNCTION_PARAMETERS,
+						null);
+				TraceBuilderGlobals.getEvents().postWarningMessage(msg, trace);
+				// Removes the complex rule -> Function is not generated and
+				// source does not compile
+				trace.removeExtensions(ComplexHeaderRule.class);
+			}
+		} else {
+			String msg = TraceBuilderErrorMessages.getErrorMessage(
+					TraceBuilderErrorCode.NO_CONTEXT_FOR_LOCATION, null);
+			TraceBuilderGlobals.getEvents().postErrorMessage(msg, null, true);
+			// Removes the complex rule -> Function is not generated and
+			// source does not compile
+			trace.removeExtensions(ComplexHeaderRule.class);
+		}
+	}
+
+	/**
+	 * Creates the parameters to the trace
+	 * 
+	 * @param owner
+	 *            the trace
+	 * @param list
+	 *            the parameter list parsed from source
+	 */
+	private void createParameters(Trace owner, ArrayList<SourceParameter> list) {
+
+		// If any of the parameters is "...", clear the whole parameter list
+		for (SourceParameter param : list) {
+			String type = param.getType();
+			if (type != null
+					&& type.equals(SourceConstants.VARIABLE_ARG_LIST_INDICATOR)) {
+				list.clear();
+				
+				String msg = TraceBuilderErrorMessages.getErrorMessage(
+						TraceBuilderErrorCode.VAR_ARG_LIST_PARAMETER_FOUND,
+						null);
+				TraceBuilderGlobals.getEvents().postWarningMessage(msg, owner);
+				break;
+			}
+		}
+
+		StringBuilder str = new StringBuilder();
+		for (SourceParameter param : list) {
+			TraceParameter parameter = createParameter(owner, param);
+			if (parameter != null) {
+				str.append(SourceConstants.PARAMETER_SEPARATOR);
+				TraceParameterFormattingRule rule = parameter
+						.getExtension(TraceParameterFormattingRule.class);
+				if (rule != null) {
+					str.append(rule.mapNameToSource(param.getName()));
+				} else {
+					str.append(param.getName());
+				}
+			}
+			// The location will be referenced by event handlers if
+			// they need it. Otherwise it will be removed from the
+			// source
+			param.getSourceLocation().dereference();
+		}
+		// The header extension is stored in case of complex function entry
+		// trace
+		EntryTraceRule entryRule = owner.getExtension(EntryTraceRule.class);
+		ComplexHeaderRuleImpl complex = owner
+				.getExtension(ComplexHeaderRuleImpl.class);
+		if (entryRule != null && complex != null) {
+			complex.setTraceIDDefineExtension(str.toString());
+		}
+	}
+
+	/**
+	 * Processes the parameters of given source context
+	 * 
+	 * @param context
+	 *            the context
+	 * @return list of parameters
+	 */
+	private ArrayList<SourceParameter> tokenizeParameters(SourceContext context) {
+		ArrayList<SourceParameter> list = new ArrayList<SourceParameter>();
+		try {
+			context.parseParameters(list);
+		} catch (SourceParserException e) {
+			TraceBuilderGlobals.getEvents().postError(
+					new TraceBuilderException(
+							TraceBuilderErrorCode.UNEXPECTED_EXCEPTION, e));
+			list = null;
+		}
+		return list;
+	}
+
+	/**
+	 * Creates a TraceParameter based on parameter parsed from source
+	 * 
+	 * @param owner
+	 *            the owning trace object
+	 * @param param
+	 *            the parameter found from source
+	 * @return the parameter
+	 */
+	private TraceParameter createParameter(Trace owner, SourceParameter param) {
+		TraceConstantTable foundTable = RuleUtils.findConstantTableByType(owner
+				.getModel(), param);
+		TraceParameter parameter = null;
+		if (foundTable == null) {
+			TypeMapping type = SourceUtils.mapSymbianTypeToParameterType(param);
+			if (type != null) {
+				if (!type.isVoid()) {
+					parameter = createParameter(owner, param, type);
+				}
+			} else {
+				StringErrorParameters params = new StringErrorParameters();
+				params.string = param.getType();
+				TraceBuilderGlobals.getEvents().postError(
+						new TraceBuilderException(
+								TraceBuilderErrorCode.INVALID_PARAMETER_TYPE,
+								params, param.getSourceLocation()));
+			}
+		} else {
+			parameter = createParameter(owner, param, foundTable);
+		}
+		return parameter;
+	}
+
+	/**
+	 * Processes a non-void parameter type that was not associated with a
+	 * constant table
+	 * 
+	 * @param owner
+	 *            the owner for the parameter
+	 * @param param
+	 *            the parameter found from source
+	 * @param type
+	 *            the parameter type as parsed by source package
+	 * @return the parameter
+	 */
+	private TraceParameter createParameter(Trace owner, SourceParameter param,
+			TypeMapping type) {
+		String name = param.getName();
+		TraceParameter retval = null;
+		if (name != null && name.length() != 0) {
+			try {
+				retval = RuleUtils.createParameterFromType(owner, name, type);
+				if (retval != null && type.valueToPointer) {
+					// Posts a warning about value-to-pointer conversion
+					TraceBuilderGlobals.getEvents()
+							.postWarningMessage(VALUE_TO_POINTER_WARNING,
+									param.getSourceLocation());
+				}
+			} catch (TraceBuilderException e) {
+				// Changes the source of the error to the location that failed
+				TraceBuilderGlobals.getEvents().postError(
+						new TraceBuilderException(e.getErrorCode(), e
+								.getErrorParameters(), param
+								.getSourceLocation()));
+			}
+		}
+		return retval;
+	}
+
+	/**
+	 * Processes a non-void parameter type that was associated with a constant
+	 * table
+	 * 
+	 * @param owner
+	 *            the owner for the parameter
+	 * @param param
+	 *            the parameter found from source
+	 * @param table
+	 *            the constant table the parameter was associated to
+	 * @return the parameter
+	 */
+	private TraceParameter createParameter(Trace owner, SourceParameter param,
+			TraceConstantTable table) {
+		String name = param.getName();
+		TraceParameter retval = null;
+		if (name != null && name.length() != 0) {
+			try {
+				retval = RuleUtils.createParameterFromConstantTable(owner,
+						name, table);
+			} catch (TraceBuilderException e) {
+				// Changes the source of the error to the location that failed
+				TraceBuilderGlobals.getEvents().postError(
+						new TraceBuilderException(e.getErrorCode(), e
+								.getErrorParameters(), param
+								.getSourceLocation()));
+			}
+		}
+		return retval;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.tracebuilder.model.TraceObjectRuleRemoveOnCreate#canBeRemoved()
+	 */
+	public boolean canBeRemoved() {
+		// This is not copied to exit trace -> Can be removed
+		return true;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/AutoAddMatchingTraceRule.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,271 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 rule for automatically adding an exit trace when creating an entry trace
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate;
+import com.nokia.tracebuilder.engine.utils.TraceMultiplierRule;
+import com.nokia.tracebuilder.engine.utils.TraceUtils;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceGroup;
+import com.nokia.tracebuilder.model.TraceModelExtension;
+import com.nokia.tracebuilder.model.TraceObjectModifier;
+import com.nokia.tracebuilder.model.TraceObjectUtils;
+import com.nokia.tracebuilder.source.SourceContext;
+import com.nokia.tracebuilder.source.SourceLocation;
+import com.nokia.tracebuilder.source.SourceReturn;
+
+/**
+ * Trace rule for automatically adding an exit trace when creating an entry
+ * trace.
+ * 
+ */
+final class AutoAddMatchingTraceRule extends RuleBase implements
+		TraceMultiplierRule {
+
+	/**
+	 * Duplicate name changed warning
+	 */
+	private static final String DUPLICATE_NAME_CHANGED = Messages
+			.getString("AutoAddMatchingTraceRule.DuplicateName"); //$NON-NLS-1$
+	/**
+	 * Return statement has unwanted side effects
+	 */
+	private static final String INVALID_RETURN_STATEMENT = Messages
+			.getString("FunctionReturnLocationMultiplierRule.InvalidReturnStatement"); //$NON-NLS-1$
+
+	/**
+	 * The template that was used to create the entry trace
+	 */
+	private TraceObjectPropertyDialogTemplate entryTemplate;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param template
+	 *            the template for the entry trace
+	 */
+	AutoAddMatchingTraceRule(TraceObjectPropertyDialogTemplate template) {
+		entryTemplate = template;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceMultiplierRule#
+	 * createCopies(com.nokia.tracebuilder.model.Trace)
+	 */
+	public Iterator<Trace> createCopies(Trace trace) {
+		List<Trace> exitTraces = null;
+		SourceContext context = TraceBuilderGlobals.getSourceContextManager()
+				.getContext();
+		if (context != null) {
+			exitTraces = new ArrayList<Trace>();
+			copyTrace(exitTraces, trace, context);
+		} else {
+			exitTraces = Collections.emptyList();
+		}
+		return exitTraces.iterator();
+	}
+
+	/**
+	 * Creates the exit traces from entry trace and adds it to given list
+	 * 
+	 * @param exitTraces
+	 *            the list where exit traces are added
+	 * @param trace
+	 *            the entry trace
+	 * @param context
+	 *            the active source context
+	 */
+	private void copyTrace(List<Trace> exitTraces, Trace trace,
+			SourceContext context) {
+		String name;
+		String text;
+		String cname = context.getClassName();
+		String fname = context.getFunctionName();
+		if (entryTemplate instanceof ExitTracePropertyBuilder) {
+			name = ((ExitTracePropertyBuilder) entryTemplate)
+					.createExitName(trace.getName());
+			text = ((ExitTracePropertyBuilder) entryTemplate)
+					.createExitText(trace.getTrace());
+		} else {
+			name = TraceUtils.formatTrace(TraceUtils.getDefaultNameFormat(),
+					cname, fname);
+			text = TraceUtils.formatTrace(TraceUtils.getDefaultTraceFormat(),
+					cname, fname);
+		}
+		// Performance event gets one matching exit trace
+		// Function entry-exit is copied to all return statements
+		PerformanceEventStartRule rule = trace
+				.getExtension(PerformanceEventStartRule.class);
+		if (rule == null) {
+			ArrayList<SourceReturn> returnList = new ArrayList<SourceReturn>();
+			RuleUtils.getCurrentContextReturns(returnList);
+			AutoAddReturnParameterRule.resetNumberOfHandledReturnStatements();
+			for (SourceReturn ret : returnList) {
+				Trace exitTrace = processReturnStatement(trace, ret, name, text);
+				if (exitTrace != null) {
+					exitTraces.add(exitTrace);
+				}
+			}
+		} else {
+			try {
+				Trace exitTrace = createTrace(trace, name, text);
+				if (exitTrace != null) {
+					exitTraces.add(exitTrace);
+				}
+			} catch (TraceBuilderException e) {
+				TraceBuilderGlobals.getEvents().postError(e);
+			}
+		}
+		// All copy-and-remove rules are removed from the original trace
+		trace.removeExtensions(CopyAndRemoveExtensionRule.class);
+	}
+
+	/**
+	 * Processes a return statement from source context
+	 * 
+	 * @param entryTrace
+	 *            the entry trace
+	 * @param ret
+	 *            the return statement
+	 * @param name
+	 *            the name for exit trace
+	 * @param text
+	 *            the text for exit trace
+	 * @return the new trace or null if creation fails
+	 */
+	private Trace processReturnStatement(Trace entryTrace, SourceReturn ret,
+			String name, String text) {
+		Trace exitTrace = null;
+		boolean valid = checkTraceValidity(ret);
+		// Invalid exit traces are not created
+		if (valid) {
+			try {
+				exitTrace = createTrace(entryTrace, name, text);
+				exitTrace.addExtension(new FunctionReturnLocationRule(ret));
+			} catch (TraceBuilderException e) {
+				TraceBuilderGlobals.getEvents().postError(e);
+			}
+		} else {
+			// Even we did not add new exit trace we handled this return
+			// statement
+			AutoAddReturnParameterRule
+					.increaseNumberOfHandledReturnStatements();
+		}
+		return exitTrace;
+	}
+
+	/**
+	 * Creates the exit trace from entry trace
+	 * 
+	 * @param entryTrace
+	 *            the entry trace
+	 * @param name
+	 *            the name for exit trace
+	 * @param text
+	 *            the text for exit trace
+	 * @return the exit trace
+	 * @throws TraceBuilderException
+	 *             if creation fails
+	 */
+	private Trace createTrace(Trace entryTrace, String name, String text)
+			throws TraceBuilderException {
+		TraceGroup group = entryTrace.getGroup();
+		TraceObjectModifier nameModifier;
+		// Formats the name and text according to the exit template
+		nameModifier = TraceObjectUtils.modifyDuplicateTraceName(group
+				.getModel(), name);
+		int id = group.getNextTraceID();
+		String newName = nameModifier.getData();
+		group.getModel().getVerifier().checkTraceProperties(group, null, id,
+				newName, text);
+		TraceModelExtension[] extArray = copyExtensions(entryTrace);
+		Trace exitTrace = entryTrace.getModel().getFactory().createTrace(group,
+				id, newName, text, extArray);
+		if (nameModifier.hasChanged()) {
+			TraceBuilderGlobals.getEvents().postWarningMessage(
+					DUPLICATE_NAME_CHANGED + name, exitTrace);
+		}
+		return exitTrace;
+	}
+
+	/**
+	 * Checks the validity of an exit trace
+	 * 
+	 * @param ret
+	 *            the return statement
+	 * @return the trace validity
+	 */
+	private boolean checkTraceValidity(SourceReturn ret) {
+		boolean valid = true;
+		// Previous character hazard is always checked
+		if (ret.hasPreviousCharHazard()) {
+			SourceLocation loc = ret.getParser().createLocation(
+					ret.getOffset(), ret.getLength());
+			TraceBuilderGlobals.getEvents().postWarningMessage(
+					INVALID_RETURN_STATEMENT, loc);
+			loc.dereference();
+			valid = false;
+
+			// Tag has function call or increment / decrement values
+		} else if (ret.hasTagHazard()) {
+			SourceLocation loc = ret.getParser().createLocation(
+					ret.getOffset(), ret.getLength());
+			TraceBuilderGlobals.getEvents().postWarningMessage(
+					INVALID_RETURN_STATEMENT, loc);
+			loc.dereference();
+			valid = false;
+		}
+		return valid;
+	}
+
+	/**
+	 * Copies the extensions from the entry trace
+	 * 
+	 * @param trace
+	 *            the trace
+	 * @return the list of extensions to be added to exit trace
+	 */
+	private TraceModelExtension[] copyExtensions(Trace trace) {
+		ArrayList<TraceModelExtension> extList = new ArrayList<TraceModelExtension>();
+		Iterator<CopyExtensionRule> extItr = trace
+				.getExtensions(CopyExtensionRule.class);
+		int extCount = 0;
+		while (extItr.hasNext()) {
+			CopyExtensionRule rule = extItr.next();
+			extList.add(rule.createCopy());
+			extCount++;
+		}
+		TraceModelExtension[] extArray = null;
+		if (extCount > 0) {
+			extArray = new TraceModelExtension[extCount];
+			extList.toArray(extArray);
+		}
+		return extArray;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/AutoAddParameterRuleBase.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,97 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 the auto-add parameter rules
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.utils.TraceMultiplierRule;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceModelExtension;
+import com.nokia.tracebuilder.model.TraceObjectRule;
+import com.nokia.tracebuilder.model.TraceObjectRuleCreateObject;
+import com.nokia.tracebuilder.model.TraceObjectRuleRemoveOnCreate;
+import com.nokia.tracebuilder.model.TraceObjectUtils;
+
+/**
+ * Base class for the auto-add parameter rules
+ * 
+ */
+abstract class AutoAddParameterRuleBase extends RuleBase implements
+		TraceObjectRuleCreateObject, TraceObjectRuleRemoveOnCreate,
+		CopyAndRemoveExtensionRule {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceObjectRuleCreateObject#createObject()
+	 */
+	public void createObject() {
+		TraceObjectRule rule = getRule();
+		TraceModelExtension[] extensions = null;
+		if (rule != null) {
+			extensions = new TraceModelExtension[] { rule };
+		}
+		Trace owner = (Trace) getOwner();
+		int id = owner.getNextParameterID();
+		String name = TraceObjectUtils.modifyDuplicateParameterName(owner,
+				getName()).getData();
+		String type = getType();
+		try {
+			owner.getModel().getVerifier().checkTraceParameterProperties(owner,
+					null, id, name, type);
+			owner.getModel().getFactory().createTraceParameter(owner, id, name,
+					type, extensions);
+		} catch (TraceBuilderException e) {
+			TraceBuilderGlobals.getEvents().postError(e);
+		}
+	}
+
+	/**
+	 * Gets the name for the new parameter
+	 * 
+	 * @return the parameter name
+	 */
+	protected abstract String getName();
+
+	/**
+	 * Gets the new parameter type
+	 * 
+	 * @return the type
+	 */
+	protected abstract String getType();
+
+	/**
+	 * Gets the rule for the parameter
+	 * 
+	 * @return the rule
+	 */
+	protected abstract TraceObjectRule getRule();
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceObjectRuleRemoveOnCreate#canBeRemoved()
+	 */
+	public boolean canBeRemoved() {
+		// If the owner has a multiplier, this needs to be moved to it using the
+		// CopyAndRemoveExtensionRule
+		return getOwner().getExtension(TraceMultiplierRule.class) == null;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/AutoAddReturnParameterRule.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,197 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 rule for automatically adding function return value to exit trace
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import java.util.ArrayList;
+
+import com.nokia.tracebuilder.engine.TraceBuilderErrorMessages;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.TraceBuilderErrorCode;
+import com.nokia.tracebuilder.engine.utils.TraceMultiplierRule;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceConstantTable;
+import com.nokia.tracebuilder.model.TraceObjectRule;
+import com.nokia.tracebuilder.model.TraceObjectRuleCreateObject;
+import com.nokia.tracebuilder.model.TraceObjectRuleRemoveOnCreate;
+import com.nokia.tracebuilder.model.TraceParameter;
+import com.nokia.tracebuilder.source.SourceContext;
+import com.nokia.tracebuilder.source.SourceParserException;
+import com.nokia.tracebuilder.source.SourceReturn;
+import com.nokia.tracebuilder.source.SourceUtils;
+import com.nokia.tracebuilder.source.TypeMapping;
+
+/**
+ * Trace rule for automatically adding function return value to exit trace
+ * 
+ */
+public final class AutoAddReturnParameterRule extends RuleBase implements
+		TraceObjectRuleCreateObject, CopyAndRemoveExtensionRule,
+		TraceObjectRuleRemoveOnCreate {
+
+	/**
+	 * Parameter name
+	 */
+	static final String PARAMETER_NAME = "retval"; //$NON-NLS-1$
+
+	/**
+	 * The number of handled return statements
+	 */
+	private static int numberOfHandledReturnStatements = 0;
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceObjectRuleCreateObject#
+	 *      createObject(com.nokia.tracebuilder.model.TraceObject)
+	 */
+	public void createObject() {
+		// If owner has a multiplier (entry trace), the trace is not added to it
+		Trace owner = (Trace) getOwner();
+		if (owner.getExtension(TraceMultiplierRule.class) == null) {
+			SourceContext context = TraceBuilderGlobals
+					.getSourceContextManager().getContext();
+			if (!context.isVoid()) {
+				TraceConstantTable table = RuleUtils.findConstantTableByType(
+						owner.getModel(), context);
+				if (table != null) {
+					createParameter(owner, table);
+				} else {
+					createParameter(owner, context);
+				}
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceObjectRuleRemoveOnCreate#canBeRemoved()
+	 */
+	public boolean canBeRemoved() {
+		// If the owner has a multiplier, this needs to be moved to it using the
+		// CopyAndRemoveExtensionRule
+		return getOwner().getExtension(TraceMultiplierRule.class) == null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.CopyExtensionRule#createCopy()
+	 */
+	public TraceObjectRule createCopy() {
+		return new AutoAddReturnParameterRule();
+	}
+
+	/**
+	 * Creates a return parameter that was not associated with a constant table
+	 * 
+	 * @param owner
+	 *            the owner for the parameter
+	 * @param context
+	 *            the context specifying the parameter type
+	 */
+	private void createParameter(Trace owner, SourceContext context) {
+		TypeMapping type = SourceUtils.mapSymbianTypeToParameterType(context);
+		String return_value_name = PARAMETER_NAME;
+		ArrayList<SourceReturn> returnList = new ArrayList<SourceReturn>();
+
+		// Find out return value name
+		try {
+			context.parseReturnValues(returnList);
+			if (numberOfHandledReturnStatements <= (returnList.size() - 1)) {
+				return_value_name = returnList.get(
+						numberOfHandledReturnStatements).getReturnStatement();
+			}
+
+			numberOfHandledReturnStatements++;
+		} catch (SourceParserException e) {
+			String msg = Messages
+					.getString("RuleUtils.FailedToParseReturnValues"); //$NON-NLS-1$
+			String cname = context.getClassName();
+			String source;
+			if (cname != null) {
+				source = cname + "::" + context.getFunctionName(); //$NON-NLS-1$;
+			} else {
+				source = context.getFunctionName();
+			}
+			TraceBuilderGlobals.getEvents().postErrorMessage(msg, source, true);
+		}
+
+		try {
+			if (!type.needsCasting) {
+				// If an extension header is generated, the parameter needs to
+				// be cast, since the return statement may contain anything.
+				type.needsCasting = type.type != TraceParameter.HEX32
+						&& type.type != TraceParameter.SDEC32
+						&& type.type != TraceParameter.UDEC32;
+			}
+			RuleUtils.createParameterFromType(owner, return_value_name, type);
+
+		} catch (TraceBuilderException e) {
+
+			if (e.getErrorCode() == TraceBuilderErrorCode.INVALID_PARAMETER_NAME) {
+				String msg = TraceBuilderErrorMessages
+						.getErrorMessage(
+								TraceBuilderErrorCode.INVALID_PARAMETER_NAME_IN_RETURN_VALUE,
+								null);
+
+				TraceBuilderGlobals.getEvents().postWarningMessage(msg, owner);
+			} else {
+				TraceBuilderGlobals.getEvents().postError(
+						new TraceBuilderException(e.getErrorCode(), e
+								.getErrorParameters(), null));
+			}
+		}
+	}
+
+	/**
+	 * Creates a return parameter that was associated with a constant table
+	 * 
+	 * @param owner
+	 *            the owner for the parameter
+	 * @param table
+	 *            the constant table the parameter was associated to
+	 */
+	private void createParameter(Trace owner, TraceConstantTable table) {
+		try {
+			RuleUtils.createParameterFromConstantTable(owner, PARAMETER_NAME,
+					table);
+		} catch (TraceBuilderException e) {
+			TraceBuilderGlobals.getEvents().postError(
+					new TraceBuilderException(e.getErrorCode(), e
+							.getErrorParameters(), null));
+		}
+	}
+
+	/**
+	 * Reset static variables
+	 */
+	static void resetNumberOfHandledReturnStatements() {
+		numberOfHandledReturnStatements = 0;
+	}
+
+	/**
+	 * Increase number of handled return statements
+	 */
+	static void increaseNumberOfHandledReturnStatements() {
+		numberOfHandledReturnStatements++;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/AutoAddThisPtrRule.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,85 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Creation rule for this parameter
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.model.TraceObjectRule;
+import com.nokia.tracebuilder.model.TraceParameter;
+import com.nokia.tracebuilder.source.SourceContext;
+
+/**
+ * Creation rule for "this pointer" parameter
+ * 
+ */
+public final class AutoAddThisPtrRule extends AutoAddParameterRuleBase {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.AutoAddParameterRuleBase#createObject()
+	 */
+	@Override
+	public void createObject() {
+		SourceContext context = TraceBuilderGlobals.getSourceContextManager()
+				.getContext();
+		if (context != null && !RuleUtils.isStaticFunction(context)) {
+			super.createObject();
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.CopyExtensionRule#createCopy()
+	 */
+	public TraceObjectRule createCopy() {
+		return new AutoAddThisPtrRule();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.AutoAddParameterRuleBase#getName()
+	 */
+	@Override
+	protected String getName() {
+		return ThisPointerParameterTemplate.PARAMETER_NAME;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.AutoAddParameterRuleBase#getRule()
+	 */
+	@Override
+	protected TraceObjectRule getRule() {
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.AutoAddParameterRuleBase#getType()
+	 */
+	@Override
+	protected String getType() {
+		return TraceParameter.HEX32;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/AutomaticTraceTextRule.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Rule which specifies that trace does not have user-defined text
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import com.nokia.tracebuilder.source.SourceContext;
+
+/**
+ * Rule which specifies that trace does not have user-defined text
+ * 
+ */
+public abstract class AutomaticTraceTextRule extends RuleBase {
+
+	/**
+	 * Formats a trace according to given source context
+	 * 
+	 * @param context
+	 *            the context
+	 * @return the trace
+	 */
+	public abstract String formatTrace(SourceContext context);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/ClassNameWrapper.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Wrapper for Class and name
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import com.nokia.tracebuilder.model.TraceModelPersistentExtension;
+
+/**
+ * Wrapper for persistent extension class and name
+ * 
+ */
+class ClassNameWrapper {
+
+	/**
+	 * Constructor
+	 * 
+	 * @param name
+	 *            the name
+	 * @param clasz
+	 *            the class
+	 */
+	ClassNameWrapper(String name,
+			Class<? extends TraceModelPersistentExtension> clasz) {
+		this.name = name;
+		this.clasz = clasz;
+	}
+
+	/**
+	 * Name for the class
+	 */
+	String name;
+
+	/**
+	 * The class
+	 */
+	Class<? extends TraceModelPersistentExtension> clasz;
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/ComplexHeaderRule.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Rule which specifies that a trace cannot be represented by the normal trace API macros
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import com.nokia.tracebuilder.model.TraceObjectRule;
+
+/**
+ * Rule which specifies that a trace cannot be represented by the normal trace
+ * API macros
+ * 
+ */
+public interface ComplexHeaderRule extends TraceObjectRule {
+
+	/**
+	 * Returns true if an ext-function needs to be written for this trace
+	 * 
+	 * @return function flag
+	 */
+	public boolean needsFunction();
+
+	/**
+	 * Gets an extension to be added to the trace ID define
+	 * 
+	 * @return the extension
+	 */
+	public String getTraceIDDefineExtension();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/ComplexHeaderRuleImpl.java	Wed Jun 23 14:35:40 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:
+ *
+ * Implementation of ComplexHeaderRule
+ *
+ */
+package com.nokia.tracebuilder.engine.rules;
+
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.rules.TraceParameterRestrictionRule;
+
+/**
+ * Implementation of ComplexHeaderRule
+ * 
+ */
+public final class ComplexHeaderRuleImpl extends RuleBase implements
+		ComplexHeaderRule, TraceParameterRestrictionRule {
+
+	/**
+	 * Trace ID define extension
+	 */
+	private String traceIDDefineExtension;
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.tracebuilder.engine.header.ComplexHeaderRule#needsFunction()
+	 */
+	public boolean needsFunction() {
+		return true;
+	}
+
+	/**
+	 * Sets the data to be added to the trace ID define statement after the ID
+	 * 
+	 * @param traceIDDefineExtension
+	 *            the extension
+	 */
+	void setTraceIDDefineExtension(String traceIDDefineExtension) {
+		this.traceIDDefineExtension = traceIDDefineExtension;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @seecom.nokia.tracebuilder.engine.header.ComplexHeaderRule#
+	 * getTraceIDDefineExtension()
+	 */
+	public String getTraceIDDefineExtension() {
+		return traceIDDefineExtension;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.tracebuilder.rules.TraceParameterRestrictionRule#canAddParameters
+	 * ()
+	 */
+	public boolean canAddParameters() {
+		boolean retval;
+		Trace trace = (Trace) getOwner();
+
+		// Max parameter count int OstTraceExt traces is 5. Parameters can not
+		// be added to OstTraceFunctionEntryExt and OstTraceFunctionExitExt
+		// traces.
+		if (trace != null && trace.getParameterCount() < 5
+				&& trace.getExtension(EntryTraceRule.class) == null
+				&& trace.getExtension(ExitTraceRule.class) == null) {
+			retval = true;
+		} else {
+			retval = false;
+		}
+		return retval;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @seecom.nokia.tracebuilder.rules.TraceParameterRestrictionRule#
+	 * canRemoveParameters()
+	 */
+	public boolean canRemoveParameters() {
+		boolean retval;
+		Trace trace = (Trace) getOwner();
+
+		// Parameters can not be removed from OstTraceFunctionEntryExt and
+		// OstTraceFunctionExitExt traces.
+		if (trace.getExtension(EntryTraceRule.class) == null
+				&& trace.getExtension(ExitTraceRule.class) == null) {
+			retval = true;
+		} else {
+			retval = false;
+		}
+		return retval;
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/ContextTemplateBase.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,173 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 context-based templates
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TracePropertyDialogTemplate;
+import com.nokia.tracebuilder.engine.propertydialog.ContextBasedTemplate;
+import com.nokia.tracebuilder.engine.utils.TraceUtils;
+import com.nokia.tracebuilder.model.TraceObjectUtils;
+import com.nokia.tracebuilder.source.SourceContext;
+
+/**
+ * Base class for context-based templates
+ * 
+ */
+abstract class ContextTemplateBase implements TracePropertyDialogTemplate,
+		ContextBasedTemplate {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate#getName()
+	 */
+	public String getName() {
+		// Trace name must be unique within the model
+		return TraceObjectUtils.modifyDuplicateTraceName(
+				TraceBuilderGlobals.getTraceModel(), getFormattedTraceName())
+				.getData();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate#getName()
+	 */
+	public String getValue() {
+		return getFormattedTraceText();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TracePropertyDialogTemplate#getText(java.lang.String)
+	 */
+	public String getText(String groupName) {
+		return getFormattedTraceText();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate#isIDEnabled()
+	 */
+	public boolean isIDEnabled() {
+		return true;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate#isNameEnabled()
+	 */
+	public boolean isNameEnabled() {
+		return true;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate#isValueEnabled()
+	 */
+	public boolean isValueEnabled() {
+		return true;
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.TraceObjectPropertyDialogTemplate#isTargetEnabled()
+	 */
+	public boolean isTargetEnabled() {
+		return true;
+	}		
+
+	/**
+	 * Gets trace name based on context
+	 * 
+	 * @return the trace name
+	 */
+	private String getFormattedTraceName() {
+		String name;
+		SourceContext context = TraceBuilderGlobals.getSourceContextManager()
+				.getContext();
+		if (context != null) {
+			String fname = context.getFunctionName();
+			String cname = context.getClassName();
+			if (fname != null) {
+				name = TraceUtils.convertName(TraceUtils.formatTrace(
+						getTraceNameFormat(), cname, fname));
+			} else {
+				name = ""; //$NON-NLS-1$
+			}
+		} else {
+			name = ""; //$NON-NLS-1$
+		}
+		return name;
+	}
+
+	/**
+	 * Gets trace text based on the context
+	 * 
+	 * @return trace text
+	 */
+	private String getFormattedTraceText() {
+		String value;
+		SourceContext context = TraceBuilderGlobals.getSourceContextManager()
+				.getContext();
+		if (context != null) {
+			String fname = context.getFunctionName();
+			String cname = context.getClassName();
+			if (fname != null) {
+				value = TraceUtils.formatTrace(getTraceTextFormat(), cname,
+						fname);
+			} else {
+				value = ""; //$NON-NLS-1$
+			}
+		} else {
+			value = ""; //$NON-NLS-1$
+		}
+		return value;
+	}
+
+	/**
+	 * Gets the trace name format
+	 * 
+	 * @return the format
+	 */
+	protected abstract String getTraceNameFormat();
+
+	/**
+	 * Gets the trace text format
+	 * 
+	 * @return the format
+	 */
+	protected abstract String getTraceTextFormat();
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.ContextBasedTemplate#
+	 *      isAvailableInContext(com.nokia.tracebuilder.source.SourceContext)
+	 */
+	public boolean isAvailableInContext(SourceContext context) {
+		return context != null;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/CopyAndRemoveExtensionRule.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Used be trace multipliers to move extensions into new traces
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+/**
+ * Used be trace multipliers to move extensions into new traces. This extends
+ * the copy extension rule and indicates that the rule needs to be removed from
+ * the original object after it has been copied.
+ * 
+ */
+public interface CopyAndRemoveExtensionRule extends CopyExtensionRule {
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/CopyExtensionRule.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Template for function exit trace
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import com.nokia.tracebuilder.model.TraceObjectRule;
+
+/**
+ * Used be trace multipliers to copy extensions into new traces
+ * 
+ */
+interface CopyExtensionRule extends TraceObjectRule {
+
+	/**
+	 * Creates a copy of this rule
+	 * 
+	 * @return the new object
+	 */
+	public TraceObjectRule createCopy();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/DialogDynamicFlagBase.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,102 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 dynamic flags
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialogDynamicFlag;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialogFlag;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate;
+
+/**
+ * Base class for dynamic flags
+ * 
+ */
+abstract class DialogDynamicFlagBase extends DialogFlagBase implements
+		TraceObjectPropertyDialogDynamicFlag {
+
+	/**
+	 * Available flag
+	 */
+	private boolean available = true;
+
+	/**
+	 * Always enabled flag
+	 */
+	private boolean alwaysEnabled;
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogDynamicFlag#
+	 *      isAlwaysEnabled()
+	 */
+	public boolean isAlwaysEnabled() {
+		return alwaysEnabled;
+	}
+
+	/**
+	 * Sets the always enabled flag
+	 * 
+	 * @param flag
+	 *            new flag value
+	 */
+	protected void setAlwaysEnabled(boolean flag) {
+		alwaysEnabled = flag;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogDynamicFlag#
+	 *      isAvailable()
+	 */
+	public boolean isAvailable() {
+		return available;
+	}
+
+	/**
+	 * Sets the available flag
+	 * 
+	 * @param flag
+	 *            new flag value
+	 */
+	protected void setAvailable(boolean flag) {
+		available = flag;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogDynamicFlag#
+	 *      templateChanged(com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate)
+	 */
+	public boolean templateChanged(TraceObjectPropertyDialogTemplate template) {
+		return false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogDynamicFlag#
+	 *      flagChanged(com.nokia.tracebuilder.engine.TraceObjectPropertyDialogFlag)
+	 */
+	public boolean flagChanged(TraceObjectPropertyDialogFlag flag) {
+		return false;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/DialogFlagBase.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 instrumenter dialog flags
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialogFlag;
+
+/**
+ * Base class for dialog flags
+ * 
+ */
+abstract class DialogFlagBase implements TraceObjectPropertyDialogFlag {
+
+	/**
+	 * Enabled flag
+	 */
+	private boolean enabled;
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.InstrumenterDialogFlag#isEnabled()
+	 */
+	public boolean isEnabled() {
+		return enabled && isVisible();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.InstrumenterDialogFlag#setEnabled(boolean)
+	 */
+	public void setEnabled(boolean enabled) {
+		this.enabled = enabled;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogFlag#isVisible()
+	 */
+	public boolean isVisible() {
+		return true;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/EndOfFunctionLocationRule.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 rule for end of function
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import com.nokia.tracebuilder.engine.source.SourceLocationRule;
+
+/**
+ * Location rule for end of function
+ * 
+ */
+public final class EndOfFunctionLocationRule extends RuleBase implements
+		SourceLocationRule {
+
+	/**
+	 * Location rule offset. Should be large enough to cover a function
+	 */
+	private static final int OFFSET = 100000; // CodForChk_Dis_Magic
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.source.SourceLocationRule#getType()
+	 */
+	public int getLocationType() {
+		return SourceLocationRule.CONTEXT_RELATIVE;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.source.SourceLocationRule#getOffset()
+	 */
+	public int getLocationOffset() {
+		return OFFSET;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.source.SourceLocationRule#isRemovedAfterInsert()
+	 */
+	public boolean isRemovedAfterInsert() {
+		return true;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/EntryExitInstrumenterTemplate.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,123 @@
+/*
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Function entry-exit template for instrumenter
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import java.util.List;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.model.TraceModelExtension;
+import com.nokia.tracebuilder.project.GroupNameHandlerBase;
+
+/**
+ * Function entry-exit template for instrumenter
+ * 
+ */
+final class EntryExitInstrumenterTemplate extends InstrumenterTemplateBase
+		implements ExitTracePropertyBuilder {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate#getTitle()
+	 */
+	public String getTitle() {
+		return RuleUtils.getEntryTemplateTitle(RuleUtils.TYPE_ENTRY_EXIT);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate#getName()
+	 */
+	public String getName() {
+		return RuleUtils.createEntryTraceNameFormat(RuleUtils.TYPE_ENTRY_EXIT);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate#getValue()
+	 */
+	public String getValue() {
+		return RuleUtils.TEXT_FORMAT_BASE;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate#
+	 *      createExtensions(java.util.List)
+	 */
+	public void createExtensions(List<TraceModelExtension> list) {
+		list.add(new StartOfFunctionLocationRule());
+		list.add(new EntryTraceRule());
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.ExitTracePropertyBuilder#
+	 *      createExitName(java.lang.String)
+	 */
+	public String createExitName(String entryName) {
+		return RuleUtils.createExitName(entryName, RuleUtils.TYPE_ENTRY_EXIT);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.ExitTracePropertyBuilder#
+	 *      createExitText(java.lang.String)
+	 */
+	public String createExitText(String entryText) {
+		return entryText;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TracePropertyDialogTemplate#getGroupName()
+	 */
+	public String getGroupName() {
+		// Entry-exit traces go to flow group by default
+		GroupNameHandlerBase groupNameHandler = TraceBuilderGlobals.getGroupNameHandler();
+		return groupNameHandler.getDefaultGroups()[groupNameHandler.getFlowGroupIdIndex()];
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.InstrumenterTemplateBase#isValueEnabled()
+	 */
+	@Override
+	public boolean isValueEnabled() {
+		return false;
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.InstrumenterTemplateBase#isTargetEnabled()
+	 */
+	@Override
+	public boolean isTargetEnabled() {
+		return false;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/EntryExitTraceTemplate.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,123 @@
+/*
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Template for function entry-exit traces
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import java.util.List;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.model.TraceModelExtension;
+import com.nokia.tracebuilder.project.GroupNameHandlerBase;
+
+/**
+ * Template for function entry-exit traces
+ * 
+ */
+final class EntryExitTraceTemplate extends ContextTemplateBase implements
+		ExitTracePropertyBuilder {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate#getTitle()
+	 */
+	public String getTitle() {
+		return RuleUtils.getEntryTemplateTitle(RuleUtils.TYPE_ENTRY_EXIT);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.ContextTemplateBase#getTraceNameFormat()
+	 */
+	@Override
+	protected String getTraceNameFormat() {
+		return RuleUtils.createEntryTraceNameFormat(RuleUtils.TYPE_ENTRY_EXIT);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.ContextTemplateBase#getTraceTextFormat()
+	 */
+	@Override
+	protected String getTraceTextFormat() {
+		return RuleUtils.TEXT_FORMAT_BASE;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate#
+	 *      createExtensions(java.util.List)
+	 */
+	public void createExtensions(List<TraceModelExtension> list) {
+		list.add(new StartOfFunctionLocationRule());
+		list.add(new EntryTraceRule());
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.ExitTracePropertyBuilder#
+	 *      createExitName(java.lang.String)
+	 */
+	public String createExitName(String entryName) {
+		return RuleUtils.createExitName(entryName, RuleUtils.TYPE_ENTRY_EXIT);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.ExitTracePropertyBuilder#
+	 *      createExitText(java.lang.String)
+	 */
+	public String createExitText(String entryText) {
+		return entryText;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TracePropertyDialogTemplate#getGroupName()
+	 */
+	public String getGroupName() {
+		GroupNameHandlerBase groupNameHandler = TraceBuilderGlobals.getGroupNameHandler();
+		return groupNameHandler.getDefaultGroups()[groupNameHandler.getFlowGroupIdIndex()];
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.ContextTemplateBase#isValueEnabled()
+	 */
+	@Override
+	public boolean isValueEnabled() {
+		return false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.ContextTemplateBase#isTargetEnabled()
+	 */
+	@Override
+	public boolean isTargetEnabled() {
+		return false;
+	}	
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/EntryTraceRule.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Rule for entry traces
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import com.nokia.tracebuilder.engine.utils.TraceUtils;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceObjectRule;
+import com.nokia.tracebuilder.rules.TraceParameterRestrictionRule;
+import com.nokia.tracebuilder.source.SourceContext;
+
+/**
+ * Rule for entry traces
+ * 
+ */
+public class EntryTraceRule extends AutomaticTraceTextRule implements
+		CopyExtensionRule, TraceParameterRestrictionRule {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.rules.TraceParameterRestrictionRule#canAddParameters()
+	 */
+	public boolean canAddParameters() {
+		return false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.rules.TraceParameterRestrictionRule#canRemoveParameters()
+	 */
+	public boolean canRemoveParameters() {
+		boolean retval;
+		Trace trace = (Trace) getOwner();
+		// Parameters (instance identifier) can be removed only from OstTraceFunctionEntry1 trace
+		if (trace != null && trace.getParameterCount() == 1) {
+			retval = true;
+		} else {
+			retval = false;
+		}
+		return retval;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.CopyExtensionRule#createCopy()
+	 */
+	public TraceObjectRule createCopy() {
+		return new ExitTraceRule();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.AutomaticTraceTextRule#
+	 *      formatTrace(com.nokia.tracebuilder.source.SourceContext)
+	 */
+	@Override
+	public String formatTrace(SourceContext context) {
+		return TraceUtils.formatTrace(RuleUtils.TEXT_FORMAT_BASE, context
+				.getClassName(), context.getFunctionName());
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/ExitTracePropertyBuilder.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Creates exit traces from entry traces
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+/**
+ * Creates exit traces from entry traces
+ * 
+ */
+interface ExitTracePropertyBuilder {
+
+	/**
+	 * Gets the name for exit trace
+	 * 
+	 * @param entryName
+	 *            name of the entry trace
+	 * @return the name for exit trace
+	 */
+	String createExitName(String entryName);
+
+	/**
+	 * Gets the exit trace text based on entry trace
+	 * 
+	 * @param entryText
+	 *            entry trace text
+	 * @return the text for exit trace
+	 */
+	String createExitText(String entryText);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/ExitTraceRule.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Rule for exit traces
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import com.nokia.tracebuilder.engine.utils.TraceUtils;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.rules.TraceParameterRestrictionRule;
+import com.nokia.tracebuilder.source.SourceContext;
+
+/**
+ * Rule for exit traces
+ * 
+ */
+public class ExitTraceRule extends AutomaticTraceTextRule implements
+		TraceParameterRestrictionRule {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.rules.TraceParameterRestrictionRule#canAddParameters()
+	 */
+	public boolean canAddParameters() {
+		return false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.rules.TraceParameterRestrictionRule#canRemoveParameters()
+	 */
+	public boolean canRemoveParameters() {
+		boolean retval;
+		Trace trace = (Trace) getOwner();
+		// Parameters cannot be removed from Ext trace
+		if (trace != null && trace.getParameterCount() == 1) {
+			retval = true;
+		} else {
+			retval = false;
+		}
+		return retval;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.AutomaticTraceTextRule#
+	 *      formatTrace(com.nokia.tracebuilder.source.SourceContext)
+	 */
+	@Override
+	public String formatTrace(SourceContext context) {
+		return TraceUtils.formatTrace(RuleUtils.TEXT_FORMAT_BASE, context
+				.getClassName(), context.getFunctionName());
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/ExtensionBase.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 model extensions
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import com.nokia.tracebuilder.model.TraceModelExtension;
+import com.nokia.tracebuilder.model.TraceObject;
+
+/**
+ * Base class for model extensions
+ * 
+ */
+public class ExtensionBase implements TraceModelExtension {
+
+	/**
+	 * The owning trace object
+	 */
+	private TraceObject owner;
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelExtension#
+	 *      setOwner(com.nokia.tracebuilder.model.TraceObject)
+	 */
+	public void setOwner(TraceObject owner) {
+		this.owner = owner;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelExtension#getOwner()
+	 */
+	public TraceObject getOwner() {
+		return owner;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/FillerParameterRuleImpl.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 rule implementation
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import com.nokia.tracebuilder.rules.FillerParameterRule;
+
+/**
+ * Filler parameter rule implementation. This returns false from isShownInSource
+ * 
+ */
+final class FillerParameterRuleImpl extends TraceParameterFormattingRuleBase
+		implements FillerParameterRule {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.source.TraceParameterFormattingRule#isShownInSource()
+	 */
+	@Override
+	public boolean isShownInSource() {
+		return false;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/FunctionReturnLocationRule.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,74 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 rule for a function return trace
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import com.nokia.tracebuilder.engine.source.SourceLocationRule;
+import com.nokia.tracebuilder.source.SourceReturn;
+
+/**
+ * Location rule for a function return trace
+ * 
+ */
+public final class FunctionReturnLocationRule extends RuleBase implements
+		SourceLocationRule {
+
+	/**
+	 * Properties of the return statement to be traced
+	 */
+	private SourceReturn returnProperties;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param returnProperties
+	 *            the properties of the return statement
+	 */
+	public FunctionReturnLocationRule(SourceReturn returnProperties) {
+		this.returnProperties = returnProperties;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.source.SourceLocationRule#getLocationOffset()
+	 */
+	public int getLocationOffset() {
+		return returnProperties.getOffset();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.source.SourceLocationRule#getLocationType()
+	 */
+	public int getLocationType() {
+		// This inserts into absolute location
+		return ABSOLUTE;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.source.SourceLocationRule#isRemovedAfterInsert()
+	 */
+	public boolean isRemovedAfterInsert() {
+		return true;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/InstrumentedTraceRuleImpl.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,98 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Rule for instrumented traces
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import com.nokia.tracebuilder.engine.propertydialog.InstrumentedTraceRule;
+import com.nokia.tracebuilder.model.TraceModelPersistentExtension;
+
+/**
+ * Rule for instrumented traces. Enables automatic removal of instrumentation
+ * 
+ */
+class InstrumentedTraceRuleImpl extends RuleBase implements
+		TraceModelPersistentExtension, InstrumentedTraceRule {
+
+	/**
+	 * Storage name
+	 */
+	static final String STORAGE_NAME = "Instrumenter"; //$NON-NLS-1$
+
+	/**
+	 * ID of instrumenter used when the trace was added
+	 */
+	private String instrumenterID;
+
+	/**
+	 * Constructor for reflection
+	 */
+	InstrumentedTraceRuleImpl() {
+	}
+
+	/**
+	 * Constructor
+	 * 
+	 * @param instrumenterID
+	 *            the instrumenter ID
+	 */
+	InstrumentedTraceRuleImpl(String instrumenterID) {
+		this.instrumenterID = instrumenterID;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelPersistentExtension#getData()
+	 */
+	public String getData() {
+		return String.valueOf(instrumenterID);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelPersistentExtension#getStorageName()
+	 */
+	public String getStorageName() {
+		return STORAGE_NAME;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelPersistentExtension#setData(java.lang.String)
+	 */
+	public boolean setData(String data) {
+		boolean retval = false;
+		if (data != null && data.length() > 0) {
+			instrumenterID = data;
+			retval = true;
+		}
+		return retval;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.InstrumentedTraceRule#getInstrumenterID()
+	 */
+	public String getInstrumenterID() {
+		return instrumenterID;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/InstrumenterTemplateBase.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,75 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 instrumenter templates
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import com.nokia.tracebuilder.engine.TracePropertyDialogTemplate;
+
+/**
+ * Base class for instrumenter templates
+ * 
+ */
+public abstract class InstrumenterTemplateBase implements
+		TracePropertyDialogTemplate {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate#isIDEnabled()
+	 */
+	public boolean isIDEnabled() {
+		return false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate#isNameEnabled()
+	 */
+	public boolean isNameEnabled() {
+		return true;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate#isValueEnabled()
+	 */
+	public boolean isValueEnabled() {
+		return true;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate#isTargetEnabled()
+	 */
+	public boolean isTargetEnabled() {
+		return true;
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TracePropertyDialogTemplate#getText(java.lang.String)
+	 */
+	public String getText(String groupName) {
+		return getValue();
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/Messages.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 rules package
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * Localized strings for rules package
+ * 
+ */
+class Messages {
+
+	/**
+	 * Bundle name
+	 */
+	private static final String BUNDLE_NAME = "com.nokia.tracebuilder.engine.rules.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/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/ParameterTypeMappingRule.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,145 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 parameter rule for adding casting and pointer operations to source code
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import com.nokia.tracebuilder.model.TraceModelPersistentExtension;
+import com.nokia.tracebuilder.model.TraceParameter;
+import com.nokia.tracebuilder.source.SourceConstants;
+import com.nokia.tracebuilder.source.SourceUtils;
+import com.nokia.tracebuilder.source.TypeMapping;
+
+/**
+ * Trace parameter rule for adding casting and pointer operations to source code
+ * 
+ */
+final class ParameterTypeMappingRule extends TraceParameterFormattingRuleBase
+		implements TraceModelPersistentExtension {
+
+	/**
+	 * TTime.Int64() function
+	 */	
+	private static final String INT64_FUNCTION = ".Int64()"; //$NON-NLS-1$
+
+	/**
+	 * The type mapping
+	 */
+	private TypeMapping typeMapping;
+
+	/**
+	 * Storage name for this parameter
+	 */
+	static String STORAGE_NAME = "TypeMapping"; //$NON-NLS-1$
+
+	/**
+	 * Constructor for reflection
+	 */
+	ParameterTypeMappingRule() {
+		typeMapping = new TypeMapping(null);
+	}
+
+	/**
+	 * Creates a new type mapping rule
+	 * 
+	 * @param mapping
+	 *            the type mapping to be used
+	 */
+	ParameterTypeMappingRule(TypeMapping mapping) {
+		this.typeMapping = mapping;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.TraceParameterFormattingRuleBase#
+	 *      mapNameToSource(java.lang.String)
+	 */
+	@Override
+	public String mapNameToSource(String originalName) {
+		StringBuffer source = new StringBuffer();
+		if (typeMapping.type.equals(TraceParameter.TIME)) {
+			source.append(originalName);
+			source.append(INT64_FUNCTION);
+		} else {
+			if (typeMapping.needsCasting) {
+				source.append(SourceConstants.START_PARAMETERS);
+				TraceParameter param = (TraceParameter) getOwner();
+				source.append(SourceUtils.mapParameterTypeToSymbianType(param));
+				source.append(SourceConstants.END_PARAMETERS);
+			}
+			if (typeMapping.valueToPointer) {
+				source.append('&');
+			}
+			source.append(SourceConstants.START_PARAMETERS);
+			source.append(originalName);
+			source.append(SourceConstants.END_PARAMETERS);
+		}
+		return source.toString();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelPersistentExtension#getData()
+	 */
+	public String getData() {
+		StringBuffer sb = new StringBuffer();
+		if (typeMapping.needsCasting) {
+			sb.append('C');
+		}
+		if (typeMapping.valueToPointer) {
+			sb.append('V');
+		}
+		return sb.toString();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelPersistentExtension#getStorageName()
+	 */
+	public String getStorageName() {
+		return STORAGE_NAME;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelPersistentExtension#setData(java.lang.String)
+	 */
+	public boolean setData(String data) {
+		boolean retval = false;
+		if (data != null) {
+			for (int i = 0; i < data.length(); i++) {
+				char c = data.charAt(i);
+				switch (c) {
+				case 'C':
+					typeMapping.needsCasting = true;
+					retval = true;
+					break;
+				case 'V':
+					typeMapping.valueToPointer = true;
+					retval = true;
+					break;
+				}
+			}
+		}
+		return retval;
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/PerformanceEventRuleBase.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 performance event rules
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import com.nokia.tracebuilder.rules.TraceParameterRestrictionRule;
+
+/**
+ * Base class for performance event rules
+ * 
+ */
+public class PerformanceEventRuleBase extends RuleBase implements
+		TraceParameterRestrictionRule {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.rules.TraceParameterRestrictionRule#canAddParameters()
+	 */
+	public boolean canAddParameters() {
+		return false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.rules.TraceParameterRestrictionRule#canRemoveParameters()
+	 */
+	public boolean canRemoveParameters() {
+		return false;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/PerformanceEventStartRule.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,74 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Rule for performance timer entry trace
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceObjectRule;
+
+/**
+ * Rule for performance timer entry trace
+ * 
+ */
+public class PerformanceEventStartRule extends PerformanceEventRuleBase
+		implements CopyExtensionRule {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.rules.TraceParameterRestrictionRule#canAddParameters()
+	 */
+	@Override
+	public boolean canAddParameters() {
+		boolean retval;
+		Trace trace = (Trace) getOwner();
+		// Supports single parameter
+		if (trace != null && trace.getParameterCount() == 0) {
+			retval = true;
+		} else {
+			retval = false;
+		}
+		return retval;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.rules.TraceParameterRestrictionRule#canRemoveParameters()
+	 */
+	@Override
+	public boolean canRemoveParameters() {
+		boolean retval;
+		Trace trace = (Trace) getOwner();
+		// Single parameter can be removed
+		if (trace != null && trace.getParameterCount() == 1) {
+			retval = true;
+		} else {
+			retval = false;
+		}
+		return retval;
+	}
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.EntryTraceRule#createCopy()
+	 */
+	public TraceObjectRule createCopy() {
+		return new PerformanceEventStopRule();
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/PerformanceEventStopRule.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Performance timer exit trace rule
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+/**
+ * Performance timer exit trace rule
+ * 
+ */
+public final class PerformanceEventStopRule extends PerformanceEventRuleBase {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/PerformanceEventTemplate.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,112 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Template for performance timer entry trace
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import java.util.List;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.model.TraceModelExtension;
+import com.nokia.tracebuilder.project.GroupNameHandlerBase;
+
+/**
+ * Template for performance timer entry trace
+ * 
+ */
+public final class PerformanceEventTemplate extends ContextTemplateBase implements
+		ExitTracePropertyBuilder {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate#getTitle()
+	 */
+	public String getTitle() {
+		return RuleUtils.getEntryTemplateTitle(RuleUtils.TYPE_PERF_EVENT);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TracePropertyDialogTemplate#getGroupName()
+	 */
+	public String getGroupName() {
+		GroupNameHandlerBase groupNameHandler = TraceBuilderGlobals.getGroupNameHandler();
+		return groupNameHandler.getDefaultGroups()[groupNameHandler.getPerformanceGroupIdIndex()];
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate#
+	 *      createExtensions(java.util.List)
+	 */
+	public void createExtensions(List<TraceModelExtension> list) {
+		list.add(new PerformanceEventStartRule());
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.ContextTemplateBase#getTraceNameFormat()
+	 */
+	@Override
+	protected String getTraceNameFormat() {
+		return RuleUtils.createEntryTraceNameFormat(RuleUtils.TYPE_PERF_EVENT);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.TraceTemplateBase#getValuePostfix()
+	 */
+	@Override
+	protected String getTraceTextFormat() {
+		return ""; //$NON-NLS-1$
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.ExitTracePropertyBuilder#
+	 *      createExitName(java.lang.String)
+	 */
+	public String createExitName(String entryName) {
+		return RuleUtils.createExitName(entryName, RuleUtils.TYPE_PERF_EVENT);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.ExitTracePropertyBuilder#
+	 *      createExitText(java.lang.String)
+	 */
+	public String createExitText(String entryText) {
+		return entryText;
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.ExitTracePropertyBuilder#isTargetEnabled()
+	 */
+	@Override
+	public boolean isTargetEnabled() {
+		return false;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/PluginTraceFormatRuleDelegate.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,95 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Creates a plug-in formatter when setData is called
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import com.nokia.tracebuilder.model.TraceModelPersistentExtension;
+import com.nokia.tracebuilder.model.TraceObject;
+
+/**
+ * Creates a plug-in formatter when setData is called
+ * 
+ */
+final class PluginTraceFormatRuleDelegate implements
+		TraceModelPersistentExtension {
+
+	/**
+	 * 
+	 */
+	private final RulesEngine engine;
+
+	/**
+	 * @param engine
+	 */
+	PluginTraceFormatRuleDelegate(RulesEngine engine) {
+		this.engine = engine;
+	}
+
+	/**
+	 * Owning trace object
+	 */
+	private TraceObject owner;
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelPersistentExtension#getData()
+	 */
+	public String getData() {
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelPersistentExtension#getStorageName()
+	 */
+	public String getStorageName() {
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelPersistentExtension#setData(java.lang.String)
+	 */
+	public boolean setData(String data) {
+		this.engine.changeTraceAPI(data);
+		// This extension is not added to model
+		return false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelExtension#getOwner()
+	 */
+	public TraceObject getOwner() {
+		return owner;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelExtension#
+	 *      setOwner(com.nokia.tracebuilder.model.TraceObject)
+	 */
+	public void setOwner(TraceObject owner) {
+		this.owner = owner;
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/PropertyDialogConfiguration.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,102 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Implementation of TraceObjectPropertyDialogConfiguration interface
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import java.util.List;
+
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialog;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialogConfiguration;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialogFlag;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate;
+
+/**
+ * Implementation of TraceObjectPropertyDialogConfiguration interface
+ * 
+ */
+final class PropertyDialogConfiguration implements
+		TraceObjectPropertyDialogConfiguration {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogConfiguration#
+	 *      addViewFlags(java.util.List, int)
+	 */
+	public void addViewFlags(List<TraceObjectPropertyDialogFlag> flags,
+			int dialogType) {
+		if (dialogType == TraceObjectPropertyDialog.ADD_TRACE) {
+			addFlagsFromArray(flags, RulesEngineConstants.TRACE_FLAGS);
+		} else if (dialogType == TraceObjectPropertyDialog.ADD_PARAMETER) {
+			addFlagsFromArray(flags, RulesEngineConstants.PARAMETER_FLAGS);
+		} else if (dialogType == TraceObjectPropertyDialog.INSTRUMENTER) {
+			addFlagsFromArray(flags, RulesEngineConstants.INSTRUMENTER_FLAGS);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogConfiguration#
+	 *      addViewTemplates(java.util.List, int)
+	 */
+	public void addViewTemplates(List<TraceObjectPropertyDialogTemplate> list,
+			int dialogType) {
+		if (dialogType == TraceObjectPropertyDialog.ADD_TRACE) {
+			addTemplatesFromArray(list, RulesEngineConstants.TRACE_TEMPLATES);
+		} else if (dialogType == TraceObjectPropertyDialog.ADD_PARAMETER) {
+			addTemplatesFromArray(list,
+					RulesEngineConstants.PARAMETER_TEMPLATES);
+		} else if (dialogType == TraceObjectPropertyDialog.INSTRUMENTER) {
+			addTemplatesFromArray(list,
+					RulesEngineConstants.INSTRUMENTER_TEMPLATES);
+		}
+	}
+
+	/**
+	 * Adds flags from given array to given list
+	 * 
+	 * @param flags
+	 *            the list
+	 * @param flagArray
+	 *            the array
+	 */
+	private void addFlagsFromArray(List<TraceObjectPropertyDialogFlag> flags,
+			TraceObjectPropertyDialogFlag[] flagArray) {
+		for (TraceObjectPropertyDialogFlag element : flagArray) {
+			flags.add(element);
+		}
+	}
+
+	/**
+	 * Adds templates from given array to given list
+	 * 
+	 * @param templates
+	 *            the list
+	 * @param templateArray
+	 *            the array
+	 */
+	private void addTemplatesFromArray(
+			List<TraceObjectPropertyDialogTemplate> templates,
+			TraceObjectPropertyDialogTemplate[] templateArray) {
+		for (TraceObjectPropertyDialogTemplate element : templateArray) {
+			templates.add(element);
+		}
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/ReadOnlyObjectRuleImpl.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Read-only rule implementation
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import com.nokia.tracebuilder.rules.ReadOnlyObjectRule;
+
+/**
+ * Read-only rule implementation
+ * 
+ */
+public final class ReadOnlyObjectRuleImpl extends RuleBase implements
+		ReadOnlyObjectRule {
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/RuleBase.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 rules
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import com.nokia.tracebuilder.model.TraceObjectRule;
+
+/**
+ * Base class for rules
+ * 
+ */
+public class RuleBase extends ExtensionBase implements TraceObjectRule {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/RuleUtils.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,320 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ * Utility functions for rules package
+ *
+ */
+package com.nokia.tracebuilder.engine.rules;
+
+import java.util.Iterator;
+import java.util.List;
+
+import com.nokia.tracebuilder.engine.TraceBuilderConfiguration;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceConstantTable;
+import com.nokia.tracebuilder.model.TraceModel;
+import com.nokia.tracebuilder.model.TraceModelExtension;
+import com.nokia.tracebuilder.model.TraceObjectUtils;
+import com.nokia.tracebuilder.model.TraceParameter;
+import com.nokia.tracebuilder.source.ParsedType;
+import com.nokia.tracebuilder.source.SourceContext;
+import com.nokia.tracebuilder.source.SourceParserException;
+import com.nokia.tracebuilder.source.SourceReturn;
+import com.nokia.tracebuilder.source.TypeMapping;
+
+/**
+ * Utility functions for rules package
+ * 
+ */
+public final class RuleUtils {
+
+	/**
+	 * Entry-exit template
+	 */
+	public static final int TYPE_ENTRY_EXIT = 0; // CodForChk_Dis_Magic
+
+	/**
+	 * Start-stop event template
+	 */
+	public static final int TYPE_PERF_EVENT = 1; // CodForChk_Dis_Magic
+
+	/**
+	 * State trace template
+	 */
+	public static final int TYPE_STATE_TRACE = 2; // CodForChk_Dis_Magic
+
+	/**
+	 * Trace name format base
+	 */
+	static final String NAME_FORMAT_BASE = "{$CN}_{$FN}"; //$NON-NLS-1$
+
+	/**
+	 * Trace text format base
+	 */
+	static final String TEXT_FORMAT_BASE = "{$cn}::{$fn}"; //$NON-NLS-1$
+
+	/**
+	 * Template titles
+	 */
+	private static final String[] ENTRY_TEMPLATE_TITLES = {
+			Messages.getString("RuleUtils.FunctionEntryTitle"), //$NON-NLS-1$
+			Messages.getString("RuleUtils.PerformanceEventTitle"), //$NON-NLS-1$
+			Messages.getString("RuleUtils.StateTraceTitle"), //$NON-NLS-1$
+	};
+
+	/**
+	 * Entry name prefixes
+	 */
+	public static final String[] ENTRY_NAME_PREFIXES = { "", //$NON-NLS-1$
+			"EVENT_", //$NON-NLS-1$
+			"STATE_" //$NON-NLS-1$
+	};
+
+	/**
+	 * Entry name suffixes
+	 */
+	public static final String[] ENTRY_NAME_SUFFIXES = { "_ENTRY", //$NON-NLS-1$
+			"_START", //$NON-NLS-1$
+			"" //$NON-NLS-1$
+	};
+
+	/**
+	 * Exit name prefixes
+	 */
+	private static final String[] EXIT_NAME_PREFIXES = { "", //$NON-NLS-1$
+			"EVENT_", //$NON-NLS-1$
+			"" //$NON-NLS-1$
+	};
+
+	/**
+	 * Exit name suffixes
+	 */
+	public static final String[] EXIT_NAME_SUFFIXES = { "_EXIT", //$NON-NLS-1$
+			"_STOP", //$NON-NLS-1$
+			"" //$NON-NLS-1$
+	};
+
+	/**
+	 * Gets an entry template title
+	 * 
+	 * @param type
+	 *            the template type
+	 * @return the template title
+	 */
+	static String getEntryTemplateTitle(int type) {
+		return ENTRY_TEMPLATE_TITLES[type];
+	}
+
+	/**
+	 * Creates exit name from entry name
+	 * 
+	 * @param entryName
+	 *            the entry name
+	 * @param type
+	 *            the type of entry
+	 * @return the exit name
+	 */
+	static String createExitName(String entryName, int type) {
+		// Strips the duplicate modifier from the name
+		entryName = TraceObjectUtils.removeDuplicateModifier(entryName);
+		StringBuffer sb = new StringBuffer();
+		if (entryName.startsWith(ENTRY_NAME_PREFIXES[type])) {
+			entryName = entryName.substring(ENTRY_NAME_PREFIXES[type].length());
+		}
+		if (entryName.endsWith(ENTRY_NAME_SUFFIXES[type])) {
+			entryName = entryName.substring(0, entryName.length()
+					- ENTRY_NAME_SUFFIXES[type].length());
+		}
+		sb.append(EXIT_NAME_PREFIXES[type]);
+		sb.append(entryName);
+		sb.append(EXIT_NAME_SUFFIXES[type]);
+		return sb.toString();
+	}
+
+	/**
+	 * Creates an entry trace name format from type
+	 * 
+	 * @param type
+	 *            the trace format type
+	 * @return the trace name format
+	 */
+	public static String createEntryTraceNameFormat(int type) {
+		StringBuffer sb = new StringBuffer();
+		if (type == TYPE_PERF_EVENT || type == TYPE_STATE_TRACE) {
+			sb.append(NAME_FORMAT_BASE);
+		} else {
+			sb.append(ENTRY_NAME_PREFIXES[type]);
+			sb.append(NAME_FORMAT_BASE);
+			sb.append(ENTRY_NAME_SUFFIXES[type]);
+		}
+		return sb.toString();
+	}
+
+	/**
+	 * Creates an exit trace name format based on type
+	 * 
+	 * @param type
+	 *            the format type
+	 * @return the trace name format
+	 */
+	public static String createExitTraceNameFormat(int type) {
+		StringBuffer sb = new StringBuffer();
+		sb.append(EXIT_NAME_PREFIXES[type]);
+		sb.append(NAME_FORMAT_BASE);
+		sb.append(EXIT_NAME_SUFFIXES[type]);
+		return sb.toString();
+	}
+
+	/**
+	 * Gets the return statements from current context from the context manager.
+	 * 
+	 * @param returnStatements
+	 *            the list where the return statements are stored
+	 */
+	static void getCurrentContextReturns(List<SourceReturn> returnStatements) {
+		SourceContext context = TraceBuilderGlobals.getSourceContextManager()
+				.getContext();
+		if (context != null) {
+			try {
+				context.parseReturnValues(returnStatements);
+			} catch (SourceParserException e) {
+				String msg = Messages
+						.getString("RuleUtils.FailedToParseReturnValues"); //$NON-NLS-1$
+				String cname = context.getClassName();
+				String source;
+				if (cname != null) {
+					source = cname + "::" + context.getFunctionName(); //$NON-NLS-1$;
+				} else {
+					source = context.getFunctionName();
+				}
+				TraceBuilderGlobals.getEvents().postErrorMessage(msg, source,
+						true);
+			}
+		} else {
+			if (TraceBuilderConfiguration.ASSERTIONS_ENABLED) {
+				TraceBuilderGlobals.getEvents().postAssertionFailed(
+						"Function return not in function", null); //$NON-NLS-1$
+			}
+		}
+	}
+
+	/**
+	 * Checks if the function is static. Currently this is just dummy, checking
+	 * that the class name exists and the function name is not New / NewL /
+	 * NewLC
+	 * 
+	 * @param context
+	 *            the context to be checked
+	 * @return true if static, false if not
+	 */
+	static boolean isStaticFunction(SourceContext context) {
+		boolean retval;
+		if (context.getClassName() == null) {
+			retval = true;
+		} else {
+			String fname = context.getFunctionName();
+			if (fname.equals("New") //$NON-NLS-1$
+					|| fname.equals("NewL") //$NON-NLS-1$
+					|| fname.equals("NewLC") //$NON-NLS-1$
+			) {
+				retval = true;
+			} else {
+				retval = false;
+			}
+		}
+		return retval;
+	}
+
+	/**
+	 * Locates a constant table based on type definition parsed from source
+	 * 
+	 * @param model
+	 *            the trace model
+	 * @param type
+	 *            the parameter type
+	 * @return the constant table or null if not found
+	 */
+	static TraceConstantTable findConstantTableByType(TraceModel model,
+			ParsedType type) {
+		Iterator<TraceConstantTable> tables = model.getConstantTables();
+		TraceConstantTable foundTable = null;
+		while (tables.hasNext() && foundTable == null) {
+			TraceConstantTable table = tables.next();
+			if (type.typeEquals(table.getName())) {
+				foundTable = table;
+			}
+		}
+		return foundTable;
+	}
+
+	/**
+	 * Creates a parameter based on TypeMapping definition
+	 * 
+	 * @param owner
+	 *            the parameter owner
+	 * @param name
+	 *            the parameter name
+	 * @param type
+	 *            the type mapping
+	 * @return the parameter
+	 * @throws TraceBuilderException
+	 *             if parameter cannot be created
+	 */
+	static TraceParameter createParameterFromType(Trace owner, String name,
+			TypeMapping type) throws TraceBuilderException {
+		int id = owner.getNextParameterID();
+		owner.getModel().getVerifier().checkTraceParameterProperties(owner,
+				null, id, name, type.type);
+		TraceModelExtension[] extensions = null;
+		if (type.needsCasting || type.valueToPointer
+				|| type.type.equals(TraceParameter.TIME)) {
+			extensions = new TraceModelExtension[1];
+			extensions[0] = new ParameterTypeMappingRule(type);
+		}
+		TraceParameter parameter = owner.getModel().getFactory()
+				.createTraceParameter(owner, id, name, type.type, extensions);
+		return parameter;
+	}
+
+	/**
+	 * Creates a parameter object from constant table
+	 * 
+	 * @param owner
+	 *            the parameter owner
+	 * @param name
+	 *            the name for the parameter
+	 * @param table
+	 *            the constant table
+	 * @return the parameter
+	 * @throws TraceBuilderException
+	 *             if parameter cannot be created
+	 */
+	static TraceParameter createParameterFromConstantTable(Trace owner,
+			String name, TraceConstantTable table) throws TraceBuilderException {
+		int id = owner.getNextParameterID();
+		owner.getModel().getVerifier().checkTraceParameterProperties(owner,
+				null, id, name, table.getType());
+		// Constant tables need a cast to constant table type
+		TypeMapping type = new TypeMapping(table.getType());
+		type.needsCasting = true;
+		TraceModelExtension[] extensions = new TraceModelExtension[1];
+		extensions[0] = new ParameterTypeMappingRule(type);
+		return owner.getModel().getFactory().createTraceParameter(owner, id,
+				name, table.getName(), extensions);
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/RulesEngine.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,460 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Implementation of TraceObjectRuleFactory interface
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import java.util.Iterator;
+
+import com.nokia.tracebuilder.engine.TraceBuilderConfiguration;
+import com.nokia.tracebuilder.engine.TraceBuilderConfigurationListener;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialogConfiguration;
+import com.nokia.tracebuilder.engine.rules.osttrace.OstTraceFormatRule;
+import com.nokia.tracebuilder.engine.rules.printf.PrintfExtensionParserRule;
+import com.nokia.tracebuilder.engine.rules.printf.PrintfTraceParserRule;
+import com.nokia.tracebuilder.engine.source.SourceParserRule;
+import com.nokia.tracebuilder.engine.source.TraceParameterFormattingRule;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceModel;
+import com.nokia.tracebuilder.model.TraceModelExtension;
+import com.nokia.tracebuilder.model.TraceModelListener;
+import com.nokia.tracebuilder.model.TraceModelPersistentExtension;
+import com.nokia.tracebuilder.model.TraceModelResetListener;
+import com.nokia.tracebuilder.model.TraceObject;
+import com.nokia.tracebuilder.model.TraceObjectRuleFactory;
+import com.nokia.tracebuilder.model.TraceParameter;
+import com.nokia.tracebuilder.project.TraceProjectAPI;
+import com.nokia.tracebuilder.rules.FillerParameterRule;
+import com.nokia.tracebuilder.source.SourceUtils;
+
+/**
+ * Provides rules for trace objects.
+ * 
+ */
+public class RulesEngine implements TraceObjectRuleFactory {
+
+	/**
+	 * Number of parameters in a simple trace
+	 */
+	private static final int SIMPLE_TRACE_MAX_PARAMETER_COUNT = 1;
+
+	/**
+	 * Trace model listener updates the fillers and complex type flagging when
+	 * traces and parameters are modified
+	 */
+	private TraceModelListener modelListener;
+
+	/**
+	 * Trace model reset listener uses modelValid to update the complex header
+	 * rules
+	 */
+	private TraceModelResetListener resetListener;
+
+	/**
+	 * Manager for plug-in API's
+	 */
+	private RulesEnginePluginManager pluginManager;
+
+	/**
+	 * Configuration listener for source format changes
+	 */
+	private TraceBuilderConfigurationListener configurationListener = new RulesEngineConfigurationListener(
+			this);
+
+	/**
+	 * Property dialog configuration
+	 */
+	private TraceObjectPropertyDialogConfiguration propertyDialogConfiguration = new PropertyDialogConfiguration();
+
+	/**
+	 * Trace model
+	 */
+	private TraceModel model;
+
+	/**
+	 * Constructor
+	 */
+	public RulesEngine() {
+		TraceBuilderGlobals.getConfiguration().addConfigurationListener(
+				configurationListener);
+	}
+
+	/**
+	 * Gets the property dialog configuration
+	 * 
+	 * @return the configuration
+	 */
+	public TraceObjectPropertyDialogConfiguration getPropertyDialogConfiguration() {
+		return propertyDialogConfiguration;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceObjectRuleFactory#
+	 *      createExtension(com.nokia.tracebuilder.model.TraceObject,
+	 *      java.lang.String)
+	 */
+	public TraceModelPersistentExtension createExtension(TraceObject target,
+			String name) {
+		TraceModelPersistentExtension retval = null;
+		ClassNameWrapper[] table = RulesEngineConstants.PERSISTENT_EXTENSIONS;
+		for (int i = 0; i < table.length && retval == null; i++) {
+			if (name.equals(table[i].name)) {
+				retval = createPersistentExtensionAt(target, i);
+			}
+		}
+		return retval;
+	}
+
+	/**
+	 * Creates a persistent extension
+	 * 
+	 * @param target
+	 *            the target object
+	 * @param i
+	 *            index to the persistent extensions array
+	 * @return the extension
+	 */
+	private TraceModelPersistentExtension createPersistentExtensionAt(
+			TraceObject target, int i) {
+		ClassNameWrapper wrapper = RulesEngineConstants.PERSISTENT_EXTENSIONS[i];
+		TraceModelPersistentExtension retval = null;
+		TraceModelPersistentExtension o = target.getExtension(wrapper.clasz);
+		if (o == null) {
+			try {
+				retval = wrapper.clasz.newInstance();
+			} catch (Exception e) {
+				if (TraceBuilderConfiguration.ASSERTIONS_ENABLED) {
+					TraceBuilderGlobals.getEvents().postAssertionFailed(
+							"Invalid extension - " + wrapper.name, null); //$NON-NLS-1$
+				}
+			}
+		}
+		return retval;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceObjectRuleFactory#
+	 *      preProcessNewRules(com.nokia.tracebuilder.model.TraceObject)
+	 */
+	public void preProcessNewRules(TraceObject object) {
+		if (object instanceof Trace) {
+			// Instrumenter rules are added to instrumented traces
+			if (TraceBuilderGlobals.getSourceContextManager().isInstrumenting()) {
+				object.addExtension(new InstrumentedTraceRuleImpl(
+						TraceBuilderGlobals.getSourceContextManager()
+								.getInstrumenterID()));
+			}
+		} else if (object instanceof TraceModel) {
+			// NOTE: This is only called once when builder is started
+			// There is no cleanup code
+			this.model = (TraceModel) object;
+			modelListener = new RulesEngineModelListener(this);
+			resetListener = new RulesEngineResetListener(this, model);
+			model.addModelListener(modelListener);
+			model.addResetListener(resetListener);
+			// Adds the plug-in trace parser / formatter manager to the model as
+			// extension. The plug-in manager delegates the formatters and
+			// parsers to this object when plug-in components register to
+			// TraceBuilder.
+			pluginManager = new RulesEnginePluginManager(this);
+			model.addExtension(pluginManager);
+			createTraceParsers();
+			createTraceAPIs();
+		}
+	}
+
+	/**
+	 * Creates the trace parsers and stores them to the model
+	 */
+	private void createTraceParsers() {
+		for (SourceParserRule element : RulesEngineConstants.TRACE_PARSERS) {
+			// Creates all source parsers specified in the constants
+			model.addExtension(element);
+		}
+	}
+
+	/**
+	 * Enables / disables the printf parsers
+	 * 
+	 * @param flag
+	 *            enable flag
+	 */
+	void enablePrintfParser(boolean flag) {
+		if (flag) {
+			for (String element : RulesEngineConstants.PRINTF_PARSERS) {
+				SourceParserRuleBase parser = new PrintfTraceParserRule(element);
+				model.addExtension(parser);
+			}
+		} else {
+			Iterator<SourceParserRuleBase> rules = model
+					.getExtensions(SourceParserRuleBase.class);
+			boolean found;
+			do {
+				found = false;
+				while (rules.hasNext() && !found) {
+					SourceParserRuleBase parser = rules.next();
+					for (int i = 0; i < RulesEngineConstants.PRINTF_PARSERS.length; i++) {
+						if (parser.getSearchTag().equals(
+								RulesEngineConstants.PRINTF_PARSERS[i])) {
+							model.removeExtension(parser);
+							found = true;
+							i = RulesEngineConstants.PRINTF_PARSERS.length;
+						}
+					}
+				}
+			} while (found);
+		}
+	}
+
+	/**
+	 * Sets the parser macro extension
+	 * 
+	 * @param macro
+	 *            the new parser macro
+	 */
+	void setPrintfMacroExtension(String macro) {
+		PrintfExtensionParserRule parser = model
+				.getExtension(PrintfExtensionParserRule.class);
+		boolean changed = true;
+		if (parser != null) {
+			String oldtag = parser.getSearchTag();
+			if (oldtag.equals(macro)) {
+				changed = false;
+			} else {
+				model.removeExtension(parser);
+			}
+		}
+		if (changed && macro != null && macro.length() > 0) {
+			parser = new PrintfExtensionParserRule(macro);
+			model.addExtension(parser);
+		}
+	}
+
+	/**
+	 * Creates the default trace API's and adds them to the plug-in manager
+	 */
+	private void createTraceAPIs() {
+		for (TraceProjectAPI api : RulesEngineConstants.TRACE_APIS) {
+			pluginManager.addAPI(api);
+		}
+	}
+
+	/**
+	 * Creates the trace formatter and stores it to the model
+	 */
+	void setDefaultTraceAPI() {
+		// If the formatter did not exist in the project file, it is added based
+		// on the configuration default
+		if (model.getExtension(TraceProjectAPI.class) == null) {
+			String api = TraceBuilderGlobals.getConfiguration().getText(
+					TraceBuilderConfiguration.FORMATTER_NAME);
+			traceAPIChanged(api);
+		}
+	}
+
+	/**
+	 * API change notification
+	 * 
+	 * @param apiName
+	 *            the name of new api
+	 */
+	void traceAPIChanged(String apiName) {
+		TraceProjectAPI api = model.getExtension(TraceProjectAPI.class);
+		boolean found = false;
+		if (api != null) {
+			if (api.getName().equals(apiName)) {
+				found = true;
+			} else {
+				model.removeExtension(api);
+			}
+		}
+		if (!found) {
+			changeTraceAPI(apiName);
+		}
+	}
+
+	/**
+	 * Creates a trace API
+	 * 
+	 * @param apiName
+	 *            the name of the API to be created
+	 */
+	void changeTraceAPI(String apiName) {
+		if (apiName == null || apiName.length() == 0) {
+			apiName = OstTraceFormatRule.STORAGE_NAME;
+		}
+		Iterator<TraceProjectAPI> apis = pluginManager.getAPIs();
+		boolean apifound = false;
+		while (apis.hasNext()) {
+			TraceProjectAPI api = apis.next();
+			if (api.getName().equals(apiName)) {
+				model.addExtension(api);
+				apifound = true;
+			}
+		}
+		if (!apifound) {
+			// If API from configuration was not found, the first one is used
+			apis = pluginManager.getAPIs();
+			if (apis.hasNext()) {
+				model.addExtension(apis.next());
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceObjectRuleFactory#
+	 *      postProcessNewRules(com.nokia.tracebuilder.model.TraceObject)
+	 */
+	public void postProcessNewRules(TraceObject object) {
+	}
+
+	/**
+	 * Checks the count and types of parameters of given trace and flags it with
+	 * ComplexParameterRule if necessary
+	 * 
+	 * @param trace
+	 *            the trace
+	 */
+	void checkParameterTypes(Trace trace) {
+		// When converting traces from source, the converter takes care of
+		// flagging the traces as complex. The complex flag needs to be checked
+		// when trace are modified via UI
+		if (!TraceBuilderGlobals.getSourceContextManager().isConverting()) {
+			boolean complex = false;
+			int count = trace.getParameterCount();
+			Iterator<TraceParameter> itr = trace.getParameters();
+			while (itr.hasNext() && !complex) {
+				TraceParameter parameter = itr.next();
+				TraceParameterFormattingRule rule = parameter
+						.getExtension(TraceParameterFormattingRule.class);
+				boolean isShown = true;
+				if (rule != null && !rule.isShownInSource()) {
+					isShown = false;
+				}
+				if (isShown) {
+					complex = !SourceUtils.isSimpleType(parameter);
+				} else {
+					count--;
+				}
+			}
+			// Any trace with more than one parameter is a complex trace
+			if (!complex && count > SIMPLE_TRACE_MAX_PARAMETER_COUNT) {
+				complex = true;
+			}
+			ComplexHeaderRule rule = trace
+					.getExtension(ComplexHeaderRule.class);
+			if (complex && rule == null) {
+				trace.addExtension(new ComplexHeaderRuleImpl());
+			} else if (!complex && rule != null) {
+				trace.removeExtension(rule);
+			}
+		}
+	}
+
+	/**
+	 * Adds fillers to align trace parameters to 32-bit boundaries.
+	 * 
+	 * @param trace
+	 *            the trace to be updated
+	 */
+	void checkFillerParameters(Trace trace) {
+		// Flags the model so listeners don't perform intermediate updates
+		trace.getModel().startProcessing();
+		try {
+			// Removes all existing fillers
+			for (int i = 0; i < trace.getParameterCount(); i++) {
+				TraceParameter parameter = trace.getParameter(i);
+				if (parameter.getExtension(FillerParameterRule.class) != null) {
+					trace.removeParameterAt(i);
+					i--;
+				}
+			}
+			int bytesInBlock = 0;
+			int parameterIndex = 0;
+			for (; parameterIndex < trace.getParameterCount(); parameterIndex++) {
+				TraceParameter parameter = trace.getParameter(parameterIndex);
+				int paramSize = SourceUtils.mapParameterTypeToSize(parameter);
+				// 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) { // CodForChk_Dis_Magic
+					if (bytesInBlock > 0) {
+						int fillerCount = 4 - bytesInBlock; // CodForChk_Dis_Magic
+						for (int i = 0; i < fillerCount; i++) {
+							createFillerParameter(trace, parameterIndex++);
+						}
+						bytesInBlock = 0;
+					}
+				} else if (paramSize == 2) { // CodForChk_Dis_Magic
+					if (bytesInBlock == 1 || bytesInBlock == 3) { // CodForChk_Dis_Magic
+						createFillerParameter(trace, parameterIndex++);
+						// 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; // CodForChk_Dis_Magic
+					} else {
+						bytesInBlock += 2; // CodForChk_Dis_Magic
+					}
+					if (bytesInBlock >= 4) { // CodForChk_Dis_Magic
+						bytesInBlock -= 4; // CodForChk_Dis_Magic
+					}
+				} else {
+					bytesInBlock++;
+					if (bytesInBlock == 4) { // CodForChk_Dis_Magic
+						bytesInBlock = 0;
+					}
+				}
+			}
+			// Adds fillers also the the end of the parameter list
+			if (bytesInBlock > 0) {
+				int fillerCount = 4 - bytesInBlock; // CodForChk_Dis_Magic
+				for (int i = 0; i < fillerCount; i++) {
+					createFillerParameter(trace, parameterIndex++);
+				}
+				bytesInBlock = 0;
+			}
+		} finally {
+			trace.getModel().processingComplete();
+		}
+	}
+
+	/**
+	 * Creates a filler parameter
+	 * 
+	 * @param trace
+	 *            the trace for the parameter
+	 * @param parameterIndex
+	 *            the index where the filler is inserted
+	 */
+	private void createFillerParameter(Trace trace, int parameterIndex) {
+		trace.getModel().getFactory().createTraceParameter(parameterIndex,
+				trace, trace.getParameterCount(),
+				"Filler", //$NON-NLS-1$
+				TraceParameter.HEX8,
+				new TraceModelExtension[] { new FillerParameterRuleImpl() });
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/RulesEngineConfigurationListener.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,99 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Configuration listener
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import com.nokia.tracebuilder.engine.TraceBuilderConfiguration;
+import com.nokia.tracebuilder.engine.TraceBuilderConfigurationListener;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+
+/**
+ * Configuration listener for rule engine monitors the trace formatting
+ * 
+ */
+final class RulesEngineConfigurationListener implements
+		TraceBuilderConfigurationListener {
+
+	/**
+	 * Rules engine
+	 */
+	private RulesEngine engine;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param engine
+	 *            the rules engine
+	 */
+	RulesEngineConfigurationListener(RulesEngine engine) {
+		this.engine = engine;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderConfigurationListener#
+	 *      configurationChanged(java.lang.String, java.lang.Object)
+	 */
+	public void configurationChanged(String property, Object newValue) {
+		if (property.equals(TraceBuilderConfiguration.FORMATTER_NAME)) {
+			if (TraceBuilderConfiguration.ALLOW_FORMAT_CHANGE) {
+				engine.traceAPIChanged((String) newValue);
+			}
+		} else if (property.equals(TraceBuilderConfiguration.PRINTF_SUPPORT)
+				|| property.equals(TraceBuilderConfiguration.PRINTF_EXTENSION)) {
+			printfConfigurationChanged();
+		}
+	}
+
+	/**
+	 * Updates the printf configuration
+	 */
+	private void printfConfigurationChanged() {
+		boolean flag = TraceBuilderGlobals.getConfiguration().getFlag(
+				TraceBuilderConfiguration.PRINTF_SUPPORT);
+		String name = TraceBuilderGlobals.getConfiguration().getText(
+				TraceBuilderConfiguration.PRINTF_EXTENSION);
+		engine.enablePrintfParser(flag);
+		if (!flag) {
+			engine.setPrintfMacroExtension(""); //$NON-NLS-1$
+		} else {
+			engine.setPrintfMacroExtension(name);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceBuilderConfigurationListener#configurationCreated()
+	 */
+	public void configurationCreated() {
+		if (TraceBuilderConfiguration.ALLOW_FORMAT_CHANGE) {
+			engine.traceAPIChanged(TraceBuilderGlobals.getConfiguration()
+					.getText(TraceBuilderConfiguration.FORMATTER_NAME));
+		}
+		boolean flag = TraceBuilderGlobals.getConfiguration().getFlag(
+				TraceBuilderConfiguration.PRINTF_SUPPORT);
+		engine.enablePrintfParser(flag);
+		if (flag) {
+			engine.setPrintfMacroExtension(TraceBuilderGlobals
+					.getConfiguration().getText(
+							TraceBuilderConfiguration.PRINTF_EXTENSION));
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/RulesEngineConstants.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Properties associated with formatting rules
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialogFlag;
+import com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate;
+import com.nokia.tracebuilder.engine.rules.osttrace.OstTraceFormatRule;
+import com.nokia.tracebuilder.engine.rules.osttrace.OstTraceParserRule;
+import com.nokia.tracebuilder.engine.source.SourceParserRule;
+import com.nokia.tracebuilder.project.TraceProjectAPI;
+
+/**
+ * Constants for rules engine
+ * 
+ */
+interface RulesEngineConstants {
+
+	/**
+	 * Trace parsers
+	 */
+	SourceParserRule[] TRACE_PARSERS = { new OstTraceParserRule() };
+
+	/**
+	 * Printf parsers
+	 */
+	String[] PRINTF_PARSERS = { "RDebug::Print", //$NON-NLS-1$
+			"Kern::Printf" //$NON-NLS-1$
+	};
+
+	/**
+	 * List of supported API's
+	 */
+	TraceProjectAPI[] TRACE_APIS = { new OstTraceFormatRule() };
+
+	/**
+	 * Persistent extensions
+	 */
+	ClassNameWrapper[] PERSISTENT_EXTENSIONS = {
+			new ClassNameWrapper(InstrumentedTraceRuleImpl.STORAGE_NAME,
+					InstrumentedTraceRuleImpl.class),
+			new ClassNameWrapper(ParameterTypeMappingRule.STORAGE_NAME,
+					ParameterTypeMappingRule.class),
+			new ClassNameWrapper(ArrayParameterRuleImpl.STORAGE_NAME,
+					ArrayParameterRuleImpl.class) };
+
+	/**
+	 * Dialog flags for "Add Trace" dialog
+	 */
+	TraceObjectPropertyDialogFlag[] TRACE_FLAGS = { new AddThisPtrFlag(),
+			new AddFunctionParametersFlag(), new AddMatchingTraceFlag(), new AddReturnParameterFlag() };
+
+	/**
+	 * Dialog flags for instrumenter dialog.
+	 */
+	TraceObjectPropertyDialogFlag[] INSTRUMENTER_FLAGS = TRACE_FLAGS;
+
+	/**
+	 * Dialog flags for "Add Parameter" dialog
+	 */
+	TraceObjectPropertyDialogFlag[] PARAMETER_FLAGS = { new ArrayParameterFlag() };
+
+	/**
+	 * Templates used in "Add Trace" dialog
+	 */
+	TraceObjectPropertyDialogTemplate[] TRACE_TEMPLATES = {
+			new EntryExitTraceTemplate(), new PerformanceEventTemplate(), new StateTraceTemplate()};
+
+	/**
+	 * Templates used in instrumenter dialog
+	 */
+	TraceObjectPropertyDialogTemplate[] INSTRUMENTER_TEMPLATES = { new EntryExitInstrumenterTemplate() };
+
+	/**
+	 * Templates used with "Add Parameter" dialog
+	 */
+	TraceObjectPropertyDialogTemplate[] PARAMETER_TEMPLATES = { new ThisPointerParameterTemplate() };
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/RulesEngineModelListener.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,121 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 model listener
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceModelListener;
+import com.nokia.tracebuilder.model.TraceObject;
+import com.nokia.tracebuilder.model.TraceParameter;
+import com.nokia.tracebuilder.rules.FillerParameterRule;
+
+/**
+ * Trace model listener
+ * 
+ */
+final class RulesEngineModelListener implements TraceModelListener {
+
+	/**
+	 * Rules engine
+	 */
+	private final RulesEngine engine;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param engine
+	 *            rules engine
+	 */
+	RulesEngineModelListener(RulesEngine engine) {
+		this.engine = engine;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelListener#
+	 *      objectAdded(com.nokia.tracebuilder.model.TraceObject,
+	 *      com.nokia.tracebuilder.model.TraceObject)
+	 */
+	public void objectAdded(TraceObject owner, TraceObject object) {
+		// Updated in objectCreationComplete
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelListener#
+	 *      objectRemoved(com.nokia.tracebuilder.model.TraceObject,
+	 *      com.nokia.tracebuilder.model.TraceObject)
+	 */
+	public void objectRemoved(TraceObject owner, TraceObject object) {
+		if (owner instanceof Trace && object instanceof TraceParameter) {
+			engine.checkParameterTypes((Trace) owner);
+			if (object.getExtension(FillerParameterRule.class) == null) {
+				engine.checkFillerParameters((Trace) owner);
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelListener#
+	 *      propertyUpdated(com.nokia.tracebuilder.model.TraceObject, int)
+	 */
+	public void propertyUpdated(TraceObject object, int property) {
+		if (object.getModel().isValid() && object.isComplete()
+				&& object instanceof TraceParameter
+				&& property == TraceModelListener.TYPE) {
+			Trace owner = ((TraceParameter) object).getTrace();
+			if (owner.isComplete()) {
+				engine.checkParameterTypes(owner);
+				engine.checkFillerParameters(owner);
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelListener#
+	 *      objectCreationComplete(com.nokia.tracebuilder.model.TraceObject)
+	 */
+	public void objectCreationComplete(TraceObject object) {
+		if (object.getModel().isValid()) {
+			if (object instanceof TraceParameter) {
+				Trace owner = ((TraceParameter) object).getTrace();
+				if (owner.isComplete()) {
+					engine.checkParameterTypes(owner);
+					// When adding fillers, the check is not done
+					if (object.getExtension(FillerParameterRule.class) == null) {
+						engine.checkFillerParameters(owner);
+					}
+				}
+			} else if (object instanceof Trace) {
+				// When a trace with multiple parameters is created, the
+				// above branch does not get entered since the trace is not
+				// yet complete. Check is made after trace is complete
+				if (((Trace) object).getParameterCount() > 0) {
+					engine.checkParameterTypes((Trace) object);
+					engine.checkFillerParameters((Trace) object);
+				}
+			}
+		}
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/RulesEnginePluginManager.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,142 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 formatter / parser management
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import com.nokia.tracebuilder.engine.plugin.TraceAPIPluginManager;
+import com.nokia.tracebuilder.engine.rules.plugin.PluginTraceFormatRule;
+import com.nokia.tracebuilder.engine.rules.plugin.PluginTraceParserRule;
+import com.nokia.tracebuilder.model.TraceModel;
+import com.nokia.tracebuilder.model.TraceObject;
+import com.nokia.tracebuilder.plugin.TraceAPIFormatter;
+import com.nokia.tracebuilder.plugin.TraceAPIParser;
+import com.nokia.tracebuilder.project.TraceProjectAPI;
+import com.nokia.tracebuilder.project.TraceProjectAPIList;
+
+/**
+ * Plug-in formatter / parser management
+ * 
+ */
+final class RulesEnginePluginManager implements TraceAPIPluginManager,
+		TraceProjectAPIList {
+
+	/**
+	 * Rules engine
+	 */
+	private RulesEngine engine;
+
+	/**
+	 * Trace model
+	 */
+	private TraceModel model;
+
+	/**
+	 * List of API's
+	 */
+	private ArrayList<TraceProjectAPI> apis = new ArrayList<TraceProjectAPI>();
+
+	/**
+	 * Constructor
+	 * 
+	 * @param engine
+	 *            the plug-in engine
+	 */
+	RulesEnginePluginManager(RulesEngine engine) {
+		this.engine = engine;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.plugin.TraceAPIPluginManager#
+	 *      addFormatters(com.nokia.tracebuilder.plugin.TraceAPIFormatter[])
+	 */
+	public void addFormatters(TraceAPIFormatter[] formatters) {
+		if (formatters != null) {
+			for (TraceAPIFormatter element : formatters) {
+				apis.add(new PluginTraceFormatRule(element));
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.plugin.TraceAPIPluginManager#
+	 *      addParsers(com.nokia.tracebuilder.plugin.TraceAPIParser[])
+	 */
+	public void addParsers(TraceAPIParser[] parsers) {
+		// All parsers are registered to the model
+		if (parsers != null) {
+			for (TraceAPIParser element : parsers) {
+				model.addExtension(new PluginTraceParserRule(element));
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.plugin.TraceAPIPluginManager#createDefaultAPI()
+	 */
+	public void createDefaultAPI() {
+		engine.setDefaultTraceAPI();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelExtension#getOwner()
+	 */
+	public TraceObject getOwner() {
+		return model;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelExtension#
+	 *      setOwner(com.nokia.tracebuilder.model.TraceObject)
+	 */
+	public void setOwner(TraceObject owner) {
+		model = (TraceModel) owner;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.project.TraceProjectAPIList#getAPIs()
+	 */
+	public Iterator<TraceProjectAPI> getAPIs() {
+		return apis.iterator();
+	}
+
+	/**
+	 * Adds an API to the list
+	 * 
+	 * @param api
+	 *            the API
+	 */
+	void addAPI(TraceProjectAPI api) {
+		apis.add(api);
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/RulesEngineResetListener.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,95 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Model reset listener
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceGroup;
+import com.nokia.tracebuilder.model.TraceModel;
+import com.nokia.tracebuilder.model.TraceModelResetListener;
+import com.nokia.tracebuilder.project.TraceProjectAPI;
+
+/**
+ * Model reset listener
+ * 
+ */
+final class RulesEngineResetListener implements TraceModelResetListener {
+
+	/**
+	 * Rule engine
+	 */
+	private final RulesEngine engine;
+
+	/**
+	 * Trace model
+	 */
+	private final TraceModel model;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param engine
+	 *            rule engine
+	 * @param model
+	 *            the trace model
+	 */
+	RulesEngineResetListener(RulesEngine engine, TraceModel model) {
+		this.engine = engine;
+		this.model = model;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelResetListener#modelResetting()
+	 */
+	public void modelResetting() {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelResetListener#modelReset()
+	 */
+	public void modelReset() {
+		model.removeExtensions(TraceProjectAPI.class);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelResetListener#modelValid(boolean)
+	 */
+	public void modelValid(boolean valid) {
+		if (valid) {
+			model.startProcessing();
+			try {
+				// Creates the trace API if it does not exist yet
+				engine.setDefaultTraceAPI();
+				// Adds filler parameters to correct places
+				for (TraceGroup group : model) {
+					for (Trace trace : group) {
+						engine.checkFillerParameters(trace);
+					}
+				}
+			} finally {
+				model.processingComplete();
+			}
+		}
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/SourceParserRuleBase.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,290 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Implementation of parser rule
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import com.nokia.tracebuilder.engine.TraceLocation;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.TraceBuilderErrorCode;
+import com.nokia.tracebuilder.engine.source.SourceParserRule;
+import com.nokia.tracebuilder.engine.utils.TraceUtils;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceGroup;
+import com.nokia.tracebuilder.model.TraceModelExtension;
+import com.nokia.tracebuilder.project.TraceLocationParser;
+import com.nokia.tracebuilder.project.TraceProjectAPI;
+import com.nokia.tracebuilder.source.FormatMapping;
+import com.nokia.tracebuilder.source.SourceExcludedArea;
+import com.nokia.tracebuilder.source.SourceIterator;
+import com.nokia.tracebuilder.source.SourceParser;
+import com.nokia.tracebuilder.source.SourceParserException;
+
+/**
+ * Base class for parser rules. Instances of this class are added to the trace
+ * model. The source engine uses the parses it finds from the model to find
+ * trace locations from source files
+ * 
+ */
+public abstract class SourceParserRuleBase extends RuleBase implements
+		SourceParserRule, TraceLocationParser {
+
+	/**
+	 * Length of line comment tag "// "
+	 */
+	private static final int LINE_COMMENT_TAG_LENGTH = 3; // CodForChk_Dis_Magic
+
+	/**
+	 * Tag to be searched from source
+	 */
+	private String tag;
+
+	/**
+	 * Allowed tag suffixes
+	 */
+	private ArrayList<String> tagSuffixes = new ArrayList<String>();
+
+	/**
+	 * Constructor
+	 * 
+	 * @param tag
+	 *            the tag to be searched from source
+	 * @param tagSuffixes
+	 *            the list of allowed suffixes to the tag
+	 */
+	protected SourceParserRuleBase(String tag, String[] tagSuffixes) {
+		this.tag = tag;
+		// Adds the sub-formats to the parsers
+		if (tagSuffixes != null) {
+			int len = tagSuffixes.length;
+			for (int i = 0; i < len; i++) {
+				this.tagSuffixes.add(tagSuffixes[i]);
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.source.SourceParserRule#getSearchTag()
+	 */
+	public String getSearchTag() {
+		return tag;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.source.SourceParserRule#
+	 *      isAllowedTagSuffix(java.lang.String)
+	 */
+	public boolean isAllowedTagSuffix(String tag) {
+		boolean retval = false;
+		if (tag != null) {
+			if (tag.length() == 0 && tagSuffixes.isEmpty()) {
+				retval = true;
+			} else {
+				for (int i = 0; i < tagSuffixes.size() && !retval; i++) {
+					String s = tagSuffixes.get(i);
+					if (s.length() == tag.length()) {
+						retval = true;
+						for (int j = 0; j < s.length() && retval; j++) {
+							char c1 = s.charAt(j);
+							// '?' can be any character
+							if (c1 != '?') {
+								retval = tag.charAt(j) == c1;
+							}
+						}
+					}
+				}
+			}
+		}
+		return retval;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.source.SourceParserRule#
+	 *      processNewLocation(com.nokia.tracebuilder.engine.TraceLocation)
+	 */
+	public void processNewLocation(TraceLocation location) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.project.TraceLocationParser#getLocationGroup()
+	 */
+	public String getLocationGroup() {
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.source.SourceParserRule#
+	 *      convertLocation(com.nokia.tracebuilder.engine.TraceLocation)
+	 */
+	public TraceConversionResult convertLocation(TraceLocation location)
+			throws TraceBuilderException {
+		// If converting an unrelated location to trace, the name
+		// from the location is used
+		TraceConversionResult result = new TraceConversionResult();
+		result.name = location.getConvertedName();
+		// Old Symbian traces could include comment associated with the location
+		// If it exists, it will be used as text
+		String listTitle = location.getLocationList().getListTitle();
+		if (listTitle != null && listTitle.equals("SymbianTrace")) { //$NON-NLS-1$
+			SourceExcludedArea excludedArea = findLocationComment(location);
+			if (excludedArea != null
+					&& excludedArea.getType() == SourceExcludedArea.LINE_COMMENT) {
+				// This expects the %FORMATTED_TRACE% formatting
+				// Removes the '// ' from the comment
+				SourceParser parser = location.getParser();
+				String comment = parser.getData(excludedArea.getOffset()
+						+ LINE_COMMENT_TAG_LENGTH, excludedArea.getLength()
+						- LINE_COMMENT_TAG_LENGTH);
+				Iterator<TraceGroup> groups = getOwner().getModel().getGroups();
+				if (groups.hasNext()) {
+					result.group = groups.next().getName();
+				}
+				result.text = comment.trim();
+			}			
+		}
+		Iterator<String> params = location.getParameters();
+		if (params.hasNext()) {
+			result.parameters = new ArrayList<ParameterConversionResult>();
+			while (params.hasNext()) {
+				String label = params.next();
+				ParameterConversionResult res = new ParameterConversionResult();
+				res.name = TraceUtils.convertName(label);
+				res.type = null; // Unknown type -> Warning will be created
+				result.parameters.add(res);
+			}
+		}
+		return result;
+	}
+
+	/**
+	 * Maps a format to conversion result
+	 * 
+	 * @param mapping
+	 *            the mapping
+	 * @return the conversion result
+	 */
+	protected ParameterConversionResult mapFormatToConversionResult(
+			FormatMapping mapping) {
+		ParameterConversionResult param = new ParameterConversionResult();
+		param.type = mapping.type;
+		if (mapping.isArray) {
+			param.extensions = new ArrayList<TraceModelExtension>();
+			param.extensions.add(new ArrayParameterRuleImpl());
+		}
+		return param;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.source.SourceParserRule#
+	 *      findLocationComment(com.nokia.tracebuilder.engine.TraceLocation)
+	 */
+	public SourceExcludedArea findLocationComment(TraceLocation location) {
+		SourceParser parser = location.getParser();
+		SourceExcludedArea excludedArea = null;
+		if (parser != null) {
+			try {
+				int offset = location.getOffset() + location.getLength();
+				SourceIterator itr = parser.createIterator(offset,
+						SourceParser.SKIP_WHITE_SPACES);
+				char c = itr.next();
+				if (c == ';') {
+					offset = itr.currentIndex();
+					c = itr.next();
+				}
+				boolean skippedReturn = false;
+				int commentStart = itr.currentIndex();
+				for (int i = offset; i < commentStart; i++) {
+					c = parser.getData(i);
+					if (c == '\n') {
+						skippedReturn = true;
+					}
+				}
+				// Comment must be on same line
+				if (!skippedReturn) {
+					excludedArea = parser.getExcludedArea(commentStart);
+				}
+				if (excludedArea == null) {
+					// If comment is not on same line, the previous line is
+					// checked
+					offset = parser.findStartOfLine(location.getOffset(), true,
+							true);
+					excludedArea = parser.getExcludedArea(offset - 1);
+				}
+			} catch (SourceParserException e) {
+			}
+		}
+		return excludedArea;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.source.SourceParserRule#getLocationParser()
+	 */
+	public TraceLocationParser getLocationParser() {
+		return this;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.project.TraceLocationParser#
+	 *      isLocationConverted(com.nokia.tracebuilder.engine.TraceLocation)
+	 */
+	public boolean isLocationConverted(TraceLocation location) {
+		return false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.project.TraceLocationParser#
+	 *      checkLocationValidity(com.nokia.tracebuilder.engine.TraceLocation)
+	 */
+	public TraceBuilderErrorCode checkLocationValidity(TraceLocation location) {
+		Trace trace = location.getTrace();
+		TraceBuilderErrorCode retval = TraceBuilderErrorCode.TRACE_DOES_NOT_EXIST;
+		if (trace != null) {
+			retval = TraceBuilderErrorCode.OK;
+		} else {
+			// If the API does not match the parser, the needs conversion flag
+			// is set
+			TraceProjectAPI api = getOwner().getModel().getExtension(
+					TraceProjectAPI.class);
+			if (!api.getName().equals(location.getParserRule().getName())) {
+				retval = TraceBuilderErrorCode.TRACE_NEEDS_CONVERSION;
+			}
+		}
+		return retval;
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/StartOfFunctionLocationRule.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 rule for start of function
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import com.nokia.tracebuilder.engine.source.SourceLocationRule;
+
+/**
+ * Location rule for start of function
+ * 
+ */
+final class StartOfFunctionLocationRule extends RuleBase implements
+		SourceLocationRule {
+
+	/**
+	 * Location rule offset. Should be large enough to cover a function
+	 */
+	private static final int OFFSET = -100000; // CodForChk_Dis_Magic
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.source.SourceLocationRule#getType()
+	 */
+	public int getLocationType() {
+		return SourceLocationRule.CONTEXT_RELATIVE;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.source.SourceLocationRule#getOffset()
+	 */
+	public int getLocationOffset() {
+		return OFFSET;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.source.SourceLocationRule#isRemovedAfterInsert()
+	 */
+	public boolean isRemovedAfterInsert() {
+		return true;
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/StateTraceRule.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,93 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Rule for state traces
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import com.nokia.tracebuilder.engine.utils.TraceUtils;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceObjectRule;
+import com.nokia.tracebuilder.rules.TraceParameterRestrictionRule;
+import com.nokia.tracebuilder.source.SourceContext;
+
+/**
+ * Rule for state traces
+ * 
+ */
+public class StateTraceRule extends AutomaticTraceTextRule implements
+		CopyExtensionRule, TraceParameterRestrictionRule {
+
+	/**
+	 * Mandatory parameter count
+	 */
+	private static final int MANDATORY_PARAMETER_COUNT = 2; // CodForChk_Dis_Magic
+	
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.rules.TraceParameterRestrictionRule#canAddParameters()
+	 */
+	public boolean canAddParameters() {
+		boolean retval;
+		Trace trace = (Trace) getOwner();
+		// Supports max three parameters
+		if (trace != null && trace.getParameterCount() <= MANDATORY_PARAMETER_COUNT) { 
+			retval = true;
+		} else {
+			retval = false;
+		}
+		return retval;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.rules.TraceParameterRestrictionRule#canRemoveParameters()
+	 */
+	public boolean canRemoveParameters() {
+		boolean retval;
+		Trace trace = (Trace) getOwner();
+		// There must be at least two parameters in State trace
+		if (trace != null && trace.getParameterCount() > MANDATORY_PARAMETER_COUNT) { 
+			retval = true;
+		} else {
+			retval = false;
+		}
+		return retval;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.CopyExtensionRule#createCopy()
+	 */
+	public TraceObjectRule createCopy() {
+		return new StateTraceRule();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.AutomaticTraceTextRule#
+	 *      formatTrace(com.nokia.tracebuilder.source.SourceContext)
+	 */
+	@Override
+	public String formatTrace(SourceContext context) {
+		return TraceUtils.formatTrace(RuleUtils.TEXT_FORMAT_BASE, context
+				.getClassName(), context.getFunctionName());
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/StateTraceTemplate.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,111 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Template for State trace
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import java.util.List;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.model.TraceModelExtension;
+import com.nokia.tracebuilder.project.GroupNameHandlerBase;
+
+/**
+ * Template for State trace
+ * 
+ */
+public final class StateTraceTemplate extends ContextTemplateBase {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate#getTitle()
+	 */
+	public String getTitle() {
+		return RuleUtils.getEntryTemplateTitle(RuleUtils.TYPE_STATE_TRACE);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TracePropertyDialogTemplate#getGroupName()
+	 */
+	public String getGroupName() {
+		GroupNameHandlerBase groupNameHandler = TraceBuilderGlobals.getGroupNameHandler();
+		return groupNameHandler.getDefaultGroups()[groupNameHandler.getStateGroupIdIndex()];
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate#
+	 *      createExtensions(java.util.List)
+	 */
+	public void createExtensions(List<TraceModelExtension> list) {
+		list.add(new StateTraceRule());
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.ContextTemplateBase#getTraceNameFormat()
+	 */
+	@Override
+	protected String getTraceNameFormat() {
+		return RuleUtils.createEntryTraceNameFormat(RuleUtils.TYPE_STATE_TRACE);
+	}
+
+	/* (non-Javadoc)
+	 * @see com.nokia.tracebuilder.engine.rules.ContextTemplateBase#getTraceTextFormat()
+	 */
+	@Override
+	protected String getTraceTextFormat() {
+		return ""; //$NON-NLS-1$
+	}
+
+	/* (non-Javadoc)
+	 * @see com.nokia.tracebuilder.engine.rules.ContextTemplateBase#isIDEnabled()
+	 */
+	@Override
+	public boolean isIDEnabled() {
+		return true;
+	}
+
+	/* (non-Javadoc)
+	 * @see com.nokia.tracebuilder.engine.rules.ContextTemplateBase#isNameEnabled()
+	 */
+	@Override
+	public boolean isNameEnabled() {
+		return true;
+	}
+	
+	/* (non-Javadoc)
+	 * @see com.nokia.tracebuilder.engine.rules.ContextTemplateBase#isTargetEnabled()
+	 */
+	@Override
+	public boolean isTargetEnabled() {
+		return false;
+	}
+	
+	/* (non-Javadoc)
+	 * @see com.nokia.tracebuilder.engine.rules.ContextTemplateBase#isValueEnabled()
+	 */
+	@Override
+	public boolean isValueEnabled() {
+		return false;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/ThisPointerParameterTemplate.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,135 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Template for "this" pointer parameter.
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import java.util.List;
+
+import com.nokia.tracebuilder.engine.TraceParameterPropertyDialogTemplate;
+import com.nokia.tracebuilder.model.TraceModelExtension;
+import com.nokia.tracebuilder.model.TraceParameter;
+
+/**
+ * Template for "this" pointer parameter.
+ * 
+ */
+final class ThisPointerParameterTemplate implements
+		TraceParameterPropertyDialogTemplate {
+
+	/**
+	 * Parameter name
+	 */
+	static final String PARAMETER_NAME = "this"; //$NON-NLS-1$
+
+	/**
+	 * Title for the template
+	 */
+	static final String UI_TITLE = Messages
+			.getString("ThisPointerParameterTemplate.Title"); //$NON-NLS-1$
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate#getTitle()
+	 */
+	public String getTitle() {
+		return UI_TITLE;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate#getName()
+	 */
+	public String getName() {
+		return PARAMETER_NAME;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate#getValue()
+	 */
+	public String getValue() {
+		return PARAMETER_NAME;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate#getType()
+	 */
+	public String getType() {
+		return TraceParameter.HEX32;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceParameterPropertyDialogTemplate#isTypeEnabled()
+	 */
+	public boolean isTypeEnabled() {
+		return false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate#isIDEnabled()
+	 */
+	public boolean isIDEnabled() {
+		return true;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate#isNameEnabled()
+	 */
+	public boolean isNameEnabled() {
+		return false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate#isValueEnabled()
+	 */
+	public boolean isValueEnabled() {
+		return false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate#isTargetEnabled()
+	 */
+	public boolean isTargetEnabled() {
+		return true;
+	}		
+	
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceObjectPropertyDialogTemplate#
+	 *      createExtensions(java.util.List)
+	 */
+	public void createExtensions(List<TraceModelExtension> list) {
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/TraceFormatRuleBase.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Implementation of formatting rule
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import com.nokia.tracebuilder.engine.source.TraceFormattingRule;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceParameter;
+import com.nokia.tracebuilder.project.TraceProjectAPI;
+
+/**
+ * Base class for project API's. Instance of this is added to the model and
+ * affect all traces which do not have their own formatter.
+ * 
+ */
+public abstract class TraceFormatRuleBase extends RuleBase implements
+		TraceFormattingRule, TraceProjectAPI {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.source.TraceFormattingRule#
+	 *      mapNameToSource(com.nokia.tracebuilder.model.Trace)
+	 */
+	public String mapNameToSource(Trace trace) {
+		return trace.getName();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.source.TraceFormattingRule#
+	 *      mapParameterCountToSource(com.nokia.tracebuilder.model.Trace, int)
+	 */
+	public String mapParameterCountToSource(Trace trace, int count) {
+		return String.valueOf(count);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.source.TraceFormattingRule#
+	 *      parameterAboutToBeRemoved(com.nokia.tracebuilder.model.TraceParameter,
+	 *      int)
+	 */
+	public void parameterAboutToBeRemoved(TraceParameter parameter, int index) {
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/TraceParameterFormattingRuleBase.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 parameter formatting rules
+*
+*/
+package com.nokia.tracebuilder.engine.rules;
+
+import com.nokia.tracebuilder.engine.source.TraceParameterFormattingRule;
+
+/**
+ * Base class for parameter formatting rules
+ * 
+ */
+class TraceParameterFormattingRuleBase extends RuleBase implements
+		TraceParameterFormattingRule {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.source.TraceParameterFormattingRule#
+	 *      isShownInSource()
+	 */
+	public boolean isShownInSource() {
+		return true;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.source.TraceParameterFormattingRule#
+	 *      mapNameToSource(java.lang.String)
+	 */
+	public String mapNameToSource(String originalName) {
+		return originalName;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/messages.properties	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,13 @@
+AddFunctionParametersFlag.Title=Add function parameters
+AddThisPtrFlag.Title=Add "this" pointer parameter (Note! May cause compilation problems with static functions)
+AddReturnParameterFlag.Title=Add return value to exit traces
+ThisPointerParameterTemplate.Title=Object Pointer
+ArrayParameterFlag.Title=Array Parameter
+RuleUtils.FunctionEntryTitle=Function Entry-Exit
+RuleUtils.PerformanceEventTitle=Performance Event Entry-Exit
+RuleUtils.StateTraceTitle=State Trace
+FunctionReturnLocationMultiplierRule.InvalidReturnStatement=Exit trace was not added to source, since it might produce unwanted side effects
+RuleUtils.FailedToParseReturnValues=Failed to parse return values
+AutoAddFunctionParametersRule.UnrecognizedTypeWarning=Unrecognized type -> Traced as pointer
+AutoAddMatchingTraceRule.DuplicateName=Duplicate name changed, original was 
+AddMatchingTraceFlag.Title=Add exit traces
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/osttrace/OstConstants.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Constants for OST parser and formatter
+*
+*/
+package com.nokia.tracebuilder.engine.rules.osttrace;
+
+/**
+ * Constants for OST parser and formatter
+ * 
+ */
+interface OstConstants {
+
+	/**
+	 * API tag for macros which have the preprocessor level parameter
+	 */
+	String PREPROCESSOR_LEVEL_TAG = "Def"; //$NON-NLS-1$
+
+	/**
+	 * API tag for function entry traces
+	 */
+	String FUNCTION_ENTRY_TAG = "FunctionEntry"; //$NON-NLS-1$
+
+	/**
+	 * API tag for function exit traces
+	 */
+	String FUNCTION_EXIT_TAG = "FunctionExit"; //$NON-NLS-1$
+
+	/**
+	 * API tag for performance event start
+	 */
+	String PERFORMANCE_EVENT_START_TAG = "EventStart"; //$NON-NLS-1$
+
+	/**
+	 * API tag for performance event stop
+	 */
+	String PERFORMANCE_EVENT_STOP_TAG = "EventStop"; //$NON-NLS-1$
+
+	/**
+	 * API tag for traces with user-defined data format
+	 */
+	String DATA_TRACE_TAG = "Data"; //$NON-NLS-1$
+	
+	/**
+	 * API tag for state traces
+	 */
+	String STATE_TRACE_TAG = "State"; //$NON-NLS-1$
+
+	/**
+	 * API tag for traces with extension parameters
+	 */
+	String EXTENSION_TRACE_TAG = "Ext"; //$NON-NLS-1$
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/osttrace/OstTraceFormatRule.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,624 @@
+/*
+ * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ * Formatting rule for OST traces
+ *
+ */
+package com.nokia.tracebuilder.engine.rules.osttrace;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.rules.AutomaticTraceTextRule;
+import com.nokia.tracebuilder.engine.rules.ComplexHeaderRule;
+import com.nokia.tracebuilder.engine.rules.EntryTraceRule;
+import com.nokia.tracebuilder.engine.rules.ExitTraceRule;
+import com.nokia.tracebuilder.engine.rules.PerformanceEventRuleBase;
+import com.nokia.tracebuilder.engine.rules.PerformanceEventStartRule;
+import com.nokia.tracebuilder.engine.rules.PerformanceEventStopRule;
+import com.nokia.tracebuilder.engine.rules.StateTraceRule;
+import com.nokia.tracebuilder.engine.rules.TraceFormatRuleBase;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceModelListener;
+import com.nokia.tracebuilder.model.TraceObject;
+import com.nokia.tracebuilder.model.TraceParameter;
+import com.nokia.tracebuilder.plugin.TraceFormatConstants;
+import com.nokia.tracebuilder.plugin.TraceHeaderContribution;
+import com.nokia.tracebuilder.plugin.TraceAPIFormatter.TraceFormatType;
+import com.nokia.tracebuilder.project.GroupNameHandlerBase;
+import com.nokia.tracebuilder.rules.HiddenTraceObjectRule;
+import com.nokia.tracebuilder.source.SourceConstants;
+import com.nokia.tracebuilder.source.SourceUtils;
+import java.util.regex.Matcher;
+
+/**
+ * Formatting rule for OST traces.
+ * 
+ */
+public final class OstTraceFormatRule extends TraceFormatRuleBase implements
+		TraceHeaderContribution, TraceModelListener {
+
+	/**
+	 * Separator for parameters within trace text
+	 */
+	private static final String PARAMETER_VALUE_SEPARATOR = "="; //$NON-NLS-1$
+
+	/**
+	 * Separator for parameter name ane value
+	 */
+	private static final String PARAMETER_SEPARATOR = ";"; //$NON-NLS-1$
+
+	/**
+	 * String parameter tag
+	 */
+	private static final String STRING_PARAMETER_TAG = "%s"; //$NON-NLS-1$
+
+	/**
+	 * Hex parameter tag
+	 */
+	private static final String HEX_PARAMETER_TAG = "0x%x"; //$NON-NLS-1$
+
+	/**
+	 * SDEC parameter tag
+	 */
+	private static final String SDEC_PARAMETER_TAG = "%d"; //$NON-NLS-1$
+
+	/**
+	 * Category for traces
+	 */
+	private static final String TRACE_CATEGORY = "KBTraceCategoryOpenSystemTrace"; //$NON-NLS-1$
+
+	/**
+	 * Title shown in UI
+	 */
+	private static final String UI_TITLE = "Open System Trace"; //$NON-NLS-1$
+
+	/**
+	 * Name for storage
+	 */
+	public static final String STORAGE_NAME = "OstTraceFormat"; //$NON-NLS-1$
+
+	/**
+	 * OstTraceEventStart tag
+	 */
+	public static final String OST_TRACE_EVENT_START_TAG = "OstTraceEventStart"; //$NON-NLS-1$
+
+	/**
+	 * OstTraceEventStop tag
+	 */
+	public static final String OST_TRACE_EVENT_STOP_TAG = "OstTraceEventStop"; //$NON-NLS-1$
+
+	/**
+	 * Source formatting
+	 */
+	private static final String TRACE_FORMAT = "OstTrace" //$NON-NLS-1$
+			+ TraceFormatConstants.PARAM_COUNT_FORMAT // Number of parameters
+			+ "( " //$NON-NLS-1$
+			+ TraceFormatConstants.GROUP_FORMAT // Group name
+			+ ", " //$NON-NLS-1$
+			+ TraceFormatConstants.NAME_FORMAT // Trace name
+			+ ", " //$NON-NLS-1$
+			+ TraceFormatConstants.TEXT_FORMAT // Trace text
+			+ TraceFormatConstants.PARAMETERS_FORMAT // Trace parameters
+			+ " );"; //$NON-NLS-1$
+
+	/**
+	 * Source formatting with complex traces
+	 */
+	private static final String COMPLEX_TRACE_FORMAT = "OstTraceExt" //$NON-NLS-1$
+			+ TraceFormatConstants.PARAM_COUNT_FORMAT // Number of parameters
+			+ "( " //$NON-NLS-1$
+			+ TraceFormatConstants.GROUP_FORMAT // Group name
+			+ ", " //$NON-NLS-1$
+			+ TraceFormatConstants.NAME_FORMAT // Trace name
+			+ ", " //$NON-NLS-1$
+			+ TraceFormatConstants.TEXT_FORMAT // Trace text
+			+ TraceFormatConstants.PARAMETERS_FORMAT // Trace parameters
+			+ " );"; //$NON-NLS-1$
+
+	/**
+	 * Function entry formatting
+	 */
+	private static final String ENTRY_TRACE_FORMAT = "OstTraceFunctionEntry" //$NON-NLS-1$
+			+ TraceFormatConstants.PARAM_COUNT_FORMAT + "( " //$NON-NLS-1$
+			+ TraceFormatConstants.NAME_FORMAT // Trace name
+			+ TraceFormatConstants.PARAMETERS_FORMAT // Trace parameters
+			+ " );"; //$NON-NLS-1$
+
+	/**
+	 * Function entry Ext formatting
+	 */
+	private static final String ENTRY_TRACE_EXT_FORMAT_THIS = "OstTraceFunctionEntryExt( " //$NON-NLS-1$
+			+ TraceFormatConstants.NAME_FORMAT // Trace name
+			+ ", this );"; //$NON-NLS-1$
+
+	/**
+	 * Function exit formatting
+	 */
+	private static final String EXIT_TRACE_FORMAT = "OstTraceFunctionExit" //$NON-NLS-1$
+			+ TraceFormatConstants.PARAM_COUNT_FORMAT + "( " //$NON-NLS-1$
+			+ TraceFormatConstants.NAME_FORMAT // Trace name
+			+ TraceFormatConstants.PARAMETERS_FORMAT // Trace parameters
+			+ " );"; //$NON-NLS-1$
+
+	/**
+	 * Function exit Ext formatting
+	 */
+	private static final String EXIT_TRACE_EXT_FORMAT = "OstTraceFunctionExitExt( " //$NON-NLS-1$
+			+ TraceFormatConstants.NAME_FORMAT // Trace name
+			+ TraceFormatConstants.PARAMETERS_FORMAT // Trace parameters
+			+ " );"; //$NON-NLS-1$
+
+	/**
+	 * State formatting
+	 */
+	private static final String STATE_TRACE_FORMAT = "OstTraceState" //$NON-NLS-1$
+			+ TraceFormatConstants.PARAM_COUNT_FORMAT
+			+ "( " //$NON-NLS-1$
+			+ TraceFormatConstants.NAME_FORMAT // Trace name
+			+ TraceFormatConstants.STATE_MACHINE_NAME_FORMAT
+			+ TraceFormatConstants.STATE_MACHINE_STATE_FORMAT
+			+ TraceFormatConstants.PARAMETERS_FORMAT // Trace parameters
+			+ " );"; //$NON-NLS-1$
+
+	/**
+	 * Performance event start formatting
+	 */
+	private static final String EVENT_START_FORMAT = OST_TRACE_EVENT_START_TAG
+			+ TraceFormatConstants.PARAM_COUNT_FORMAT + "( " //$NON-NLS-1$
+			+ TraceFormatConstants.NAME_FORMAT // Trace name
+			+ ", " //$NON-NLS-1$
+			+ TraceFormatConstants.EVENT_NAME_FORMAT // Event name
+			+ TraceFormatConstants.PARAMETERS_FORMAT // Trace parameters
+			+ " );"; //$NON-NLS-1$
+
+	/**
+	 * Performance event stop formatting
+	 */
+	private static final String EVENT_STOP_FORMAT = OST_TRACE_EVENT_STOP_TAG
+			+ "( " //$NON-NLS-1$
+			+ TraceFormatConstants.NAME_FORMAT // Trace name
+			+ ", " //$NON-NLS-1$
+			+ TraceFormatConstants.EVENT_NAME_FORMAT // Event name
+			+ ", " //$NON-NLS-1$
+			// Start Event Trace name
+			+ TraceFormatConstants.EVENT_START_TRACE_NAME_FORMAT 
+			+ TraceFormatConstants.PARAMETERS_FORMAT // Trace parameters
+			+ " );"; //$NON-NLS-1$
+
+	/**
+	 * Ext-function declaration format
+	 */
+	private static final String HEADER_FORMAT = "OstTraceGen" //$NON-NLS-1$
+			+ TraceFormatConstants.PARAM_COUNT_FORMAT // Number of parameters
+			+ "( TUint32 aTraceID" //$NON-NLS-1$
+			+ TraceFormatConstants.PARAMETERS_FORMAT // Trace parameters
+			+ " )"; //$NON-NLS-1$
+
+	/**
+	 * Activation query formatting
+	 */
+	private static final String ACTIVATION_FORMAT = "BTrace8( " //$NON-NLS-1$
+			+ TRACE_CATEGORY + ", " //$NON-NLS-1$
+			+ "EOstTraceActivationQuery, KOstTraceComponentID, aTraceID )"; //$NON-NLS-1$
+
+	/**
+	 * Buffered trace format
+	 */
+	private static final String TRACE_BUFFER_FORMAT = "OstSendNBytes( " //$NON-NLS-1$
+			+ TRACE_CATEGORY + ", " //$NON-NLS-1$
+			+ "EOstTrace, KOstTraceComponentID, aTraceID, " //$NON-NLS-1$
+			+ TraceFormatConstants.DATA_BUFFER_FORMAT // Trace data
+			+ ", " //$NON-NLS-1$
+			+ TraceFormatConstants.DATA_LENGTH_FORMAT // Trace data length
+			+ " );"; //$NON-NLS-1$
+
+	/**
+	 * Packed trace format
+	 */
+	private static final String TRACE_PACKED_FORMAT = "BTraceContext12( " //$NON-NLS-1$
+			+ TRACE_CATEGORY + ", " //$NON-NLS-1$
+			+ "EOstTrace, KOstTraceComponentID, aTraceID, " //$NON-NLS-1$
+			+ TraceFormatConstants.DATA_BUFFER_FORMAT // Trace data
+			+ " );"; //$NON-NLS-1$
+
+	/**
+	 * #include format
+	 */
+	private String INCLUDE_FORMAT = "#include \"OstTraceDefinitions.h\"\r\n" //$NON-NLS-1$
+			+ "#ifdef OST_TRACE_COMPILER_IN_USE\r\n#include \"" //$NON-NLS-1$
+			+ TraceFormatConstants.INCLUDE_FORMAT + "\"\r\n#endif"; //$NON-NLS-1$
+
+	/**
+	 * Template for the OstTraceDefinitions.h header file
+	 */
+	private static final String[] MAIN_HEADER_TEMPLATE = { "\r\n" //$NON-NLS-1$
+			+ "// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler\r\n" //$NON-NLS-1$
+			+ "// REMOVE BEFORE CHECK-IN TO VERSION CONTROL\r\n" //$NON-NLS-1$
+			+ "#define OST_TRACE_COMPILER_IN_USE\r\n" //$NON-NLS-1$
+			+ "#include <OpenSystemTrace.h>\r\n#endif\r\n" }; //$NON-NLS-1$
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.project.TraceProjectAPI#getName()
+	 */
+	public String getName() {
+		return STORAGE_NAME;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.project.TraceProjectAPI#getTitle()
+	 */
+	public String getTitle() {
+		return UI_TITLE;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.source.TraceFormattingRule#
+	 *      getFormat(com.nokia.tracebuilder.model.Trace,
+	 *      com.nokia.tracebuilder.plugin.TraceAPIFormatter.TraceFormatType)
+	 */
+	public String getFormat(Trace trace, TraceFormatType formatType) { // CodForChk_Dis_ComplexFunc
+		String retval;
+		if (formatType == TraceFormatType.NORMAL_TRACE
+				|| formatType == TraceFormatType.COMPLEX_TRACE) {
+			if (trace.getExtension(PerformanceEventStartRule.class) != null) {
+				retval = EVENT_START_FORMAT;
+			} else if (trace.getExtension(PerformanceEventStopRule.class) != null) {
+				retval = EVENT_STOP_FORMAT;
+			} else if (trace.getExtension(EntryTraceRule.class) != null) {
+				// If the trace is entry trace with function parameters, the
+				// parameters are not inserted into source. Instead, only the
+				// "this" pointer is added
+				if (trace.getExtension(ComplexHeaderRule.class) != null) {
+					retval = ENTRY_TRACE_EXT_FORMAT_THIS;
+				} else {
+					retval = ENTRY_TRACE_FORMAT;
+				}
+			} else if (trace.getExtension(ExitTraceRule.class) != null) {
+				if (trace.getExtension(ComplexHeaderRule.class) != null) {
+					retval = EXIT_TRACE_EXT_FORMAT;
+				} else {
+					retval = EXIT_TRACE_FORMAT;
+				}
+			} else if (trace.getExtension(StateTraceRule.class) != null) {
+				retval = STATE_TRACE_FORMAT;
+			} else {
+				if (formatType == TraceFormatType.NORMAL_TRACE) {
+					retval = TRACE_FORMAT;
+				} else if (formatType == TraceFormatType.COMPLEX_TRACE) {
+					retval = COMPLEX_TRACE_FORMAT;
+				} else {
+					retval = null;
+				}
+			}
+		} else {
+			if (formatType == TraceFormatType.HEADER) {
+				retval = HEADER_FORMAT;
+			} else if (formatType == TraceFormatType.TRACE_BUFFER) {
+				retval = TRACE_BUFFER_FORMAT;
+			} else if (formatType == TraceFormatType.TRACE_PACKED) {
+				retval = TRACE_PACKED_FORMAT;
+			} else if (formatType == TraceFormatType.TRACE_ACTIVATION) {
+				retval = ACTIVATION_FORMAT;
+			} else if (formatType == TraceFormatType.INCLUDE_FORMAT) {
+				retval = INCLUDE_FORMAT;
+			} else {
+				retval = null;
+			}
+		}
+		return retval;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.source.SourceFormatRule#
+	 *      mapParameterCountToSource(com.nokia.tracebuilder.model.Trace, int)
+	 */
+	@Override
+	public String mapParameterCountToSource(Trace trace, int count) {
+		String retval;
+		ComplexHeaderRule rule = trace.getExtension(ComplexHeaderRule.class);
+		if (rule != null && rule.getTraceIDDefineExtension() != null) {
+			// Uses the extension tag with extension headers
+			retval = OstConstants.EXTENSION_TRACE_TAG;
+		} else {
+			retval = String.valueOf(count);
+		}
+		return retval;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.project.TraceHeaderContribution#
+	 *      getContribution(com.nokia.tracebuilder.project.TraceHeaderContribution.TraceHeaderContributionType)
+	 */
+	public String[] getContribution(TraceHeaderContributionType type) {
+		String[] retval = null;
+		if (type == TraceHeaderContributionType.GLOBAL_DEFINES) {
+			retval = new String[] { "KOstTraceComponentID 0x" //$NON-NLS-1$
+					+ Integer.toHexString(getOwner().getModel().getID()) };
+		} else if (type == TraceHeaderContributionType.MAIN_HEADER_CONTENT) {
+			retval = MAIN_HEADER_TEMPLATE;
+		}
+		return retval;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.project.TraceProjectAPI#isVisibleInConfiguration()
+	 */
+	public boolean isVisibleInConfiguration() {
+		return true;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.ExtensionBase#setOwner(com.nokia.tracebuilder.model.TraceObject)
+	 */
+	@Override
+	public void setOwner(TraceObject owner) {
+		if (getOwner() != null) {
+			getOwner().getModel().removeModelListener(this);
+		}
+		super.setOwner(owner);
+		if (owner != null) {
+			owner.getModel().addModelListener(this);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelListener#
+	 *      objectAdded(com.nokia.tracebuilder.model.TraceObject,
+	 *      com.nokia.tracebuilder.model.TraceObject)
+	 */
+	public void objectAdded(TraceObject owner, TraceObject object) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelListener#
+	 *      objectCreationComplete(com.nokia.tracebuilder.model.TraceObject)
+	 */
+	public void objectCreationComplete(TraceObject object) {
+		// Model must be valid and converter not running
+		// -> Parameter was added via UI
+		// Also, parameter must not be hidden, otherwise fillers would update
+		// the trace
+		if (object.getModel().isValid()
+				&& object instanceof TraceParameter
+				&& !TraceBuilderGlobals.getSourceContextManager()
+						.isConverting()
+				&& object.getExtension(HiddenTraceObjectRule.class) == null) {
+			TraceParameter param = (TraceParameter) object;
+			Trace parent = param.getTrace();
+
+			// In case of performance event trace we do not add parameter to
+			// trace text
+			GroupNameHandlerBase groupNameHandler = TraceBuilderGlobals.getGroupNameHandler();
+			if (!(parent.getGroup().getName()
+					.equals(groupNameHandler.getDefaultGroups()[groupNameHandler.getPerformanceGroupIdIndex()]))) {
+				addParameterToTraceText(param);
+			}
+		}
+	}
+
+	/**
+	 * Adds parameter formatting to trace text
+	 * 
+	 * @param param
+	 *            the parameter
+	 */
+	private void addParameterToTraceText(TraceParameter param) {
+		// Adds the parameter format to the trace text
+		// Auto-text traces are not updated
+		String text;
+		Trace parent = param.getTrace();
+
+		if (parent.getExtension(AutomaticTraceTextRule.class) == null) {
+			text = parent.getTrace() + PARAMETER_SEPARATOR + param.getName()
+					+ PARAMETER_VALUE_SEPARATOR
+					+ SourceUtils.mapParameterTypeToFormat(param);
+
+			parent.setTrace(text);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelListener#
+	 *      objectRemoved(com.nokia.tracebuilder.model.TraceObject,
+	 *      com.nokia.tracebuilder.model.TraceObject)
+	 */
+	public void objectRemoved(TraceObject owner, TraceObject object) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.TraceFormatRuleBase#
+	 *      parameterAboutToBeRemoved(com.nokia.tracebuilder.model.TraceParameter,
+	 *      int)
+	 */
+	@Override
+	public void parameterAboutToBeRemoved(TraceParameter parameter, int index) {
+		Trace trace = parameter.getTrace();
+		String tracetext = trace.getTrace();
+
+		if (tracetext != "") { //$NON-NLS-1$
+			Matcher matcher = SourceUtils.traceTextPattern.matcher(tracetext);
+
+			boolean found = true;
+			int i = -1;
+			int previousmatchend = 0;
+
+			do {
+				found = matcher.find();
+				i++;
+				// Store end location of the previous match
+				if (i < index) {
+					previousmatchend = matcher.start()
+							+ matcher.group().length();
+				}
+			} while (i < index);
+
+			if (found) {
+				int matchstart = matcher.start();
+				String group = matcher.group();
+
+				if (index == 0) {
+					// Fist parameter is going to be removed
+					int firstpartend = tracetext.lastIndexOf(';', matchstart);
+					if (firstpartend < 0) {
+						// Trace text is not TB in format, so remove only
+						// parameter tag.
+						firstpartend = matchstart;
+
+						// If trace group is TRACE_PERFORMANCE, trace could be
+						// in LocigAnalyzer format. Remove also extra space
+						// before parameter tag
+						String traceGroupName = trace.getGroup().getName();
+						GroupNameHandlerBase groupNameHandler = TraceBuilderGlobals.getGroupNameHandler();
+						int performanceGroupIndex = groupNameHandler.getPerformanceGroupIdIndex();
+						String performanceGroupName = groupNameHandler.getDefaultGroups()[performanceGroupIndex];
+						if (traceGroupName.equals(performanceGroupName)) {
+							if (tracetext.charAt(firstpartend - 1) == SourceConstants.SPACE_CHAR) {
+								firstpartend--;
+							}
+						}
+					}
+					trace.setTrace(tracetext.substring(0, firstpartend)
+							+ tracetext.substring(matchstart + group.length()));
+				} else {
+					// Some other than first parameter is going to be removed
+					if (tracetext.charAt(previousmatchend) == ';') {
+						// Trace text is TB in format, so remove also some text
+						// before parameter tag.
+						trace.setTrace(tracetext.substring(0, previousmatchend)
+								+ tracetext.substring(matchstart
+										+ group.length()));
+					} else {
+						// Trace text is not TB in format, so remove only
+						// parameter tag.
+						trace.setTrace(tracetext.substring(0, matchstart)
+								+ tracetext.substring(matchstart
+										+ group.length()));
+					}
+				}
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelListener#
+	 *      propertyUpdated(com.nokia.tracebuilder.model.TraceObject, int)
+	 */
+	public void propertyUpdated(TraceObject object, int property) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.project.TraceProjectAPI#
+	 *      formatTraceForExport(com.nokia.tracebuilder.model.Trace,
+	 *      com.nokia.tracebuilder.project.TraceProjectAPI.TraceFormatFlags)
+	 */
+	public String formatTraceForExport(Trace trace, TraceFormatFlags flags) {
+		// TODO: This uses default formats
+		// -> Should be configurable
+		// > for entry traces
+		// < for exit traces
+		// Logic analyzer format for performance traces
+		String retval = trace.getTrace();
+		AutomaticTraceTextRule rule = trace
+				.getExtension(AutomaticTraceTextRule.class);
+		int parameterCount = trace.getParameterCount();
+		if (rule != null) {
+			if (rule instanceof EntryTraceRule) {
+				retval = "> " //$NON-NLS-1$
+						+ retval;
+			} else if (rule instanceof ExitTraceRule) {
+				retval = "< " //$NON-NLS-1$
+						+ retval;
+			} else if (rule instanceof StateTraceRule) {
+				if (parameterCount == 2) { // CodForChk_Dis_Magic
+					retval = retval + "Machine" + PARAMETER_VALUE_SEPARATOR //$NON-NLS-1$
+							+ STRING_PARAMETER_TAG + PARAMETER_SEPARATOR
+							+ "State" + PARAMETER_VALUE_SEPARATOR //$NON-NLS-1$
+							+ STRING_PARAMETER_TAG;
+				} else {
+					retval = retval
+							+ "Machine" + PARAMETER_VALUE_SEPARATOR //$NON-NLS-1$
+							+ STRING_PARAMETER_TAG + PARAMETER_SEPARATOR
+							+ "State" + PARAMETER_VALUE_SEPARATOR //$NON-NLS-1$
+							+ STRING_PARAMETER_TAG + PARAMETER_SEPARATOR
+							+ "Instance" + PARAMETER_VALUE_SEPARATOR //$NON-NLS-1$
+							+ HEX_PARAMETER_TAG;
+				}
+			}
+
+			if (parameterCount >= 1 && !(rule instanceof StateTraceRule)) {
+				TraceParameter param;
+				for (int i = 0; i < parameterCount; i++) {
+					param = trace.getParameter(i);
+					retval += PARAMETER_SEPARATOR + param.getName()
+							+ PARAMETER_VALUE_SEPARATOR
+							+ SourceUtils.mapParameterTypeToFormat(param);
+				}
+			}
+		} else {
+			PerformanceEventRuleBase perf = trace
+					.getExtension(PerformanceEventRuleBase.class);
+			if (perf != null) {
+				if (perf instanceof PerformanceEventStartRule) {
+					retval = retval + "> " + PARAMETER_SEPARATOR //$NON-NLS-1$
+							+ "Value" + PARAMETER_VALUE_SEPARATOR //$NON-NLS-1$
+							+ SDEC_PARAMETER_TAG;
+				} else if (perf instanceof PerformanceEventStopRule) {
+					retval = retval + "< " //$NON-NLS-1$
+							+ PARAMETER_SEPARATOR
+							+ "Value" + PARAMETER_VALUE_SEPARATOR //$NON-NLS-1$
+							+ SDEC_PARAMETER_TAG
+							+ PARAMETER_SEPARATOR
+							+ "Start Event Trace ID" + PARAMETER_VALUE_SEPARATOR //$NON-NLS-1$
+							+ SDEC_PARAMETER_TAG;
+				}
+			}
+		}
+		// If formatting is not supported the format characters and parameters
+		// are removed.
+		if (!flags.isFormattingSupported) {
+			int index = retval.indexOf(PARAMETER_SEPARATOR);
+			if (index > 0) {
+				retval = retval.substring(0, index);
+			}
+			retval = SourceUtils.removePrintfFormatting(retval).trim();
+		}
+		return retval;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/osttrace/OstTraceParserRule.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,630 @@
+/*
+ * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies 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 parser rule
+ *
+ */
+package com.nokia.tracebuilder.engine.rules.osttrace;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceLocation;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.TraceBuilderErrorCode;
+import com.nokia.tracebuilder.engine.rules.AutoAddFunctionParametersRule;
+import com.nokia.tracebuilder.engine.rules.AutoAddReturnParameterRule;
+import com.nokia.tracebuilder.engine.rules.AutoAddThisPtrRule;
+import com.nokia.tracebuilder.engine.rules.AutomaticTraceTextRule;
+import com.nokia.tracebuilder.engine.rules.ComplexHeaderRuleImpl;
+import com.nokia.tracebuilder.engine.rules.EntryTraceRule;
+import com.nokia.tracebuilder.engine.rules.ExitTraceRule;
+import com.nokia.tracebuilder.engine.rules.PerformanceEventStartRule;
+import com.nokia.tracebuilder.engine.rules.PerformanceEventStopRule;
+import com.nokia.tracebuilder.engine.rules.ReadOnlyObjectRuleImpl;
+import com.nokia.tracebuilder.engine.rules.StateTraceRule;
+import com.nokia.tracebuilder.engine.rules.printf.PrintfTraceParserRule;
+import com.nokia.tracebuilder.engine.source.SourceParserResult;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceModelExtension;
+import com.nokia.tracebuilder.model.TraceParameter;
+import com.nokia.tracebuilder.project.GroupNameHandlerBase;
+import com.nokia.tracebuilder.source.FormatMapping;
+import com.nokia.tracebuilder.source.SourceContext;
+import com.nokia.tracebuilder.source.SourceParser;
+
+/**
+ * OST trace parser rule
+ * 
+ */
+public final class OstTraceParserRule extends PrintfTraceParserRule {
+
+	/**
+	 * Data trace parameter count
+	 */
+	private static final int DATA_PARAMETER_COUNT = 2; // CodForChk_Dis_Magic
+
+	/**
+	 * Entry Ext trace parameter count
+	 */
+	private static final int ENTRY_EXT_PARAMETER_COUNT = 1; // CodForChk_Dis_Magic
+
+	/**
+	 * Exit Ext trace parameter count
+	 */
+	private static final int EXIT_EXT_PARAMETER_COUNT = 2; // CodForChk_Dis_Magic
+
+	/**
+	 * Trace parameter index list
+	 * 
+	 */
+	class TraceParameterIndexList {
+
+		/**
+		 * Minimum number of parameters needed to decode traces
+		 */
+		int minParamCount;
+
+		/**
+		 * Preprocessor level index
+		 */
+		int levelIndex;
+
+		/**
+		 * Trace name index
+		 */
+		int nameIndex;
+
+		/**
+		 * Trace text index
+		 */
+		int textIndex;
+
+		/**
+		 * Trace group index in case group name is free-form
+		 */
+		int groupIndex;
+
+		/**
+		 * Trace group name in case group name is pre-determined by rules
+		 */
+		String groupName;
+	}
+
+	/**
+	 * List of flags related to OST API macro
+	 * 
+	 */
+	class TraceParameterFlagList {
+
+		/**
+		 * Data tag
+		 */
+		boolean hasDataTag;
+
+		/**
+		 * State tag
+		 */
+		boolean hasStateTag;
+
+		/**
+		 * Ext tag
+		 */
+		boolean hasExtTag;
+
+		/**
+		 * Event start tag
+		 */
+		boolean hasEventStartTag;
+
+		/**
+		 * Event stop
+		 */
+		boolean hasEventStopTag;
+
+		/**
+		 * Function entry
+		 */
+		boolean hasFunctionEntryTag;
+
+		/**
+		 * Function exit
+		 */
+		boolean hasFunctionExitTag;
+
+		/**
+		 * Constructor
+		 * 
+		 * @param tag
+		 *            the trace tag
+		 */
+		TraceParameterFlagList(String tag) {
+			hasDataTag = tag.indexOf(OstConstants.DATA_TRACE_TAG) > 0;
+			hasStateTag = tag.indexOf(OstConstants.STATE_TRACE_TAG) > 0;
+			hasExtTag = tag.indexOf(OstConstants.EXTENSION_TRACE_TAG) > 0;
+			hasEventStartTag = tag
+					.indexOf(OstConstants.PERFORMANCE_EVENT_START_TAG) > 0;
+			hasEventStopTag = tag
+					.indexOf(OstConstants.PERFORMANCE_EVENT_STOP_TAG) > 0;
+			hasFunctionEntryTag = tag.indexOf(OstConstants.FUNCTION_ENTRY_TAG) > 0;
+			hasFunctionExitTag = tag.indexOf(OstConstants.FUNCTION_EXIT_TAG) > 0;
+		}
+
+		/**
+		 * Checks if any of the flags is set
+		 * 
+		 * @return true if flag is set
+		 */
+		boolean hasFlags() {
+			return hasDataTag || hasStateTag || hasExtTag || hasEventStartTag
+					|| hasEventStopTag || hasFunctionEntryTag
+					|| hasFunctionExitTag;
+		}
+
+	}
+
+	/**
+	 * Offset to preprocessor level
+	 */
+	private static final int PREPROCESSOR_LEVEL_OFFSET = 0; // CodForChk_Dis_Magic
+
+	/**
+	 * Offset to group name if preprocessor level is not in use
+	 */
+	private static final int GROUP_NAME_OFFSET = 0; // CodForChk_Dis_Magic
+
+	/**
+	 * Offset to trace name if preprocessor level is not in use
+	 */
+	private static final int TRACE_NAME_OFFSET = 1; // CodForChk_Dis_Magic
+
+	/**
+	 * Offset to trace text if preprocessor level is not in use
+	 */
+	private static final int TRACE_TEXT_OFFSET = 2; // CodForChk_Dis_Magic
+
+	/**
+	 * Minimum number of parameters if preprocessor level is not in use
+	 */
+	private static final int MIN_PARAMETER_COUNT = 3; // CodForChk_Dis_Magic
+
+	/**
+	 * Parser tag
+	 */
+	private static final String OST_TRACE_PARSER_TAG = "OstTrace"; //$NON-NLS-1$
+
+	/**
+	 * OstTrace parser formats
+	 */
+	private final static String[] OST_TRACE_PARSER_FORMATS = { "0", //$NON-NLS-1$
+			"1", //$NON-NLS-1$
+			"Data", //$NON-NLS-1$
+			"Ext?", //$NON-NLS-1$
+			"FunctionEntry0", //$NON-NLS-1$
+			"FunctionEntry1", //$NON-NLS-1$
+			"FunctionEntryExt", //$NON-NLS-1$
+			"FunctionExit0", //$NON-NLS-1$
+			"FunctionExit1", //$NON-NLS-1$
+			"FunctionExitExt", //$NON-NLS-1$
+			"EventStart0", //$NON-NLS-1$
+			"EventStart1", //$NON-NLS-1$
+			"EventStop", //$NON-NLS-1$
+			"Def0", //$NON-NLS-1$
+			"Def1", //$NON-NLS-1$
+			"DefData", //$NON-NLS-1$
+			"DefExt?", //$NON-NLS-1$
+			"State0", //$NON-NLS-1$
+			"State1" //$NON-NLS-1$
+	};
+
+	/**
+	 * Creates a new OstTrace parser rule
+	 */
+	public OstTraceParserRule() {
+		super(OST_TRACE_PARSER_TAG, OST_TRACE_PARSER_FORMATS);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.source.SourceParserRule#getName()
+	 */
+	@Override
+	public String getName() {
+		return OstTraceFormatRule.STORAGE_NAME;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.printf.PrintfTraceParserRule#parseParameters(java.util.List)
+	 */
+	@Override
+	public SourceParserResult parseParameters(String tag, List<String> list)
+			throws TraceBuilderException {
+		SourceParserResult result = new SourceParserResult();
+		TraceParameterIndexList indexList = getIndexList(tag);
+		if (list.size() >= indexList.minParamCount) {
+			// Name must exist
+			result.originalName = list.get(indexList.nameIndex);
+			result.convertedName = result.originalName;
+			// Text is optional
+			if (indexList.textIndex >= 0) {
+				result.traceText = trimTraceText(list.get(indexList.textIndex));
+			} else {
+				result.traceText = ""; //$NON-NLS-1$
+			}
+			// Group ID and preprocessor level are stored into the
+			// parser-specific data
+			result.parserData = new ArrayList<String>();
+			if (indexList.levelIndex >= 0) {
+				result.parserData.add(list.get(indexList.levelIndex));
+			}
+			if (indexList.groupIndex >= 0) {
+				result.parserData.add(list.get(indexList.groupIndex));
+			} else if (indexList.groupName != null) {
+				result.parserData.add(indexList.groupName);
+			}
+
+			// Extra parameters are converted to trace parameters
+			result.parameters = new ArrayList<String>();
+			for (int i = indexList.minParamCount; i < list.size(); i++) {
+				result.parameters.add(list.get(i));
+			}
+		} else {
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.NOT_ENOUGH_PARAMETERS);
+		}
+		return result;
+	}
+
+	/**
+	 * Gets the parameter index list based on trace tag
+	 * 
+	 * @param tag
+	 *            the trace tag
+	 * @return the index list
+	 */
+	private TraceParameterIndexList getIndexList(String tag) {
+		TraceParameterIndexList indexes = new TraceParameterIndexList();
+		indexes.levelIndex = -1;
+		GroupNameHandlerBase groupNameHandler = TraceBuilderGlobals.getGroupNameHandler();
+		String[] defaultGroups = groupNameHandler.getDefaultGroups();
+		if (tag.indexOf(OstConstants.FUNCTION_ENTRY_TAG) > 0
+				|| tag.indexOf(OstConstants.FUNCTION_EXIT_TAG) > 0) {
+			indexes.minParamCount = 1; // Name is mandatory
+			indexes.textIndex = -1; // No trace text
+			indexes.nameIndex = 0; // Trace name at index 0
+			indexes.groupIndex = -1; // Group is fixed to TRACE_FLOW
+			indexes.groupName = defaultGroups[groupNameHandler.getFlowGroupIdIndex()];
+		} else if (tag.indexOf(OstConstants.STATE_TRACE_TAG) > 0) {
+			indexes.minParamCount = 1; // Name is mandatory
+			indexes.textIndex = -1; // No trace text
+			indexes.nameIndex = 0; // Trace name at index 0
+			indexes.groupIndex = -1; // Group is fixed to TRACE_STATE
+			indexes.groupName = defaultGroups[groupNameHandler.getStateGroupIdIndex()];
+		} else if (tag.indexOf(OstConstants.PERFORMANCE_EVENT_START_TAG) > 0) {
+			// Name and event name are mandatory
+			indexes.minParamCount = 2; // CodForChk_Dis_Magic
+			indexes.textIndex = 1; // Trace text at index 1
+			indexes.nameIndex = 0; // Trace name at index 0
+			indexes.groupIndex = -1; // Group is fixed to TRACE_PERFORMANCE
+			indexes.groupName = defaultGroups[groupNameHandler.getPerformanceGroupIdIndex()];
+		} else if (tag.indexOf(OstConstants.PERFORMANCE_EVENT_STOP_TAG) > 0) {
+			//  Name and event name are mandatory
+			indexes.minParamCount = 2; // CodForChk_Dis_Magic
+			indexes.textIndex = 1; // Trace text at index 1
+			indexes.nameIndex = 0; // Trace name at index 0
+			indexes.groupIndex = -1; // Group is fixed to TRACE_PERFORMANCE
+			indexes.groupName = defaultGroups[groupNameHandler.getPerformanceGroupIdIndex()];
+		} else {
+			indexes.minParamCount = MIN_PARAMETER_COUNT;
+			indexes.textIndex = TRACE_TEXT_OFFSET;
+			indexes.nameIndex = TRACE_NAME_OFFSET;
+			indexes.groupIndex = GROUP_NAME_OFFSET;
+		}
+		// If the trace macro contains preprocessor level, the offsets are
+		// incremented by one
+		if (tag.indexOf(OstConstants.PREPROCESSOR_LEVEL_TAG) > 0) {
+			indexes.minParamCount++;
+			if (indexes.textIndex >= 0) {
+				indexes.textIndex++;
+			}
+			if (indexes.nameIndex >= 0) {
+				indexes.nameIndex++;
+			}
+			if (indexes.groupIndex >= 0) {
+				indexes.groupIndex++;
+			}
+			indexes.levelIndex = PREPROCESSOR_LEVEL_OFFSET;
+		}
+		return indexes;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.printf.PrintfTraceParserRule#
+	 *      convertLocation(com.nokia.tracebuilder.engine.TraceLocation)
+	 */
+	@Override
+	public TraceConversionResult convertLocation(TraceLocation location)
+			throws TraceBuilderException { // CodForChk_Dis_ComplexFunc
+		TraceParameterFlagList flags = checkParameterCount(location);
+
+		// Data tag does not have parameters
+		boolean checkParameters = !flags.hasDataTag;
+
+		List<FormatMapping> typeList;
+		if (flags.hasExtTag
+				&& (flags.hasFunctionEntryTag || flags.hasFunctionExitTag)) {
+			// Parameters are generated by AutoAdd rules
+			typeList = new ArrayList<FormatMapping>();
+			checkParameters = false;
+		} else if (!flags.hasFlags() || flags.hasDataTag || flags.hasExtTag) {
+			// If the Ext, Data or EventStart tag is present, all formats
+			// are supported. If no flags is set, only 32-bit formats are
+			// supported.
+			typeList = buildParameterTypeList(location.getTraceText(),
+					!flags.hasDataTag && !flags.hasExtTag);
+		} else if (flags.hasEventStartTag) {
+			// In case of Start1 tag value parameter is supported
+			typeList = new ArrayList<FormatMapping>();
+			// Check that does optional value exist
+			if (location.getParameterCount() == 1) {
+				FormatMapping mapping = new FormatMapping(TraceParameter.SDEC32);
+				mapping.isSimple = true;
+				typeList.add(mapping);
+			}
+			checkParameters = false;
+		} else if (flags.hasEventStopTag) {
+			// If the Event stop tag is presented, start event trace
+			// id parameter is supported
+			typeList = new ArrayList<FormatMapping>();
+			FormatMapping mapping = new FormatMapping(TraceParameter.UDEC32);
+			mapping.isSimple = true;
+			typeList.add(mapping);
+			checkParameters = false;
+
+		} else if (flags.hasStateTag) {
+			// If the State tag is presented, two ascii parameters are supported
+			// in case of State0 tag (parameter count = 2). In case of State1
+			// tag (parameter count = 3) two ascii and one 32-bit hex parameters
+			// are supported
+			typeList = new ArrayList<FormatMapping>();
+			FormatMapping mapping = new FormatMapping(TraceParameter.ASCII);
+			mapping.isSimple = true;
+			typeList.add(mapping);
+			mapping = new FormatMapping(TraceParameter.ASCII);
+			mapping.isSimple = true;
+			typeList.add(mapping);
+
+			// Check that does optional instance identifier exist
+			if (location.getParameterCount() == 3) { // CodForChk_Dis_Magic
+				mapping = new FormatMapping(TraceParameter.HEX32);
+				mapping.isSimple = true;
+				typeList.add(mapping);
+			}
+			checkParameters = false;
+		} else {
+			// If some other flag than Data, State, Ext or EventStart is set,
+			// only one 32-bit hex parameter is supported
+			typeList = new ArrayList<FormatMapping>();
+			if (location.getParameterCount() == 1) {
+				FormatMapping mapping = new FormatMapping(TraceParameter.HEX32);
+				mapping.isSimple = true;
+				typeList.add(mapping);
+			}
+		}
+		// If no flags or Ext flag is present, the parameter count needs to be
+		// verified
+		TraceConversionResult result = super.convertLocation(location,
+				checkParameters, typeList);
+		// If the extension or state tag is present, zero parameters or a single
+		// 32-bit parameter is not accepted because they do not need to generate
+		// a function into the header
+		if (((flags.hasExtTag && !flags.hasFunctionExitTag && !flags.hasFunctionEntryTag) || (flags.hasStateTag))
+				&& (typeList.size() == 0 || (typeList.size() == 1 && typeList
+						.get(0).isSimple))) {
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.PARAMETER_FORMAT_UNNECESSARY_EXT_MACRO);
+		}
+		// Ext-macros are tagged with the complex header rule, so the header
+		// gets written when traces are exported. Data-macros are tagged with
+		// read-only rule, so they are not updated via UI. Other special cases
+		// are flagged with corresponding rule.
+		// If trace text does not exist, it is created based on context
+		AutomaticTraceTextRule rule = null;
+		if (flags.hasDataTag) {
+			addRule(result, new ReadOnlyObjectRuleImpl());
+		} else if (flags.hasStateTag) {
+			addRule(result, new StateTraceRule());
+			addRule(result, new ComplexHeaderRuleImpl());
+		} else if (flags.hasEventStartTag) {
+			addRule(result, new PerformanceEventStartRule());
+		} else if (flags.hasEventStopTag) {
+			addRule(result, new PerformanceEventStopRule());
+			addRule(result, new ComplexHeaderRuleImpl());
+		} else if (flags.hasFunctionEntryTag) {
+			if (flags.hasExtTag) {
+				// Entry trace may contain Ext tag. In that case the trace
+				// parameters are an instance variable and function parameters
+				// parsed from source. It is also flagged as complex, so the
+				// function gets generated to the trace header
+				addRule(result, new ComplexHeaderRuleImpl());
+				addRule(result, new AutoAddFunctionParametersRule());
+				addRule(result, new AutoAddThisPtrRule());
+			}
+			rule = new EntryTraceRule();
+			addRule(result, rule);
+		} else if (flags.hasFunctionExitTag) {
+			if (flags.hasExtTag) {
+				// Exit trace may contain Ext tag. In that case the trace has
+				// two parameters: instance variable and return statement
+				// It is also flagged as complex, so the function gets generated
+				// to the trace header
+				addRule(result, new ComplexHeaderRuleImpl());
+				addRule(result, new AutoAddThisPtrRule());
+				addRule(result, new AutoAddReturnParameterRule());
+			}
+			rule = new ExitTraceRule();
+			addRule(result, rule);
+		} else if (flags.hasExtTag) {
+			addRule(result, new ComplexHeaderRuleImpl());
+		}
+		if (rule != null) {
+			setAutoTextToTrace(location, result, rule);
+		}
+		List<String> parserData = location.getParserData();
+		result.group = parserData.get(parserData.size() - 1);
+		// The convert flag is reset to prevent further conversions
+		location.locationConverted();
+		return result;
+	}
+
+	/**
+	 * Uses the auto-text rule to create trace text
+	 * 
+	 * @param location
+	 *            the location
+	 * @param result
+	 *            the conversion result
+	 * @param rule
+	 *            the auto-text rule
+	 * @throws TraceBuilderException
+	 *             if update fails
+	 */
+	private void setAutoTextToTrace(TraceLocation location,
+			TraceConversionResult result, AutomaticTraceTextRule rule)
+			throws TraceBuilderException {
+		// The trace text comes from the auto-text rule
+		SourceParser parser = location.getParser();
+		SourceContext context = parser.getContext(location.getOffset());
+		if (context != null) {
+			result.text = rule.formatTrace(context);
+		} else {
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.NO_CONTEXT_FOR_LOCATION);
+		}
+	}
+
+	/**
+	 * Checks parameter count
+	 * 
+	 * @param location
+	 *            the location
+	 * @return the location tag flags
+	 * @throws TraceBuilderException
+	 *             if parameter count is not valid
+	 */
+	private TraceParameterFlagList checkParameterCount(TraceLocation location)
+			throws TraceBuilderException {
+		TraceParameterFlagList flags = new TraceParameterFlagList(location
+				.getTag());
+
+		// If the trace has some tag, the parameter count is fixed
+		// Data has 2 parameters
+		// State has 2 or 3 parameters
+		// Function entry-exit has 0 or 1 parameters
+		// Event start has 0 or 1 parameters
+		// Event stop has 1 parameters
+		int parameterCount = location.getParameterCount();
+
+		// Entry trace may have zero or one parameter
+		// In case of Ext, it must have one parameter
+		if (flags.hasFunctionEntryTag
+				&& ((parameterCount > 1) || (flags.hasExtTag && (parameterCount != ENTRY_EXT_PARAMETER_COUNT)))) {
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.PARAMETER_COUNT_DOES_NOT_MATCH_API);
+		}
+
+		// Exit trace may have zero or one parameter
+		// In case of Ext, it must have two parameters
+		if (flags.hasFunctionExitTag
+				&& ((!flags.hasExtTag && (parameterCount > 1)) || (flags.hasExtTag && parameterCount != EXIT_EXT_PARAMETER_COUNT))) { // CodForChk_Dis_LengthyLine
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.PARAMETER_COUNT_DOES_NOT_MATCH_API);
+		}
+
+		// Event start may have zero or one parameter
+		if (flags.hasEventStartTag
+				&& (parameterCount > 1)) {
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.PARAMETER_COUNT_DOES_NOT_MATCH_API);
+		}
+
+		// Event stop have one parameters
+		if (flags.hasEventStopTag && (parameterCount != 1)) {
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.PARAMETER_COUNT_DOES_NOT_MATCH_API);
+		}
+
+		// Data trace has two parameters
+		if ((flags.hasDataTag && (parameterCount != DATA_PARAMETER_COUNT))) {
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.PARAMETER_COUNT_DOES_NOT_MATCH_API);
+		}
+
+		// State trace may have two or three parameter
+		if (flags.hasStateTag && (parameterCount < 2 || parameterCount > 3)) { // CodForChk_Dis_Magic
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.PARAMETER_COUNT_DOES_NOT_MATCH_API);
+		}
+
+		return flags;
+	}
+
+	/**
+	 * Adds a rule to result
+	 * 
+	 * @param result
+	 *            the result
+	 * @param rule
+	 *            the rule
+	 */
+	private void addRule(TraceConversionResult result, TraceModelExtension rule) {
+		if (result.extensions == null) {
+			result.extensions = new ArrayList<TraceModelExtension>();
+		}
+		result.extensions.add(rule);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.SourceParserRuleBase#
+	 *      isLocationConverted(com.nokia.tracebuilder.engine.TraceLocation)
+	 */
+	@Override
+	public boolean isLocationConverted(TraceLocation location) {
+		boolean retval = location.hasChangedAfterConvert();
+		if (!retval) {
+			// Duplicate-location conversions need to be retried in case the
+			// location is no longer a duplicate
+			retval = (location.getValidityCode() == TraceBuilderErrorCode.TRACE_HAS_MULTIPLE_LOCATIONS);
+		}
+		return retval;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.printf.PrintfTraceParserRule#getLocationGroup()
+	 */
+	@Override
+	public String getLocationGroup() {
+		return null;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/osttrace/package.html	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,3 @@
+<html><body>
+Implementation for OST format specific rules
+</body></html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/package.html	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,9 @@
+<html><body>
+Provides compile-time configuration of TraceBuilder behavior. 
+The features that can be adjusted via this package are:
+<ul>
+<li>Dialog templates</li>
+<li>Trace object rules</li>
+<li>Dialog flags</li>
+</ul>
+</body></html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/plugin/PluginTraceFormatRule.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,95 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Formatting rule, which delegates calls to plug-in API
+*
+*/
+package com.nokia.tracebuilder.engine.rules.plugin;
+
+import com.nokia.tracebuilder.engine.rules.TraceFormatRuleBase;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.plugin.TraceAPIFormatter;
+import com.nokia.tracebuilder.plugin.TraceAPIFormatter.TraceFormatType;
+
+/**
+ * Formatting rule, which delegates calls to plug-in API
+ * 
+ */
+public final class PluginTraceFormatRule extends TraceFormatRuleBase {
+
+	/**
+	 * The plug-in formatter
+	 */
+	private TraceAPIFormatter formatter;
+
+	/**
+	 * Creates a new formatter
+	 * 
+	 * @param formatter
+	 *            the plug-in formatter
+	 */
+	public PluginTraceFormatRule(TraceAPIFormatter formatter) {
+		this.formatter = formatter;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.project.TraceProjectAPI#getName()
+	 */
+	public String getName() {
+		return formatter.getName();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.project.TraceProjectAPI#getTitle()
+	 */
+	public String getTitle() {
+		return formatter.getTitle();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.source.SourceFormatRule#
+	 *      getFormat(com.nokia.tracebuilder.model.Trace, int)
+	 */
+	public String getFormat(Trace trace, TraceFormatType formatType) {
+		return formatter.getTraceFormat(formatType);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.project.TraceProjectAPI#isVisibleInConfiguration()
+	 */
+	public boolean isVisibleInConfiguration() {
+		return false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.project.TraceProjectAPI#
+	 *      formatTraceForExport(com.nokia.tracebuilder.model.Trace,
+	 *      com.nokia.tracebuilder.project.TraceProjectAPI.TraceFormatFlags)
+	 */
+	public String formatTraceForExport(Trace trace, TraceFormatFlags flags) {
+		return trace.getTrace();
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/plugin/PluginTraceParserRule.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,113 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Parser rule, which delegates calls to plug-in API
+*
+*/
+package com.nokia.tracebuilder.engine.rules.plugin;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.nokia.tracebuilder.engine.TraceLocation;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.TraceBuilderErrorCode;
+import com.nokia.tracebuilder.engine.rules.SourceParserRuleBase;
+import com.nokia.tracebuilder.engine.source.SourceParserResult;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.plugin.TraceAPIParser;
+
+/**
+ * Parser rule, which delegates calls to plug-in API
+ * 
+ */
+public final class PluginTraceParserRule extends SourceParserRuleBase {
+
+	/**
+	 * Trace parser plug-in
+	 */
+	private TraceAPIParser parser;
+
+	/**
+	 * Creates a new parser rule
+	 * 
+	 * @param parser
+	 *            the parser API
+	 */
+	public PluginTraceParserRule(TraceAPIParser parser) {
+		super(parser.getSourceTag(), parser.getTagSuffixes());
+		this.parser = parser;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.source.SourceParserRule#getName()
+	 */
+	public String getName() {
+		// TODO: Add to API or get rid of getName
+		return "PluginParser"; //$NON-NLS-1$
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.SourceParserRuleBase#getLocationGroup()
+	 */
+	@Override
+	public String getLocationGroup() {
+		return parser.getLocationGroup();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.source.SourceParserRule#
+	 *      parseParameters(java.util.List)
+	 */
+	public SourceParserResult parseParameters(String tag, List<String> list)
+			throws TraceBuilderException {
+		SourceParserResult result = new SourceParserResult();
+		if (list.size() >= 1) {
+			result.originalName = list.get(0);
+			result.convertedName = result.originalName;
+			result.traceText = result.originalName;
+			result.parameters = new ArrayList<String>();
+			for (int i = 1; i < list.size(); i++) {
+				result.parameters.add(list.get(i));
+			}
+		} else {
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.NOT_ENOUGH_PARAMETERS);
+		}
+		return result;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.SourceParserRuleBase#
+	 *      checkLocationValidity(com.nokia.tracebuilder.engine.TraceLocation,
+	 *      boolean)
+	 */
+	@Override
+	public TraceBuilderErrorCode checkLocationValidity(TraceLocation location) {
+		TraceBuilderErrorCode error = super.checkLocationValidity(location);
+		if (error == TraceBuilderErrorCode.OK) {
+			error = parser.checkLocationValidity(location);
+		}
+		return error;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/plugin/package.html	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,3 @@
+<html><body>
+Formatting API plug-in delegate
+</body></html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/printf/Messages.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 rules package
+*
+*/
+package com.nokia.tracebuilder.engine.rules.printf;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * Localized strings for printf package
+ * 
+ */
+class Messages {
+
+	/**
+	 * Bundle name
+	 */
+	private static final String BUNDLE_NAME = "com.nokia.tracebuilder.engine.rules.printf.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/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/printf/PrintfExtensionParserRule.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Parser for printf extension macros
+*
+*/
+package com.nokia.tracebuilder.engine.rules.printf;
+
+/**
+ * Parser for printf extension macros
+ * 
+ */
+public final class PrintfExtensionParserRule extends PrintfTraceParserRule {
+
+	/**
+	 * Constructor
+	 * 
+	 * @param tag
+	 *            the extension tag
+	 */
+	public PrintfExtensionParserRule(String tag) {
+		super(tag);
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/printf/PrintfTraceParserRule.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,397 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ * Parser for printf traces
+ *
+ */
+package com.nokia.tracebuilder.engine.rules.printf;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import com.nokia.tracebuilder.engine.TraceLocation;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.StringErrorParameters;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.TraceBuilderErrorCode;
+import com.nokia.tracebuilder.engine.rules.SourceParserRuleBase;
+import com.nokia.tracebuilder.engine.source.SourceParserResult;
+import com.nokia.tracebuilder.engine.utils.TraceUtils;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.source.FormatMapping;
+import com.nokia.tracebuilder.source.SourceConstants;
+import com.nokia.tracebuilder.source.SourceUtils;
+
+/**
+ * Parser for printf traces
+ * 
+ */
+public class PrintfTraceParserRule extends SourceParserRuleBase {
+
+	/**
+	 * Default name for a parameter
+	 */
+	public static final String DEFAULT_PARAMETER_NAME = "arg"; //$NON-NLS-1$
+
+	/**
+	 * Name of this parser
+	 */
+	private static final String PARSER_NAME = "PrintfParser"; //$NON-NLS-1$
+
+	/**
+	 * Pattern for trimming c++ cast operator away from trace parameters
+	 */
+	private Pattern cppCastTrimPattern = Pattern.compile("\\s*(.+<.+>)\\s*"); //$NON-NLS-1$
+
+	/**
+	 * Pattern for trimming c cast operator away from trace parameters
+	 */
+	private Pattern cCastTrimPattern = Pattern.compile("(\\([^(]+?\\))"); //$NON-NLS-1$
+
+	/**
+	 * Pattern for getting a valid token from parameter data
+	 */
+	private Pattern parameterNamePattern = Pattern
+			.compile("[a-zA-Z][a-zA-Z\\d]*"); //$NON-NLS-1$
+
+	/**
+	 * Symbian literal tags
+	 */
+	private String[] TRACE_TEXT_TAGS = { "_L8", //$NON-NLS-1$
+			"_T8", //$NON-NLS-1$
+			"_L", //$NON-NLS-1$
+			"_T" //$NON-NLS-1$
+	};
+
+	/**
+	 * Constructor
+	 * 
+	 * @param tag
+	 *            the tag to be found from source
+	 */
+	public PrintfTraceParserRule(String tag) {
+		super(tag, null);
+	}
+
+	/**
+	 * Constructor
+	 * 
+	 * @param tag
+	 *            the tag to be searched from source
+	 * @param tagSuffixes
+	 *            the list of allowed suffixes to the tag
+	 */
+	public PrintfTraceParserRule(String tag, String[] tagSuffixes) {
+		super(tag, tagSuffixes);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.source.SourceParserRule#getName()
+	 */
+	public String getName() {
+		return PARSER_NAME;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.source.SourceParserRule#
+	 *      parseParameters(java.util.List)
+	 */
+	public SourceParserResult parseParameters(String tag, List<String> list)
+			throws TraceBuilderException {
+		SourceParserResult result = new SourceParserResult();
+		result.traceText = trimTraceText(list.get(0));
+		result.originalName = result.traceText;
+		result.convertedName = TraceUtils.convertName(
+				SourceUtils.removePrintfFormatting(result.traceText))
+				.toUpperCase();
+		result.parameters = list.subList(1, list.size());
+		return result;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.SourceParserRuleBase#getLocationGroup()
+	 */
+	@Override
+	public String getLocationGroup() {
+		return Messages.getString("PrintfTraceParserRule.Title"); //$NON-NLS-1$
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.rules.SourceParserRuleBase#
+	 *      convertLocation(com.nokia.tracebuilder.engine.TraceLocation)
+	 */
+	@Override
+	public TraceConversionResult convertLocation(TraceLocation location)
+			throws TraceBuilderException {
+		// All parameter types are supported by default -> false is passed to
+		// buildParameterTypeList.
+		List<FormatMapping> types = buildParameterTypeList(location
+				.getTraceText(), false);
+		// Parameter count must match the number of format elements in trace
+		// text -> true is passed to convertLocation by default
+		return convertLocation(location, true, types);
+	}
+
+	/**
+	 * Converts a location to trace
+	 * 
+	 * @param location
+	 *            the location to be converted
+	 * @param useParametersFromLocation
+	 *            true if location parameters need to be checked
+	 * @param types
+	 *            the parameter types list
+	 * @return the conversion result
+	 * @throws TraceBuilderException
+	 *             if conversion fails
+	 */
+	protected TraceConversionResult convertLocation(TraceLocation location,
+			boolean useParametersFromLocation, List<FormatMapping> types)
+			throws TraceBuilderException {
+		TraceConversionResult result = new TraceConversionResult();
+		result.text = location.getTraceText();
+
+		// If trace text is in multiple lines, remove extra characters
+		int removableAreaBeging = -1;
+		for (int i = 0; i < result.text.length(); i++) {
+			char c = result.text.charAt(i);
+			if (c == SourceConstants.QUOTE_CHAR
+					&& (i == 0 || result.text.charAt(i - 1) != SourceConstants.BACKSLASH_CHAR)) {
+				if (removableAreaBeging != -1) {
+					String startString = result.text.substring(0,
+							removableAreaBeging);
+					String endString = result.text.substring(i + 1, result.text
+							.length());
+					result.text = startString + endString;
+					i = removableAreaBeging;
+					removableAreaBeging = -1;
+				} else {
+					removableAreaBeging = i;
+				}
+			}
+		}
+
+		result.name = location.getConvertedName();
+
+		// If location parameters are used, the count must match the number of
+		// formats parsed from the trace string.
+		if (!useParametersFromLocation
+				|| (types.size() == location.getParameterCount() && numberOfParametersInTagMatchSize(
+						location.getTag(), types.size()))) {
+			result.parameters = new ArrayList<ParameterConversionResult>(types
+					.size());
+			Iterator<String> itr = location.getParameters();
+			// The FormatMapping objects are converted to
+			// ParameterConversionResult objects:
+			// - Name is associated to the parameter
+			// - Extensions are created
+			for (int i = 0; i < types.size(); i++) {
+				FormatMapping mapping = types.get(i);
+				String name;
+				if (useParametersFromLocation) {
+					name = TraceUtils.convertName(trimParameter(itr.next(), i));
+				} else {
+					name = DEFAULT_PARAMETER_NAME + (i + 1);
+				}
+				ParameterConversionResult param = mapFormatToConversionResult(mapping);
+				param.name = modifyDuplicateName(result.parameters, name);
+				result.parameters.add(param);
+			}
+		} else {
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.PARAMETER_FORMAT_MISMATCH, null,
+					location);
+		}
+		return result;
+	}
+
+	/**
+	 * Checks if the number of the parameters in the trace tag matches the size
+	 * of parameter list
+	 * 
+	 * @param tag
+	 *            the trace tag
+	 * @param size
+	 *            size of the parameter list
+	 * @return true is parameter count matches, false otherwise
+	 */
+	private boolean numberOfParametersInTagMatchSize(String tag, int size) {
+		boolean matches = true;
+		// Parse the last character of the tag to a integer
+		if (tag != null) {
+			try {
+
+				// Check the tag parameter count and compare it to the size of
+				// the parameter list
+				String tagParamStr = tag.substring(tag.length() - 1);
+				int tagParamCount = Integer.parseInt(tagParamStr);
+
+				if (tagParamCount != size) {
+					matches = false;
+				}
+			} catch (NumberFormatException e) {
+			}
+		}
+		return matches;
+	}
+
+	/**
+	 * Builds the parameter type array which is passed to convertLocation
+	 * 
+	 * @param text
+	 *            the trace text
+	 * @param simpleParameters
+	 *            true if only simple types are supported
+	 * @return the list of types
+	 * @throws TraceBuilderException
+	 *             if parser fails
+	 */
+	protected List<FormatMapping> buildParameterTypeList(String text,
+			boolean simpleParameters) throws TraceBuilderException {
+		Matcher matcher = SourceUtils.traceTextPattern.matcher(text);
+		ArrayList<FormatMapping> types = new ArrayList<FormatMapping>();
+		boolean found = true;
+		do {
+			found = matcher.find();
+			if (found) {
+				String tag = matcher.group();
+				FormatMapping mapping = SourceUtils
+						.mapFormatToParameterType(tag);
+				if (simpleParameters && !mapping.isSimple) {
+					StringErrorParameters param = new StringErrorParameters();
+					param.string = tag;
+					throw new TraceBuilderException(
+							TraceBuilderErrorCode.PARAMETER_FORMAT_NEEDS_EXT_MACRO,
+							param, null);
+				}
+				types.add(mapping);
+			}
+		} while (found);
+		return types;
+	}
+
+	/**
+	 * Changes a duplicate parameter name to unique
+	 * 
+	 * @param parameters
+	 *            the list of existing parameters
+	 * @param name
+	 *            the name
+	 * @return the modified name
+	 */
+	private String modifyDuplicateName(
+			List<ParameterConversionResult> parameters, String name) {
+		String retval = name;
+		for (ParameterConversionResult result : parameters) {
+			if (result.name.equals(name)) {
+				retval = name + (parameters.size() + 1);
+				break;
+			}
+		}
+		return retval;
+	}
+
+	/**
+	 * Trims extra stuff away from trace text
+	 * 
+	 * @param data
+	 *            the data to be trimmed
+	 * @return trimmed text
+	 */
+	protected String trimTraceText(String data) {
+		// Removes literal macros
+		for (String element : TRACE_TEXT_TAGS) {
+			if (data.startsWith(element)) {
+				data = data.substring(element.length());
+			}
+		}
+		data = data.trim();
+		// Removes the opening bracket and quotes
+		data = removeBrackets(data);
+		if (data.startsWith("\"") //$NON-NLS-1$
+				&& data.length() >= 2) { // CodForChk_Dis_Magic
+			data = data.substring(1, data.length() - 1);
+		}
+		return data;
+	}
+
+	/**
+	 * Removes the brackets around the given data
+	 * 
+	 * @param data
+	 *            the data
+	 * @return the modified data
+	 */
+	protected String removeBrackets(String data) {
+		boolean canRemove = true;
+		while (data.startsWith("(") //$NON-NLS-1$
+				&& data.endsWith(")") //$NON-NLS-1$
+				&& canRemove) {
+			// If closing bracket is found first, the first bracket cannot be
+			// removed.
+			// TODO: Does not work with for example ((Cast)abc).Func()
+			// -> (Cast)abc).Func(
+			for (int i = 1; i < data.length() - 1 && canRemove; i++) {
+				if (data.charAt(i) == '(') {
+					i = data.length();
+				} else if (data.charAt(i) == ')') {
+					canRemove = false;
+				}
+			}
+			if (canRemove) {
+				data = data.substring(1, data.length() - 1).trim();
+			}
+		}
+		return data;
+	}
+
+	/**
+	 * Trims extra stuff away from a parameter to create a parameter label
+	 * 
+	 * @param data
+	 *            the parameter data
+	 * @param index
+	 *            the parameter index. The index will be used as label if the
+	 *            label cannot be parsed
+	 * @return the parameter label
+	 */
+	protected String trimParameter(String data, int index) {
+		// Removes possible literal macros
+		data = trimTraceText(data);
+		// Removes casting operations.
+		Matcher matcher = cppCastTrimPattern.matcher(data);
+		data = removeBrackets(matcher.replaceFirst("")); //$NON-NLS-1$
+		matcher = cCastTrimPattern.matcher(data);
+		data = matcher.replaceFirst(""); //$NON-NLS-1$
+		// Finds the next valid token from the data
+		matcher = parameterNamePattern.matcher(data);
+		if (matcher.find()) {
+			data = matcher.group();
+		} else {
+			data = DEFAULT_PARAMETER_NAME + (index + 1);
+		}
+		return data;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/printf/messages.properties	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,1 @@
+PrintfTraceParserRule.Title=Ascii Print
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/rules/printf/package.html	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,3 @@
+<html><body>
+Formatting rules for printf API
+</body></html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/source/IncludeStatementAdder.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,151 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Queues addition of #include statement into source file
+*
+*/
+package com.nokia.tracebuilder.engine.source;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.plugin.TraceFormatConstants;
+import com.nokia.tracebuilder.plugin.TraceAPIFormatter.TraceFormatType;
+import com.nokia.tracebuilder.source.SourceConstants;
+import com.nokia.tracebuilder.source.SourceEditor;
+import com.nokia.tracebuilder.source.SourceLocation;
+import com.nokia.tracebuilder.source.SourceLocationBase;
+import com.nokia.tracebuilder.source.SourceParserException;
+
+/**
+ * Queues addition of <code>#include</code> statement into source file
+ * 
+ */
+class IncludeStatementAdder extends SourceEditorUpdater {
+
+	/**
+	 * Name of include file
+	 */
+	private String includeFile;
+
+	/**
+	 * Location (0, 0) -> this is run after other operations
+	 */
+	private SourceLocationBase location;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param properties
+	 *            the source to update
+	 * @param include
+	 *            the include file to add to the source
+	 */
+	IncludeStatementAdder(SourceProperties properties, String include) {
+		super(properties);
+		includeFile = include;
+		location = properties.getSourceEditor().createHiddenLocation(0, 0);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.source.SourceEditorUpdater#runUpdate()
+	 */
+	@Override
+	protected boolean runUpdate() throws SourceParserException {
+		boolean updated = false;
+		SourceEditor sourceEditor = getSource().getSourceEditor();
+		try {
+			if (includeFile != null) {
+				
+				// Update excluded areas before finding the include
+				sourceEditor.findExcludedAreas();
+				
+				int index = sourceEditor.findInclude(includeFile);
+				if (index >= 0) {
+					// Already in the source
+					includeFile = null;
+				} else {
+					index = -1 - index;
+					String inc = createIncludeLine();
+					sourceEditor.updateSource(index, 0, inc);
+					updated = true;
+					postIncludeAddedMessage(sourceEditor, index, inc);
+				}
+			}
+		} finally {
+			// The location needs to be removed from the source
+			sourceEditor.removeHiddenLocation(location);
+		}
+		return updated;
+	}
+
+	/**
+	 * Posts an event specifying that include was added to code
+	 * 
+	 * @param sourceEditor
+	 *            the source editor
+	 * @param index
+	 *            the index where include was added
+	 * @param inc
+	 *            the include statement
+	 */
+	private void postIncludeAddedMessage(SourceEditor sourceEditor, int index,
+			String inc) {
+		// Removes white spaces from the include statement
+		String trimmed = inc.trim();
+		SourceLocation loc = sourceEditor.createLocation(index
+				+ SourceConstants.LINE_FEED.length(), trimmed.length());
+		String pref = Messages
+				.getString("IncludeStatementAdder.IncludeAddedEventPrefix"); //$NON-NLS-1$
+		String post = Messages
+				.getString("IncludeStatementAdder.IncludeAddedEventPostfix"); //$NON-NLS-1$
+		TraceBuilderGlobals.getEvents().postInfoMessage(
+				pref + includeFile + post, loc);
+		// The location reference is removed. The event handler has
+		// incremented the reference if it stored the location
+		loc.dereference();
+	}
+
+	/**
+	 * Creates the #include statement to be inserted into source
+	 * 
+	 * @return the string buffer containing the #include
+	 */
+	private String createIncludeLine() {
+		TraceFormattingRule rule = TraceBuilderGlobals.getTraceModel()
+				.getExtension(TraceFormattingRule.class);
+		String template = rule.getFormat(null, TraceFormatType.INCLUDE_FORMAT);
+		int templateIndex = template
+				.indexOf(TraceFormatConstants.INCLUDE_FORMAT);
+		StringBuffer sb = new StringBuffer();
+		sb.append(template);
+		sb.append(SourceConstants.LINE_FEED);
+		sb.replace(templateIndex, templateIndex
+				+ TraceFormatConstants.INCLUDE_FORMAT.length(), includeFile);
+		sb.insert(0, SourceConstants.LINE_FEED);
+		return sb.toString();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.source.SourceEditorUpdater#getPosition()
+	 */
+	@Override
+	protected SourceLocationBase getPosition() {
+		return location;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/source/Messages.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 source package
+*
+*/
+package com.nokia.tracebuilder.engine.source;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * Localized strings for source package
+ * 
+ */
+class Messages {
+
+	/**
+	 * Bundle name
+	 */
+	private static final String BUNDLE_NAME = "com.nokia.tracebuilder.engine.source.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/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/source/SourceEditorUpdateQueue.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,188 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Update queue for a source editor
+*
+*/
+package com.nokia.tracebuilder.engine.source;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+
+import com.nokia.tracebuilder.engine.TraceBuilderConfiguration;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+
+/**
+ * Update queue for a source editor
+ * 
+ */
+final class SourceEditorUpdateQueue implements Runnable {
+
+	/**
+	 * Comparator for the update queue
+	 */
+	private Comparator<SourceEditorUpdater> updateComparator = new Comparator<SourceEditorUpdater>() {
+
+		/**
+		 * Compares the two source editors
+		 * 
+		 * @param o1
+		 *            editor 1
+		 * @param o2
+		 *            editor 2
+		 * @return result
+		 */
+		public int compare(SourceEditorUpdater o1, SourceEditorUpdater o2) {
+			int i1 = o1.getPosition().getOffset();
+			int i2 = o2.getPosition().getOffset();
+			return (i1 > i2) ? -1 : ((i1 == i2) ? 0 : 1);
+		}
+
+	};
+
+	/**
+	 * List of update operations to be run
+	 */
+	private ArrayList<SourceEditorUpdater> updateQueue;
+
+	/**
+	 * Queued updates flag
+	 */
+	private boolean hasQueuedUpdates;
+
+	/**
+	 * Source
+	 */
+	private SourceProperties properties;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param properties
+	 *            the source
+	 */
+	SourceEditorUpdateQueue(SourceProperties properties) {
+		this.properties = properties;
+		updateQueue = new ArrayList<SourceEditorUpdater>();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Runnable#run()
+	 */
+	public void run() {
+		// Updates are copied, since an update may affect the queue
+		SourceEditorUpdater[] updaters = new SourceEditorUpdater[updateQueue
+				.size()];
+		updateQueue.toArray(updaters);
+		// Removes the operations that are run from the queue
+		resetUpdateQueue();
+		try {
+			for (int i = 0; i < updaters.length; i++) {
+				if (i == updaters.length - 1) {
+					hasQueuedUpdates = false;
+				} else {
+					hasQueuedUpdates = true;
+				}
+				boolean updated = updaters[i].runUpdate();
+				if (!updated) {
+					// Generates a dummy update, otherwise the source will be
+					// left in invalid state
+					properties.getSourceEditor().updateSource(0, 0, ""); //$NON-NLS-1$
+				}
+			}
+		} catch (Exception e) {
+			if (TraceBuilderConfiguration.ASSERTIONS_ENABLED) {
+				TraceBuilderGlobals.getEvents().postCriticalAssertionFailed(
+						"Source update failure", e); //$NON-NLS-1$
+			}
+		}
+	}
+
+	/**
+	 * Queues an asynchronous operation
+	 * 
+	 * @param updater
+	 *            the operation
+	 */
+	void queueUpdate(SourceEditorUpdater updater) {
+		if (updateQueue.isEmpty()) {
+			updateQueue.add(updater);
+			TraceBuilderGlobals.runAsyncOperation(this);
+		} else {
+			int index = Collections.binarySearch(updateQueue, updater,
+					updateComparator);
+			if (index >= 0) {
+				boolean duplicate = false;
+				// Checks backwards for duplicates
+				for (int i = index; i >= 0; i--) {
+					SourceEditorUpdater queuedUpdater = updateQueue.get(i);
+					if (queuedUpdater.getPosition().getOffset() == updater
+							.getPosition().getOffset()) {
+						if (updater.getPosition() == queuedUpdater
+								.getPosition()) {
+							duplicate = true;
+							i = -1;
+						}
+					}
+				}
+				// Also checks forwards for duplicates
+				for (int i = index; i < updateQueue.size(); i++) {
+					SourceEditorUpdater queuedUpdater = updateQueue.get(i);
+					if (queuedUpdater.getPosition().getOffset() == updater
+							.getPosition().getOffset()) {
+						if (updater.getPosition() == queuedUpdater
+								.getPosition()) {
+							duplicate = true;
+							i = updateQueue.size();
+						} else {
+							// New entry is added after others with same offset
+							index++;
+						}
+					} else {
+						i = updateQueue.size();
+					}
+				}
+				if (!duplicate) {
+					updateQueue.add(index, updater);
+				}
+			} else {
+				// Adds the update to correct position in the queue
+				// The updates are run starting from the end of file so they
+				// will not interfere each other
+				updateQueue.add(-1 - index, updater);
+			}
+		}
+	}
+
+	/**
+	 * Resets the queue when all processing has been done
+	 */
+	void resetUpdateQueue() {
+		updateQueue.clear();
+	}
+
+	/**
+	 * Flag which determines if there are updates in the queue
+	 * 
+	 * @return true if queued, false if not
+	 */
+	boolean hasQueuedUpdates() {
+		return hasQueuedUpdates;
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/source/SourceEditorUpdater.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,89 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 source file updater objects
+*
+*/
+package com.nokia.tracebuilder.engine.source;
+
+import com.nokia.tracebuilder.source.SourceLocationBase;
+import com.nokia.tracebuilder.source.SourceParserException;
+
+/**
+ * Base class for source file updater objects
+ * 
+ */
+public abstract class SourceEditorUpdater {
+
+	/**
+	 * Source properties to update
+	 */
+	private SourceProperties properties;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param properties
+	 *            the source to updated
+	 */
+	protected SourceEditorUpdater(SourceProperties properties) {
+		this.properties = properties;
+	}
+
+	/**
+	 * Updates the source
+	 */
+	public void update() {
+		properties.getUpdateQueue().queueUpdate(this);
+	}
+
+	/**
+	 * Gets the source properties
+	 * 
+	 * @return the source properties
+	 */
+	protected SourceProperties getSource() {
+		return properties;
+	}
+
+	/**
+	 * Checks if this updater equals the given updater. Default implementation
+	 * compares the position references
+	 * 
+	 * @param updater
+	 *            the updater to be checked
+	 * @return true if the updates are equal
+	 */
+	protected boolean updaterEquals(SourceEditorUpdater updater) {
+		return getPosition() == updater.getPosition();
+	}
+
+	/**
+	 * Runs the update operation on the source
+	 * 
+	 * @return true if source was updated, false if not
+	 * @throws SourceParserException
+	 *             if source parser fails
+	 */
+	protected abstract boolean runUpdate() throws SourceParserException;
+
+	/**
+	 * Gets the position where the update happens
+	 * 
+	 * @return the update position
+	 */
+	protected abstract SourceLocationBase getPosition();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/source/SourceEngine.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,739 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Source engine manages source documents that are opened to Eclipse UI
+*
+*/
+package com.nokia.tracebuilder.engine.source;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import com.nokia.tracebuilder.engine.LocationProperties;
+import com.nokia.tracebuilder.engine.TraceBuilderConfiguration;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorMessages;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceLocation;
+import com.nokia.tracebuilder.engine.TraceLocationList;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.TraceBuilderErrorCode;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceModel;
+import com.nokia.tracebuilder.model.TraceObject;
+import com.nokia.tracebuilder.model.TraceParameter;
+import com.nokia.tracebuilder.rules.ReadOnlyObjectRule;
+import com.nokia.tracebuilder.source.OffsetLength;
+import com.nokia.tracebuilder.source.SourceContext;
+import com.nokia.tracebuilder.source.SourceDocumentInterface;
+import com.nokia.tracebuilder.source.SourceDocumentMonitor;
+import com.nokia.tracebuilder.source.SourceDocumentProcessor;
+import com.nokia.tracebuilder.source.SourceParserException;
+import com.nokia.tracebuilder.utils.DocumentFactory;
+
+/**
+ * Source engine manages source documents that are opened to Eclipse UI.
+ * 
+ */
+public class SourceEngine implements SourceDocumentProcessor,
+		Iterable<SourceProperties> {
+
+	/**
+	 * Document monitor
+	 */
+	private SourceDocumentMonitor documentMonitor;
+
+	/**
+	 * Trace model listener implementation
+	 */
+	private SourceEngineModelListener modelListener = new SourceEngineModelListener(
+			this);
+
+	/**
+	 * Trace model extension listener
+	 */
+	private SourceEngineModelExtensionListener extensionListener = new SourceEngineModelExtensionListener(
+			this);
+
+	/**
+	 * The callback interfaces are notified about source file changes
+	 */
+	private ArrayList<SourceListener> listeners = new ArrayList<SourceListener>();
+
+	/**
+	 * Running flag
+	 */
+	private boolean running;
+
+	/**
+	 * Trace model
+	 */
+	private TraceModel model;
+
+	/**
+	 * Source list
+	 */
+	private ArrayList<SourceProperties> tempList = new ArrayList<SourceProperties>();
+
+	/**
+	 * Read-only files
+	 */
+	private String[] READ_ONLY = { ".h" //$NON-NLS-1$
+	};
+
+	/**
+	 * Non-source file list
+	 */
+	private ArrayList<String> nonSourceFiles = new ArrayList<String>();
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            the trace model
+	 */
+	public SourceEngine(TraceModel model) {
+		this.model = model;
+	}
+
+	/**
+	 * Starts this engine. Does nothing if already running
+	 */
+	public void start() {
+		if (!running) {
+			documentMonitor = DocumentFactory.getDocumentMonitor();
+			documentMonitor.startMonitor(this);
+			running = true;
+			model.addModelListener(modelListener);
+			model.addExtensionListener(extensionListener);
+		}
+	}
+
+	/**
+	 * Shuts down the source engine. Does nothing if already stopped
+	 */
+	public void shutdown() {
+		if (running) {
+			documentMonitor.stopMonitor();
+			documentMonitor = null;
+			running = false;
+			model.removeModelListener(modelListener);
+			model.removeExtensionListener(extensionListener);
+		}
+	}
+
+	/**
+	 * Gets the running flag
+	 * 
+	 * @return the flag
+	 */
+	public boolean isRunning() {
+		return running;
+	}
+
+	/**
+	 * Adds source listener callback interface
+	 * 
+	 * @param listener
+	 *            the new listener
+	 */
+	public void addSourceListener(SourceListener listener) {
+		listeners.add(listener);
+	}
+
+	/**
+	 * Removes a source listener
+	 * 
+	 * @param listener
+	 *            the listener to be removed
+	 */
+	public void removeSourceListener(SourceListener listener) {
+		listeners.remove(listener);
+	}
+
+	/**
+	 * Gets the sources
+	 * 
+	 * @return the sources
+	 */
+	public Iterator<SourceProperties> getSources() {
+		tempList.clear();
+		for (SourceDocumentInterface doc : documentMonitor) {
+			tempList.add((SourceProperties) doc.getOwner());
+		}
+		return tempList.iterator();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Iterable#iterator()
+	 */
+	public Iterator<SourceProperties> iterator() {
+		return getSources();
+	}
+
+	/**
+	 * Gets the currently active source
+	 * 
+	 * @return the source
+	 */
+	public SourceProperties getSelectedSource() {
+		SourceProperties srcProperties = null;
+		SourceDocumentInterface srcDocInterface = documentMonitor.getSelectedSource();
+
+		if (srcDocInterface != null) {
+			srcProperties = (SourceProperties) srcDocInterface.getOwner();
+		}
+		return srcProperties;
+	}
+
+	/**
+	 * Gets the current selection from the given source
+	 * 
+	 * @param props
+	 *            the source
+	 * @return the selection
+	 */
+	public OffsetLength getSelection(SourceProperties props) {
+		return documentMonitor
+				.getSelection(props.getSourceEditor().getSource());
+	}
+
+	/**
+	 * Sets the focus to the current source
+	 */
+	public void setFocus() {
+		documentMonitor.setFocus();
+	}
+
+	/**
+	 * Gets the source context based on current caret position. This throws an
+	 * exception if the caret is not in valid position. Invalid positions are:
+	 * <ul>
+	 * <li>Source file is not open</li>
+	 * <li>Outside function implementation</li>
+	 * <li>Within commented code</li>
+	 * <li>Within quoted strings</li>
+	 * </ul>
+	 * 
+	 * @return the context
+	 */
+	public SourceContext getSelectedContext() {
+		SourceContext retval = null;
+		// checkInsertLocation verifies that source is editable
+		if (checkInsertLocation()) {
+			SourceDocumentInterface selectedSource = documentMonitor
+					.getSelectedSource();
+			SourceProperties properties = (SourceProperties) selectedSource
+					.getOwner();
+			OffsetLength offset = documentMonitor.getSelection(selectedSource);
+			retval = properties.getSourceEditor().getContext(offset.offset);
+		}
+		return retval;
+	}
+
+	/**
+	 * Gets the source properties related to given context
+	 * 
+	 * @param context
+	 *            the context
+	 * @return the properties
+	 */
+	public SourceProperties getSourceOfContext(SourceContext context) {
+		return (SourceProperties) context.getParser().getSource().getOwner();
+	}
+
+	/**
+	 * Checks the validity of cursor location
+	 * 
+	 * @throws TraceBuilderException
+	 *             if trace can be inserted to cursor location
+	 */
+	public void checkCursorLocationValidity() throws TraceBuilderException {
+		SourceDocumentInterface document = documentMonitor.getSelectedSource();
+		if (document != null) {
+			SourceProperties properties = (SourceProperties) document
+					.getOwner();
+			if (!properties.isReadOnly()) {
+				OffsetLength selection = documentMonitor.getSelection(document);
+				if (selection == null) {
+					throw new TraceBuilderException(
+							TraceBuilderErrorCode.INVALID_SOURCE_LOCATION);
+				}
+			} else {
+				throw new TraceBuilderException(
+						TraceBuilderErrorCode.SOURCE_NOT_EDITABLE);
+			}
+		} else {
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.SOURCE_NOT_OPEN);
+		}
+	}
+
+	/**
+	 * Inserts a trace to the start of the current selection. Creates a
+	 * {@link SourceListener#sourceChanged(SourceProperties) sourceChanged}
+	 * event to all listeners after each trace has been added.
+	 * 
+	 * @param trace
+	 *            the trace to be added to the start of selection
+	 * @return the insert location for the trace
+	 * @throws TraceBuilderException
+	 *             if insertion fails
+	 */
+	public int addTrace(Trace trace) throws TraceBuilderException {
+		// Checks the location validity before inserting
+		checkCursorLocationValidity();
+		ReadOnlyObjectRule readOnly = trace
+				.getExtension(ReadOnlyObjectRule.class);
+		if (readOnly != null) {
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.INSERT_TRACE_DOES_NOT_WORK);
+		}
+		SourceDocumentInterface document = documentMonitor.getSelectedSource();
+		int retval = documentMonitor.getSelection(document).offset;
+		insertTrace(trace, (SourceProperties) document.getOwner(), retval);
+		return retval;
+	}
+
+	/**
+	 * Queues the addition of #include statement to source
+	 * 
+	 * @param source
+	 *            the source to be updated
+	 * @param name
+	 *            the include file name
+	 */
+	public void addInclude(SourceProperties source, String name) {
+		if (!source.isReadOnly()) {
+			IncludeStatementAdder adder = new IncludeStatementAdder(source,
+					name);
+			adder.update();
+		}
+	}
+
+	/**
+	 * Removes a trace location from source
+	 * 
+	 * @param location
+	 *            the location to be removed
+	 */
+	public void removeLocation(TraceLocation location) {
+		if (!location.getSource().isReadOnly()) {
+			TraceLocationWriter.removeLocation(location);
+		}
+	}
+
+	/**
+	 * Inserts a trace into the given source file at given offset. Creates a
+	 * {@link SourceListener#sourceChanged(SourceProperties) sourceChanged}
+	 * event to all listeners after the trace has been added.
+	 * 
+	 * @param trace
+	 *            the trace to be added
+	 * @param source
+	 *            the source where trace is added
+	 * @param offset
+	 *            the offset where trace is added
+	 * @throws TraceBuilderException
+	 *             if insertion fails
+	 */
+	public void insertTrace(Trace trace, SourceProperties source, int offset)
+			throws TraceBuilderException {
+		if (!source.isReadOnly()) {
+			try {
+				TraceLocationWriter.addLocation(source, trace, offset);
+			} catch (Exception e) {
+				throw new TraceBuilderException(
+						TraceBuilderErrorCode.INVALID_SOURCE_LOCATION, null,
+						trace);
+			}
+		}
+	}
+
+	/**
+	 * Replaces a location with the given trace. The parameters from the
+	 * existing location are not changed
+	 * 
+	 * @param trace
+	 *            the trace to be inserted
+	 * @param replaced
+	 *            the location to be replaced with the trace
+	 * @throws TraceBuilderException
+	 *             if insertion fails
+	 */
+	public void replaceLocationWithTrace(Trace trace, TraceLocation replaced)
+			throws TraceBuilderException {
+		removeLocation(replaced);
+		SourceProperties source = replaced.getSource();
+		if (source != null && !source.isReadOnly()) {
+			try {
+				TraceLocationWriter.replaceLocation(source, trace, replaced);
+			} catch (Exception e) {
+				throw new TraceBuilderException(
+						TraceBuilderErrorCode.INVALID_SOURCE_LOCATION, null,
+						trace);
+			}
+		}
+	}
+
+	/**
+	 * Fires sourceChanged event to listeners
+	 * 
+	 * @see SourceListener#sourceChanged(SourceProperties)
+	 * @param source
+	 *            the source
+	 */
+	private void fireSourceChanged(SourceProperties source) {
+		for (SourceListener l : listeners) {
+			l.sourceChanged(source);
+		}
+	}
+
+	/**
+	 * Fires sourceProcessingStarted event to listeners
+	 * 
+	 * @see SourceListener#sourceProcessingStarted(SourceProperties)
+	 * @param source
+	 *            the source
+	 */
+	private void fireSourceProcessingStarted(SourceProperties source) {
+		for (SourceListener l : listeners) {
+			l.sourceProcessingStarted(source);
+		}
+	}
+
+	/**
+	 * Fires sourceProcessingComplete event to listeners
+	 * 
+	 * @see SourceListener#sourceProcessingComplete(SourceProperties)
+	 * @param source
+	 *            the source
+	 */
+	private void fireSourceProcessingComplete(SourceProperties source) {
+		for (SourceListener l : listeners) {
+			l.sourceProcessingComplete(source);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceDocumentProcessor#
+	 *      sourceOpened(com.nokia.tracebuilder.source.SourceDocumentInterface)
+	 */
+	public void sourceOpened(SourceDocumentInterface source) {
+		SourceProperties properties = new SourceProperties(model,
+				documentMonitor.getFactory(), source);
+		// Headers are marked read-only
+		for (String s : READ_ONLY) {
+			String fileName = properties.getFileName();
+			if (fileName != null && fileName.endsWith(s)) {
+				properties.setReadOnly(true);
+				break;
+			}
+		}
+		properties.sourceOpened();
+		source.setOwner(properties);
+		for (SourceListener l : listeners) {
+			l.sourceOpened(properties);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceDocumentProcessor#
+	 *      selectionChanged(com.nokia.tracebuilder.source.SourceDocumentInterface,
+	 *      int, int)
+	 */
+	public void selectionChanged(SourceDocumentInterface source, int offset,
+			int length) {
+		SourceProperties properties = (SourceProperties) source.getOwner();
+		TraceLocation location = properties.getLocation(offset);
+		if (location != null && location.getLocationList() != null) {
+			for (SourceListener l : listeners) {
+				l.selectionChanged(location);
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceDocumentProcessor#
+	 *      sourceAboutToBeChanged(com.nokia.tracebuilder.source.SourceDocumentInterface,
+	 *      int, int, java.lang.String)
+	 */
+	public void sourceAboutToBeChanged(SourceDocumentInterface source,
+			int offset, int length, String newText) {
+		SourceProperties properties = (SourceProperties) source.getOwner();
+		try {
+			if (!properties.getUpdateQueue().hasQueuedUpdates()) {
+				properties.prepareChange(offset, length, newText);
+			}
+		} catch (Exception e) {
+			if (TraceBuilderConfiguration.ASSERTIONS_ENABLED) {
+				TraceBuilderGlobals.getEvents().postCriticalAssertionFailed(
+						"Document change preprocessor failure", e); //$NON-NLS-1$
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceDocumentProcessor#
+	 *      sourceChanged(com.nokia.tracebuilder.source.SourceDocumentInterface,
+	 *      int, int, java.lang.String)
+	 */
+	public void sourceChanged(SourceDocumentInterface source, int offset,
+			int length, String newText) {
+		SourceProperties properties = (SourceProperties) source.getOwner();
+		try {
+			sourceChanged(properties, offset, length, newText);
+		} catch (Exception e) {
+			if (TraceBuilderConfiguration.ASSERTIONS_ENABLED) {
+				TraceBuilderGlobals.getEvents().postCriticalAssertionFailed(
+						"Document change processor failure", e); //$NON-NLS-1$
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceDocumentProcessor#
+	 *      sourceClosed(com.nokia.tracebuilder.source.SourceDocumentInterface)
+	 */
+	public void sourceClosed(SourceDocumentInterface source) {
+		SourceProperties properties = (SourceProperties) source.getOwner();
+		for (SourceListener l : listeners) {
+			l.sourceClosed(properties);
+		}
+		properties.sourceClosed();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceDocumentProcessor#
+	 *      sourceSaved(com.nokia.tracebuilder.source.SourceDocumentInterface)
+	 */
+	public void sourceSaved(SourceDocumentInterface source) {
+		SourceProperties properties = (SourceProperties) source.getOwner();
+		for (SourceListener l : listeners) {
+			l.sourceSaved(properties);
+		}
+	}
+
+	/**
+	 * Checks that the current caret position is valid for trace insertion
+	 * 
+	 * @return true if valid, false if not
+	 */
+	private boolean checkInsertLocation() {
+		boolean retval = false;
+		SourceDocumentInterface selectedSource = documentMonitor
+				.getSelectedSource();
+		if (selectedSource != null) {
+			if (documentMonitor.isSourceEditable(selectedSource)) {
+				SourceProperties properties = (SourceProperties) selectedSource
+						.getOwner();
+				if (!properties.isReadOnly()) {
+					OffsetLength selection = documentMonitor
+							.getSelection(selectedSource);
+					if (selection != null) {
+						retval = properties
+								.checkInsertLocation(selection.offset);
+					}
+				}
+			}
+		}
+		return retval;
+	}
+
+	/**
+	 * Processes a source change notification
+	 * 
+	 * @param source
+	 *            the changed source
+	 * @param offset
+	 *            offset to the replaced text
+	 * @param length
+	 *            the length of the replaced text
+	 * @param newText
+	 *            the text that was added to the document
+	 * @throws SourceParserException
+	 *             if processing fails
+	 */
+	private void sourceChanged(SourceProperties source, int offset, int length,
+			String newText) throws SourceParserException {
+		// When the source update queue contains more than one element, it is
+		// faster to disable all updates and do a full sync afterwards
+		// The source update queue must ensure that the updates are run starting
+		// from the bottom of the file. This way they will not interfere with
+		// each other
+		if (source.getUpdateQueue().hasQueuedUpdates()) {
+			if (source.isActive()) {
+				fireSourceProcessingStarted(source);
+				source.setActive(false);
+			}
+		} else {
+			if (source.isActive()) {
+				source.preProcessChange(offset, length, newText);
+				fireSourceChanged(source);
+				source.postProcessChange();
+			} else {
+				source.setActive(true);
+				source.preProcessFullSync(offset, length, newText);
+				fireSourceProcessingComplete(source);
+				source.postProcessFullSync();
+			}
+		}
+	}
+
+	/**
+	 * Updates a trace location
+	 * 
+	 * @param trace
+	 *            the trace
+	 */
+	public void updateTrace(Trace trace) {
+		if (trace.getModel().isValid()) {
+			// Read-only traces cannot be updated
+			if (trace.getExtension(ReadOnlyObjectRule.class) == null) {
+				TraceLocationList list = trace
+						.getExtension(TraceLocationList.class);
+				if (list != null) {
+					for (LocationProperties loc : list) {
+						TraceLocationWriter.updateLocation((TraceLocation) loc);
+					}
+				}
+			} else {
+				String msg = TraceBuilderErrorMessages.getErrorMessage(
+						TraceBuilderErrorCode.CANNOT_UPDATE_TRACE_INTO_SOURCE,
+						null);
+				TraceBuilderGlobals.getEvents().postWarningMessage(msg, trace);
+			}
+		}
+	}
+
+	/**
+	 * Parser rule added notification
+	 * 
+	 * @param rule
+	 *            the parser rule
+	 */
+	void parserAdded(SourceParserRule rule) {
+		for (SourceProperties source : this) {
+			source.addParserRule(rule);
+			try {
+				source.preProcessFullSync(0, 0, ""); //$NON-NLS-1$
+				fireSourceChanged(source);
+				source.postProcessFullSync();
+			} catch (Exception e) {
+				if (TraceBuilderConfiguration.ASSERTIONS_ENABLED) {
+					TraceBuilderGlobals.getEvents()
+							.postCriticalAssertionFailed(
+									"Failed to add parser", e); //$NON-NLS-1$
+				}
+			}
+		}
+	}
+
+	/**
+	 * Parser rule removed notification
+	 * 
+	 * @param rule
+	 *            the parser rule
+	 */
+	void parserRemoved(SourceParserRule rule) {
+		for (SourceProperties source : this) {
+			source.removeParserRule(rule);
+			try {
+				source.preProcessFullSync(0, 0, ""); //$NON-NLS-1$
+				fireSourceChanged(source);
+				source.postProcessFullSync();
+			} catch (Exception e) {
+				if (TraceBuilderConfiguration.ASSERTIONS_ENABLED) {
+					TraceBuilderGlobals.getEvents()
+							.postCriticalAssertionFailed(
+									"Failed to remove parser", e); //$NON-NLS-1$
+				}
+			}
+		}
+	}
+
+	/**
+	 * Called when a rule is added or removed
+	 * 
+	 * @param object
+	 *            the object which was changed
+	 */
+	void ruleUpdated(TraceObject object) {
+		// Formatting rule changes cause updates to source
+		if (object.isComplete()) {
+			if (object instanceof TraceParameter) {
+				Trace owner = ((TraceParameter) object).getTrace();
+				if (owner.isComplete()) {
+					updateTrace(owner);
+				}
+			} else if (object instanceof Trace) {
+				updateTrace((Trace) object);
+			}
+		}
+	}
+
+	/**
+	 * Adds a non-source file to this list.
+	 * 
+	 * @param filePath
+	 *            the non-source file path to added
+	 */
+	public void addNonSourceFile(String filePath) {
+		nonSourceFiles.add(filePath);
+	}
+
+	/**
+	 * Removes a non-source file from this list
+	 * 
+	 * @param filePath
+	 *            the non-source file path to be removed
+	 * @return true if removed
+	 */
+	public boolean removeNonSourceFile(String filePath) {
+		boolean retVal = nonSourceFiles.remove(filePath);
+		return retVal;
+	}
+
+	/**
+	 * Removes a non-source files
+	 * 
+	 */
+	public void removeNonSourceFiles() {
+		nonSourceFiles.clear();
+	}
+
+	/**
+	 * Gets lis of non-source files
+	 * 
+	 * @return the list of non-source file paths
+	 */
+	public ArrayList<String> getNonSourceFiles() {
+		return nonSourceFiles;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/source/SourceEngineModelExtensionListener.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 model extension listener implementation for SourceEngine
+*
+*/
+package com.nokia.tracebuilder.engine.source;
+
+import com.nokia.tracebuilder.model.TraceModel;
+import com.nokia.tracebuilder.model.TraceModelExtension;
+import com.nokia.tracebuilder.model.TraceModelExtensionListener;
+import com.nokia.tracebuilder.model.TraceObject;
+
+/**
+ * Trace model extension listener implementation for SourceEngine
+ * 
+ */
+final class SourceEngineModelExtensionListener implements
+		TraceModelExtensionListener {
+
+	/**
+	 * Source engine
+	 */
+	private final SourceEngine sourceEngine;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param engine
+	 *            the source engine
+	 */
+	SourceEngineModelExtensionListener(SourceEngine engine) {
+		sourceEngine = engine;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelListener#
+	 *      extensionAdded(com.nokia.tracebuilder.model.TraceObject,
+	 *      com.nokia.tracebuilder.model.TraceModelExtension)
+	 */
+	public void extensionAdded(TraceObject object, TraceModelExtension extension) {
+		// Parser rules that are added to model are taken into use
+		if (object instanceof TraceModel
+				&& extension instanceof SourceParserRule) {
+			sourceEngine.parserAdded((SourceParserRule) extension);
+		} else if (extension instanceof TraceFormattingRule) {
+			sourceEngine.ruleUpdated(object);
+		} else if (extension instanceof TraceParameterFormattingRule) {
+			sourceEngine.ruleUpdated(object);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelListener#
+	 *      extensionRemoved(com.nokia.tracebuilder.model.TraceObject,
+	 *      com.nokia.tracebuilder.model.TraceModelExtension)
+	 */
+	public void extensionRemoved(TraceObject object,
+			TraceModelExtension extension) {
+		// Parser rules that are removed from model are removed from sources
+		if (object instanceof TraceModel
+				&& extension instanceof SourceParserRule) {
+			sourceEngine.parserRemoved((SourceParserRule) extension);
+		} else if (extension instanceof TraceFormattingRule) {
+			// When changing formatting, the existing formatting rule will
+			// be removed and a new one added. When formatting rule is
+			// removed, the trace must not be updated since it would
+			// disappear from the source
+		} else if (extension instanceof TraceParameterFormattingRule) {
+			sourceEngine.ruleUpdated(object);
+		}
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/source/SourceEngineModelListener.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,112 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 model listener implementation for SourceEngine
+*
+*/
+package com.nokia.tracebuilder.engine.source;
+
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceGroup;
+import com.nokia.tracebuilder.model.TraceModelListener;
+import com.nokia.tracebuilder.model.TraceObject;
+import com.nokia.tracebuilder.model.TraceParameter;
+
+/**
+ * Trace model listener implementation for SourceEngine
+ * 
+ */
+final class SourceEngineModelListener implements TraceModelListener {
+
+	/**
+	 * Source engine
+	 */
+	private final SourceEngine sourceEngine;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param engine
+	 *            the source engine
+	 */
+	SourceEngineModelListener(SourceEngine engine) {
+		sourceEngine = engine;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelListener#
+	 *      objectAdded(com.nokia.tracebuilder.model.TraceObject,
+	 *      com.nokia.tracebuilder.model.TraceObject)
+	 */
+	public void objectAdded(TraceObject owner, TraceObject object) {
+		// Update is called from TraceBuilder engine
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelListener#
+	 *      objectRemoved(com.nokia.tracebuilder.model.TraceObject,
+	 *      com.nokia.tracebuilder.model.TraceObject)
+	 */
+	public void objectRemoved(TraceObject owner, TraceObject object) {
+		if (object instanceof TraceParameter) {
+			// If there is a rule that prevents the parameter to be shown in
+			// source, there is no need to update
+			TraceParameterFormattingRule rule = object
+					.getExtension(TraceParameterFormattingRule.class);
+			if (rule == null || rule.isShownInSource()) {
+				sourceEngine.updateTrace((Trace) owner);
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelListener#
+	 *      objectCreationComplete(com.nokia.tracebuilder.model.TraceObject)
+	 */
+	public void objectCreationComplete(TraceObject object) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelListener#
+	 *      propertyUpdated(com.nokia.tracebuilder.model.TraceObject, int)
+	 */
+	public void propertyUpdated(TraceObject object, int property) {
+		// Does not update until complete
+		if (object.isComplete()) {
+			if (object instanceof Trace) {
+				if (property == TraceModelListener.NAME
+						|| property == TraceModelListener.TRACE) {
+					sourceEngine.updateTrace((Trace) object);
+				}
+			} else if (object instanceof TraceGroup) {
+				// Updates the group name
+				if (property == TraceModelListener.NAME) {
+					TraceGroup group = (TraceGroup) object;
+					for (Trace trace : group) {
+						sourceEngine.updateTrace(trace);
+					}
+				}
+			}
+		}
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/source/SourceFormatter.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,494 @@
+/*
+ * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ * Formatting rules are provided by Trace objects
+ *
+ */
+package com.nokia.tracebuilder.engine.source;
+
+import java.util.Iterator;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.rules.RuleUtils;
+import com.nokia.tracebuilder.engine.rules.StateTraceRule;
+import com.nokia.tracebuilder.engine.rules.osttrace.OstTraceFormatRule;
+import com.nokia.tracebuilder.engine.rules.printf.PrintfTraceParserRule;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceParameter;
+import com.nokia.tracebuilder.plugin.TraceFormatConstants;
+import com.nokia.tracebuilder.plugin.TraceAPIFormatter.TraceFormatType;
+import com.nokia.tracebuilder.project.GroupNameHandlerBase;
+import com.nokia.tracebuilder.source.SourceConstants;
+import com.nokia.tracebuilder.source.SourceUtils;
+import com.nokia.tracebuilder.source.SymbianConstants;
+
+/**
+ * Static functions for source formatting
+ * 
+ */
+public class SourceFormatter {
+
+	/**
+	 * Value parameter name
+	 */
+	public static final String VALUE_PARAMETER_NAME = "value"; //$NON-NLS-1$	
+
+	/**
+	 * Event start trace id parameter name
+	 */
+	public static final String EVENT_START_TRACE_ID_PARAMETER_NAME = "linkToStart"; //$NON-NLS-1$		
+
+	/**
+	 * Numder of first parameter
+	 */
+	private static final int FIRST_PARAMETER = 1;
+
+	/**
+	 * Numder of second parameter
+	 */
+	private static final int SECOND_PARAMETER = 2;
+
+	/**
+	 * Constructor is hidden
+	 */
+	private SourceFormatter() {
+	}
+
+	/**
+	 * Formats a trace to string format using the formatting rule from the trace
+	 * 
+	 * @param trace
+	 *            the trace
+	 * @param formatType
+	 *            the type of format
+	 * @return the trace string
+	 */
+	public static String formatTrace(Trace trace, TraceFormatType formatType) {
+		return formatTrace(trace, null, formatType, null, false);
+	}
+
+	/**
+	 * Formats a trace to string format
+	 * 
+	 * @param trace
+	 *            the trace
+	 * @param traceRule
+	 *            the formatting rule to be used
+	 * @param formatType
+	 *            the type of format
+	 * @param tags
+	 *            the tags for parameters or null if parameter names are used
+	 * @param fixedTags
+	 *            true if the <i>tags</i> iterator is fixed, false if the
+	 *            contents of <i>tags</i> should go through
+	 *            <code>SourceRule.mapNameToSource</code>
+	 * @return the trace string
+	 */
+	static String formatTrace(Trace trace, TraceFormattingRule traceRule,
+			TraceFormatType formatType, Iterator<String> tags, boolean fixedTags) {
+		StringBuffer data = new StringBuffer();
+		String format = null;
+		if (traceRule == null) {
+
+			// If rule is not explicitly provided, it is fetched from the trace
+			traceRule = trace.getExtension(TraceFormattingRule.class);
+			if (traceRule == null) {
+
+				// If trace does not have a formatting rule, the project API's
+				// should implement default rule
+				traceRule = trace.getModel().getExtension(
+						TraceFormattingRule.class);
+			}
+		}
+		if (traceRule != null) {
+			format = traceRule.getFormat(trace, formatType);
+		}
+		if (format != null && traceRule != null) {
+			data.append(format);
+			data.append(SourceConstants.LINE_FEED);
+			buildParameterList(trace, traceRule, data, formatType, tags,
+					fixedTags);
+
+			String traceName = traceRule.mapNameToSource(trace);
+			String traceGroupName = trace.getGroup().getName();
+
+			// %NAME% is replaced with rule-mapped trace name
+			replaceData(data, traceName, TraceFormatConstants.NAME_FORMAT);
+			GroupNameHandlerBase groupNameHandler = TraceBuilderGlobals.getGroupNameHandler();
+			String[] defaultGroups = groupNameHandler.getDefaultGroups();
+			if ((formatType == TraceFormatType.NORMAL_TRACE
+					&& traceGroupName
+							.equals(defaultGroups[groupNameHandler.getStateGroupIdIndex()]) && trace
+					.getParameterCount() <= 1)) {
+
+				// In case of State Trace set default values to State Machine
+				// Name and State Machine State if needed
+
+				// %STATE_MACHINE_NAME% is replaced with default machine name
+				String defaultMachineNameText = Messages
+						.getString("SourceFormatter.defaultStateMachineNameText"); //$NON-NLS-1$
+				replaceData(data, defaultMachineNameText,
+						TraceFormatConstants.STATE_MACHINE_NAME_FORMAT);
+
+				TraceParameter machineParameter = new TraceParameter(trace);
+				machineParameter
+						.setName(PrintfTraceParserRule.DEFAULT_PARAMETER_NAME
+								+ FIRST_PARAMETER);
+				machineParameter.setType(TraceParameter.ASCII);
+
+				// %STATE_MACHINE_STATE% is replaced with default state
+				String defaultStateText = Messages
+						.getString("SourceFormatter.defaultStateMachineStateText"); //$NON-NLS-1$
+				replaceData(data, defaultStateText,
+						TraceFormatConstants.STATE_MACHINE_STATE_FORMAT);
+
+				TraceParameter stateParameter = new TraceParameter(trace);
+				stateParameter
+						.setName(PrintfTraceParserRule.DEFAULT_PARAMETER_NAME
+								+ SECOND_PARAMETER);
+				stateParameter.setType(TraceParameter.ASCII);
+			} else if ((formatType == TraceFormatType.COMPLEX_TRACE
+					&& traceGroupName
+							.equals(defaultGroups[groupNameHandler.getStateGroupIdIndex()]) && trace
+					.getParameterCount() > 1)) {
+
+				// %STATE_MACHINE_NAME% is replaced with empty string
+				replaceData(data, "", //$NON-NLS-1$
+						TraceFormatConstants.STATE_MACHINE_NAME_FORMAT);
+
+				// %STATE_MACHINE_STATE% is replaced with empty string
+				replaceData(data, "", //$NON-NLS-1$
+						TraceFormatConstants.STATE_MACHINE_STATE_FORMAT);
+			} else if (formatType == TraceFormatType.NORMAL_TRACE
+					&& traceGroupName
+							.equals(defaultGroups[groupNameHandler.getPerformanceGroupIdIndex()])
+					&& (data.toString()
+							.startsWith(OstTraceFormatRule.OST_TRACE_EVENT_START_TAG))) {
+
+				// %EVENT_NAME% is replaced with event name
+				replaceData(data, "\"" + trace.getTrace() //$NON-NLS-1$
+						+ "\"", TraceFormatConstants.EVENT_NAME_FORMAT); //$NON-NLS-1$
+
+				// In case of OstTraceEventStart1 add value parameter if it is
+				// not yet added
+				if (data.toString().startsWith(
+						OstTraceFormatRule.OST_TRACE_EVENT_START_TAG + "1") //$NON-NLS-1$
+						&& trace.getParameterCount() < 1) {
+					TraceParameter valueParameter = new TraceParameter(trace);
+					valueParameter.setName(VALUE_PARAMETER_NAME);
+					valueParameter.setType(TraceParameter.SDEC32);
+				}
+			} else if ((formatType == TraceFormatType.NORMAL_TRACE
+					&& traceGroupName
+							.equals(defaultGroups[groupNameHandler.getPerformanceGroupIdIndex()]) 
+							&& trace.getParameterCount() < 1)
+					&& data.toString().startsWith(
+							OstTraceFormatRule.OST_TRACE_EVENT_STOP_TAG)) {
+
+				// %EVENT_NAME% is replaced with event name
+				replaceData(data, "\"" + trace.getTrace() //$NON-NLS-1$
+						+ "\"", TraceFormatConstants.EVENT_NAME_FORMAT); //$NON-NLS-1$
+
+				// In case of Performance Event Stop Trace set value to Event
+				// Start Trace ID
+				int exitNameSuffixLength = RuleUtils.EXIT_NAME_SUFFIXES[RuleUtils.TYPE_PERF_EVENT]
+						.length();
+				String startTraceName = traceName.substring(0, traceName
+						.length()
+						- exitNameSuffixLength)
+						+ RuleUtils.ENTRY_NAME_SUFFIXES[RuleUtils.TYPE_PERF_EVENT];
+				replaceData(data, startTraceName,
+						TraceFormatConstants.EVENT_START_TRACE_NAME_FORMAT);
+
+				// Create event start trace id parameter
+				TraceParameter eventStartTraceIDParameter = new TraceParameter(
+						trace);
+				eventStartTraceIDParameter
+						.setName(EVENT_START_TRACE_ID_PARAMETER_NAME);
+				eventStartTraceIDParameter.setType(TraceParameter.UDEC32);
+			} else if ((formatType == TraceFormatType.NORMAL_TRACE
+					&& traceGroupName
+							.equals(defaultGroups[groupNameHandler.getPerformanceGroupIdIndex()]) 
+							&& trace.getParameterCount() < 1)
+					&& data.toString().startsWith(
+							OstTraceFormatRule.OST_TRACE_EVENT_STOP_TAG)) {
+
+				// "%EVENT_NAME%, " is replaced with empty string
+				String stringToBeReplaced = TraceFormatConstants.EVENT_NAME_FORMAT
+						+ ", "; //$NON-NLS-1$
+				replaceData(data, "", stringToBeReplaced); //$NON-NLS-1$
+
+				// %EVENT_START_TRACE_NAME% is replaced with empty string
+				replaceData(data, "", //$NON-NLS-1$
+						TraceFormatConstants.EVENT_START_TRACE_NAME_FORMAT);
+			}
+
+			// %GROUP% is replaced with group name
+			replaceData(data, traceGroupName, TraceFormatConstants.GROUP_FORMAT);
+
+			// %TEXT% is replaced with trace text
+			replaceData(data, "\"" + trace.getTrace() //$NON-NLS-1$
+					+ "\"", TraceFormatConstants.TEXT_FORMAT); //$NON-NLS-1$
+
+			// %FORMATTED_TRACE% is replaced with trace data
+			replaceData(data, trace.getTrace(),
+					TraceFormatConstants.FORMATTED_TRACE);
+
+			// Comment is inserted before the trace
+			int index = data.indexOf(TraceFormatConstants.COMMENT_FORMAT);
+			if (index >= 0) {
+				String comment = data.substring(index + 1);
+				data.delete(index, data.length());
+				data.insert(0, comment);
+				data.append(SourceConstants.LINE_FEED);
+			}
+		}
+
+		// If trace does not have formatting, it is not shown in source
+		return data.toString();
+	}
+
+	/**
+	 * Adds the parameters to the data buffer
+	 * 
+	 * @param trace
+	 *            the trace
+	 * @param format
+	 *            the formatter from trace
+	 * @param data
+	 *            the data buffer where the formatted data is stored
+	 * @param formatType
+	 *            the format type to be applied
+	 * @param tags
+	 *            the tags for parameters or null if parameter names are used
+	 * @param fixedTags
+	 *            true if the <i>tags</i> iterator is fixed, false if the
+	 *            contents of <i>tags</i> should go through
+	 *            <code>SourceRule.mapNameToSource</code>
+	 */
+	private static void buildParameterList(Trace trace,
+			TraceFormattingRule format, StringBuffer data,
+			TraceFormatType formatType, Iterator<String> tags, boolean fixedTags) {
+
+		// Auto add value parameter in case of Performance Event Stop header
+		// trace
+		GroupNameHandlerBase groupNameHandler = TraceBuilderGlobals.getGroupNameHandler();
+		if (trace.getGroup().getName().endsWith(
+				groupNameHandler.getDefaultGroups()[groupNameHandler.getPerformanceGroupIdIndex()])
+				&& formatType == TraceFormatType.HEADER) {
+			// Add value parameter before Event Start Trace ID parameter
+			TraceParameter eventStartTraceIDParameter = trace.getParameter(0);
+			trace.removeParameterAt(0);
+			TraceParameter valueParameter = new TraceParameter(trace);
+			valueParameter.setName(VALUE_PARAMETER_NAME);
+			valueParameter.setType(TraceParameter.SDEC32);
+			trace.addParameter(eventStartTraceIDParameter);
+		}
+
+		int count = trace.getParameterCount();
+
+		Iterator<TraceParameter> itr = trace.getParameters();
+		StringBuffer paramList = new StringBuffer();
+		// Index is incremented by one for each parameter that has been added to
+		// source
+		int parameterIndex = 0;
+		while (itr.hasNext()) {
+			TraceParameter param = itr.next();
+			TraceParameterFormattingRule rule = param
+					.getExtension(TraceParameterFormattingRule.class);
+			String name;
+			// Count and name may be adjusted by rules provided by parameters
+			if (rule != null) {
+				boolean isInSource = rule.isShownInSource();
+				// If the parameter iterator is explicitly provided, the
+				// parameter name is fetched from it. If the parameter list does
+				// not have enough tags (for example when a new parameter is
+				// added to trace) the name of the parameter is used. The source
+				// rule is used to map the parameter name to correct format
+				if (isInSource) {
+					if (formatType == TraceFormatType.NORMAL_TRACE
+							|| formatType == TraceFormatType.COMPLEX_TRACE) {
+						name = getMappedTag(tags, fixedTags, param, rule);
+					} else {
+						name = getTagWithoutMapping(tags, param);
+					}
+					addParameter(paramList, param, name, ++parameterIndex,
+							formatType);
+				} else {
+					// If the parameter is not shown in source, it is skipped
+					count--;
+				}
+			} else {
+				// If the parameter is not associated with a source rule, it is
+				// added without mapping
+				name = getTagWithoutMapping(tags, param);
+				addParameter(paramList, param, name, ++parameterIndex,
+						formatType);
+			}
+		}
+		// %PC% is replaced with adjusted parameter count
+		// In case of packed trace, the header engine does the count mapping
+		if (formatType != TraceFormatType.TRACE_PACKED) {
+			String val = format.mapParameterCountToSource(trace, count);
+
+			if (trace.getExtension(StateTraceRule.class) != null
+					&& data.toString().startsWith("OstTraceState")) { //$NON-NLS-1$
+
+				// In case of State Trace macro value in trace macro is
+				// parameter count - 2
+				if (count > 1) {
+					val = String.valueOf(count - 2); // CodForChk_Dis_Magic
+				} else {
+					val = String.valueOf(count);
+				}
+			}
+			replaceData(data, val, TraceFormatConstants.PARAM_COUNT_FORMAT);
+		}
+		// %PARAMETERS% is replaced with parameter names
+		replaceData(data, paramList.toString(),
+				TraceFormatConstants.PARAMETERS_FORMAT);
+	}
+
+	/**
+	 * Gets the name for a parameter without source rule mapping. If the tags
+	 * iterator contains a valid entry, the name is fetched from it. If not, the
+	 * parameter name is used instead.
+	 * 
+	 * @param tags
+	 *            the list of tags
+	 * @param param
+	 *            the parameter
+	 * @return the parameter name
+	 */
+	private static String getTagWithoutMapping(Iterator<String> tags,
+			TraceParameter param) {
+		String name;
+		// If the parameter iterator is explicitly provided, the
+		// parameter name is fetched from it
+		if (tags != null && tags.hasNext()) {
+			name = tags.next();
+			// The list may contain 0-length items to represent
+			// that that parameter name should be used instead
+			if (name == null || name.length() == 0) {
+				name = param.getName();
+			}
+		} else {
+			name = param.getName();
+		}
+		return name;
+	}
+
+	/**
+	 * Gets the name for a parameter using source rule mapping. If the tags
+	 * iterator contains a valid entry, the name is fetched from it and if the
+	 * fixedTags flag is false, the name is mapped using the source rule. If the
+	 * iterator does not contain a valid entry, the parameter name is used and
+	 * the mapping is done regardless of the fixedTag value.
+	 * 
+	 * @param tags
+	 *            the tags iterator
+	 * @param fixedTags
+	 *            false if the tag from iterator should be passed through the
+	 *            source rule
+	 * @param param
+	 *            the parameter
+	 * @param rule
+	 *            the formatting rule for the parameter
+	 * @return the parameter name
+	 */
+	private static String getMappedTag(Iterator<String> tags,
+			boolean fixedTags, TraceParameter param,
+			TraceParameterFormattingRule rule) {
+		String name;
+		boolean nameFromTag;
+		// If the parameter iterator is explicitely provided,
+		// the parameter name is fetched from it
+		if (tags != null && tags.hasNext()) {
+			name = tags.next();
+			nameFromTag = true;
+			// The list may contain 0-length items to represent
+			// that that parameter name should be used instead
+			if (name == null || name.length() == 0) {
+				name = param.getName();
+				nameFromTag = false;
+			}
+		} else {
+			name = param.getName();
+			nameFromTag = false;
+		}
+		// If tags are fixed and the name was from the tags
+		// list, the source mapping is not done
+		if (!fixedTags || !nameFromTag) {
+			name = rule.mapNameToSource(name);
+		}
+		return name;
+	}
+
+	/**
+	 * Adds a parameter to the parameter list
+	 * 
+	 * @param paramList
+	 *            the parameter list
+	 * @param param
+	 *            the parameter to be added
+	 * @param name
+	 *            a name replacement for the parameter
+	 * @param parameterIndex
+	 *            the index of the parameter
+	 * @param formatType
+	 *            the type of the format
+	 */
+	private static void addParameter(StringBuffer paramList,
+			TraceParameter param, String name, int parameterIndex,
+			TraceFormatType formatType) {
+		paramList.append(SourceConstants.PARAMETER_SEPARATOR);
+		if (formatType == TraceFormatType.HEADER) {
+			paramList.append(SourceUtils.mapParameterTypeToSymbianType(param));
+			paramList.append(SourceConstants.SPACE_CHAR);
+			paramList.append(SymbianConstants.PARAMETER_DECLARATION_PREFIX);
+			paramList.append(parameterIndex);
+		} else if (formatType == TraceFormatType.NORMAL_TRACE
+				|| formatType == TraceFormatType.COMPLEX_TRACE) {
+			paramList.append(name);
+		} else if (formatType == TraceFormatType.EMPTY_MACRO) {
+			paramList.append(SymbianConstants.PARAMETER_DECLARATION_PREFIX);
+			paramList.append(parameterIndex);
+		}
+	}
+
+	/**
+	 * Replaces data from the stringbuffer
+	 * 
+	 * @param data
+	 *            the data
+	 * @param replaceData
+	 *            the data to be used
+	 * @param replaceFormat
+	 *            the format to be replaced
+	 */
+	private static void replaceData(StringBuffer data, String replaceData,
+			String replaceFormat) {
+		int replaceOffset = 0;
+		do {
+			replaceOffset = data.indexOf(replaceFormat, replaceOffset);
+			if (replaceOffset >= 0) {
+				data.replace(replaceOffset, replaceOffset
+						+ replaceFormat.length(), replaceData);
+				replaceOffset += replaceData.length();
+			}
+		} while (replaceOffset != -1);
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/source/SourceListener.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,86 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 that is notified about changes in source documents
+*
+*/
+package com.nokia.tracebuilder.engine.source;
+
+import com.nokia.tracebuilder.engine.TraceLocation;
+
+/**
+ * Interface that is notified about changes in source documents managed by
+ * {@link SourceEngine}
+ * 
+ */
+public interface SourceListener {
+
+	/**
+	 * Called when caret position in source is moved on top of a trace in source
+	 * file
+	 * 
+	 * @param location
+	 *            the trace location
+	 */
+	public void selectionChanged(TraceLocation location);
+
+	/**
+	 * Event that is fired when a source is opened
+	 * 
+	 * @param properties
+	 *            the source properties
+	 */
+	public void sourceOpened(SourceProperties properties);
+
+	/**
+	 * Event that is fired when a source is changed
+	 * 
+	 * @param properties
+	 *            the new properties of the source
+	 */
+	public void sourceChanged(SourceProperties properties);
+
+	/**
+	 * Event that is fired when a source is closed
+	 * 
+	 * @param source
+	 *            the source that was closed
+	 */
+	public void sourceClosed(SourceProperties source);
+
+	/**
+	 * Operation which affects multiple source locations was started
+	 * 
+	 * @param source
+	 *            the source
+	 */
+	public void sourceProcessingStarted(SourceProperties source);
+
+	/**
+	 * Operation which affects multiple source locations was completed
+	 * 
+	 * @param source
+	 *            the source
+	 */
+	public void sourceProcessingComplete(SourceProperties source);
+
+	/**
+	 * Notification that source has been saved
+	 * 
+	 * @param properties
+	 *            the source
+	 */
+	public void sourceSaved(SourceProperties properties);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/source/SourceLocationRule.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Rules for mapping trace model entries into source code
+*
+*/
+package com.nokia.tracebuilder.engine.source;
+
+import com.nokia.tracebuilder.model.TraceObjectRule;
+
+/**
+ * Rules for relocating traces in source code
+ * 
+ */
+public interface SourceLocationRule extends TraceObjectRule {
+
+	/**
+	 * Rule type for context-relative location
+	 */
+	int CONTEXT_RELATIVE = 1;
+
+	/**
+	 * Rule type for absolute location
+	 */
+	int ABSOLUTE = 2;
+
+	/**
+	 * Gets the rule type
+	 * 
+	 * @return rule type
+	 */
+	public int getLocationType();
+
+	/**
+	 * Gets the offset where the trace is inserted
+	 * 
+	 * @return the offset
+	 */
+	public int getLocationOffset();
+
+	/**
+	 * Flag which determines whether this locator should be removed from the
+	 * trace after the trace has been inserted to source. If this is left to the
+	 * trace, the trace is relocated every time it is inserted.
+	 * <p>
+	 * Note that if this returns false, the extension should also be persistent
+	 * so that the relocations work over TraceBuilder restarts.
+	 * 
+	 * @return true if this should be removed after insertion
+	 */
+	public boolean isRemovedAfterInsert();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/source/SourceParserResult.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Result from parameter parsing
+*
+*/
+package com.nokia.tracebuilder.engine.source;
+
+import java.util.List;
+
+/**
+ * Result from parameter parsing
+ * 
+ */
+public class SourceParserResult {
+
+	/**
+	 * Trace name as parsed from source
+	 */
+	public String originalName;
+
+	/**
+	 * Parsed name after conversion to valid name
+	 */
+	public String convertedName;
+
+	/**
+	 * Trace text as parsed from source
+	 */
+	public String traceText;
+
+	/**
+	 * Parameters parsed from source
+	 */
+	public List<String> parameters;
+
+	/**
+	 * List of parser-specific data
+	 */
+	public List<String> parserData;
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/source/SourceParserRule.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,133 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Rule interface for tags to be searched from source files
+*
+*/
+package com.nokia.tracebuilder.engine.source;
+
+import java.util.List;
+
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceModelExtension;
+import com.nokia.tracebuilder.model.TraceObjectRule;
+import com.nokia.tracebuilder.project.TraceLocationParser;
+
+/**
+ * Rule interface for tags to be searched from source files
+ * 
+ */
+public interface SourceParserRule extends TraceObjectRule {
+
+	/**
+	 * Parameter conversion result
+	 * 
+	 */
+	public class ParameterConversionResult {
+
+		/**
+		 * Parameter name
+		 */
+		public String name;
+
+		/**
+		 * Parameter type
+		 */
+		public String type;
+
+		/**
+		 * Parameter extensions
+		 */
+		public List<TraceModelExtension> extensions;
+	}
+
+	/**
+	 * Trace location conversion result
+	 * 
+	 */
+	public class TraceConversionResult {
+
+		/**
+		 * Name of the group where the trace goes to
+		 */
+		public String group;
+
+		/**
+		 * Name for the trace
+		 */
+		public String name;
+
+		/**
+		 * Text for the trace
+		 */
+		public String text;
+
+		/**
+		 * List of parameters
+		 */
+		public List<ParameterConversionResult> parameters;
+
+		/**
+		 * Extensions for the trace
+		 */
+		public List<TraceModelExtension> extensions;
+
+	}
+
+	/**
+	 * Gets the name of this parser
+	 * 
+	 * @return the name
+	 */
+	public String getName();
+
+	/**
+	 * Gets the source tag to be located from source
+	 * 
+	 * @return the tag name
+	 */
+	public String getSearchTag();
+
+	/**
+	 * Checks if the trace tag suffix is allowed
+	 * 
+	 * @param tagSuffix
+	 *            the tag to be checked
+	 * @return true if allowed, false if not
+	 */
+	public boolean isAllowedTagSuffix(String tagSuffix);
+
+	/**
+	 * Parses a parameter list found from source
+	 * 
+	 * @param tag
+	 *            the location tag
+	 * @param list
+	 *            list of parameters
+	 * @return the parameter list
+	 * @throws TraceBuilderException
+	 *             if parameter list is not valid
+	 */
+	public SourceParserResult parseParameters(String tag, List<String> list)
+			throws TraceBuilderException;
+
+	/**
+	 * Gets the location parser interface
+	 * 
+	 * @return the location parser
+	 */
+	public TraceLocationParser getLocationParser();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/source/SourceProperties.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,1000 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Properties of a source document opened to Eclipse editor
+*
+*/
+package com.nokia.tracebuilder.engine.source;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.ConcurrentModificationException;
+import java.util.Iterator;
+
+import com.nokia.tracebuilder.engine.TraceBuilderConfiguration;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceLocation;
+import com.nokia.tracebuilder.engine.TraceLocationProperties;
+import com.nokia.tracebuilder.engine.rules.ComplexHeaderRule;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceModel;
+import com.nokia.tracebuilder.plugin.TraceAPIFormatter.TraceFormatType;
+import com.nokia.tracebuilder.source.PositionArrayComparator;
+import com.nokia.tracebuilder.source.SourceConstants;
+import com.nokia.tracebuilder.source.SourceDocumentFactory;
+import com.nokia.tracebuilder.source.SourceDocumentInterface;
+import com.nokia.tracebuilder.source.SourceEditor;
+import com.nokia.tracebuilder.source.SourceIterator;
+import com.nokia.tracebuilder.source.SourceLocationBase;
+import com.nokia.tracebuilder.source.SourceParser;
+import com.nokia.tracebuilder.source.SourceParserException;
+import com.nokia.tracebuilder.source.SourcePropertyProvider;
+import com.nokia.tracebuilder.source.SourceSelector;
+import com.nokia.tracebuilder.source.SourceStringSearch;
+
+/**
+ * Properties of a source document which contains trace locations
+ * 
+ */
+public class SourceProperties implements Iterable<TraceLocation> {
+
+	/**
+	 * Trace locations within the source
+	 */
+	private ArrayList<TraceLocation> locations = new ArrayList<TraceLocation>();
+
+	/**
+	 * Source editor
+	 */
+	private SourceEditor sourceEditor;
+
+	/**
+	 * Comparator for binary searches
+	 */
+	private PositionArrayComparator comparator = new PositionArrayComparator();
+
+	/**
+	 * Offset is stored in preProcess and reset in postProcess.
+	 */
+	private int firstChangedLocation = -1;
+
+	/**
+	 * Offset is stored in preProcess and reset in postProcess.
+	 */
+	private int firstUnchangedLocation = -1;
+
+	/**
+	 * The searchers for trace identifiers
+	 */
+	private ArrayList<SourceStringSearch> searchers = new ArrayList<SourceStringSearch>();
+
+	/**
+	 * Start index for calls to parseTrace
+	 */
+	private int searchStartIndex;
+
+	/**
+	 * Source update operation queue
+	 */
+	private SourceEditorUpdateQueue updateQueue = new SourceEditorUpdateQueue(
+			this);
+
+	/**
+	 * Active source flag
+	 */
+	private boolean isActive;
+
+	/**
+	 * Read-only flag
+	 */
+	private boolean readOnly;
+
+	/**
+	 * Creates source properties for given source document
+	 * 
+	 * @param model
+	 *            the trace model
+	 * @param framework
+	 *            the document framework
+	 * @param document
+	 *            the document
+	 */
+	public SourceProperties(TraceModel model, SourceDocumentFactory framework,
+			SourceDocumentInterface document) {
+		sourceEditor = new SourceEditor(framework, document);
+		Iterator<SourceParserRule> parsers = model
+				.getExtensions(SourceParserRule.class);
+		while (parsers.hasNext()) {
+			// The rule defines what to search and how to interpret the
+			// parameters. It is stored into the searcher as search data
+			addParserRule(parsers.next());
+		}
+	}
+
+	/**
+	 * Gets the source editor
+	 * 
+	 * @return the editor
+	 */
+	public SourceEditor getSourceEditor() {
+		return sourceEditor;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Iterable#iterator()
+	 */
+	public Iterator<TraceLocation> iterator() {
+		return locations.iterator();
+	}
+
+	/**
+	 * Gets the file name of this source
+	 * 
+	 * @return the name
+	 */
+	public String getFileName() {
+		String retval = null;
+		if (sourceEditor != null) {
+			SourceDocumentInterface source = sourceEditor.getSource();
+			if (source != null) {
+				SourcePropertyProvider provider = source.getPropertyProvider();
+				if (provider != null) {
+					retval = provider.getFileName();
+				}
+			}
+		}
+		return retval;
+	}
+
+	/**
+	 * Gets the file path of this source
+	 * 
+	 * @return the name
+	 */
+	public String getFilePath() {
+		String retval = null;
+		if (sourceEditor != null) {
+			SourceDocumentInterface source = sourceEditor.getSource();
+			if (source != null) {
+				SourcePropertyProvider provider = source.getPropertyProvider();
+				if (provider != null) {
+					retval = provider.getFilePath();
+				}
+			}
+		}
+		return retval;
+	}
+
+	/**
+	 * Finds a location based on document offset
+	 * 
+	 * @param offset
+	 *            the offset to the location
+	 * @return the location of null if the offset does not point to a location
+	 */
+	public TraceLocation getLocation(int offset) {
+		TraceLocation location = null;
+		// If firstChangedLocation is set, this source is being processed
+		// and binarySearch will not work. In that case, this function
+		// must return null
+		if (firstChangedLocation < 0) {
+			SourceLocationBase base = sourceEditor.createHiddenLocation(offset,
+					0);
+			int index = Collections.binarySearch(locations, base, comparator);
+			sourceEditor.removeHiddenLocation(base);
+			if (index >= 0 && index < locations.size()) {
+				location = locations.get(index);
+			}
+		}
+		return location;
+	}
+
+	/**
+	 * Returns the location count of this source
+	 * 
+	 * @return the count
+	 */
+	public int getLocationCount() {
+		return locations.size();
+	}
+
+	/**
+	 * Gets the offset to the first changed location. Only valid during
+	 * sourceUpdated callback
+	 * 
+	 * @return the offset
+	 */
+	public int getFirstChangedLocationOffset() {
+		return firstChangedLocation;
+	}
+
+	/**
+	 * Sets the read-only flag for this source. Traces cannot be added to
+	 * read-only sources, but they can be parsed for data
+	 * 
+	 * @param readOnly
+	 *            the read-only flag
+	 */
+	void setReadOnly(boolean readOnly) {
+		this.readOnly = readOnly;
+	}
+
+	/**
+	 * Gets the read-only flag
+	 * 
+	 * @return read-only flag
+	 */
+	public boolean isReadOnly() {
+		return readOnly;
+	}
+
+	/**
+	 * Source opened notification
+	 */
+	void sourceOpened() {
+		updateTraces(0, sourceEditor.getDataLength());
+		isActive = true;
+	}
+
+	/**
+	 * Source closed notification
+	 */
+	void sourceClosed() {
+		if (sourceEditor != null) {
+			sourceEditor.reset();
+			sourceEditor = null;
+		}
+		updateQueue.resetUpdateQueue();
+	}
+
+	/**
+	 * Called when the source document is about to change.
+	 * 
+	 * @param offset
+	 *            the offset of the change
+	 * @param length
+	 *            the number of bytes that were removed
+	 * @param newText
+	 *            text that is going to be inserted into the document
+	 * @throws SourceParserException
+	 *             if offset / length are not valid
+	 */
+	void prepareChange(int offset, int length, String newText)
+			throws SourceParserException {
+		sourceEditor.prepareUpdateSource(offset, length, newText);
+	}
+
+	/**
+	 * Called before SourceListeners when source changes. Updates locations that
+	 * have changed content and locates possible new traces from the inserted
+	 * text.
+	 * 
+	 * @param offset
+	 *            the offset of the change
+	 * @param length
+	 *            the number of bytes that were removed
+	 * @param newText
+	 *            text that was added to the document
+	 * @throws SourceParserException
+	 *             if offset / length are not valid
+	 */
+	void preProcessChange(int offset, int length, String newText)
+			throws SourceParserException {
+		preProcessInit();
+		// Refreshes the source editor. The editor returns the last offset that
+		// could possibly be affected by the change
+		int areaOfEffectEnd = sourceEditor.sourceUpdated(offset, length,
+				newText);
+
+		findFirstChangedLocation(offset);
+		processChangedLocations(offset);
+		int start = findTraceUpdateStartIndex(offset);
+		int end = findTraceUpdateEndIndex(areaOfEffectEnd);
+		if (end > start) {
+			updateTraces(start, end);
+		}
+	}
+
+	/**
+	 * Initializes the variables for preProcess
+	 * 
+	 * @throws ConcurrentModificationException
+	 *             if change is not allowed
+	 */
+	private void preProcessInit() throws ConcurrentModificationException {
+		// Concurrent modifications during preProcessChange / postProcessChange
+		// cycle are not allowed
+		if (firstChangedLocation >= 0) {
+			throw new ConcurrentModificationException();
+		}
+		firstChangedLocation = 0;
+	}
+
+	/**
+	 * Finds the first location that has changed
+	 * 
+	 * @param offset
+	 *            the start offset
+	 */
+	private void findFirstChangedLocation(int offset) {
+		// BinarySearch cannot be used here, since at this point the array
+		// contains the deleted items, which have invalid offsets
+		Iterator<TraceLocation> itr = locations.iterator();
+		boolean firstFound = false;
+		while (itr.hasNext() && !firstFound) {
+			TraceLocation loc = itr.next();
+			// When a change occurs, the location can be:
+			// - Deleted by complete removal
+			// - Changed by modifying the contents of the location
+			// - Changed by modifying the character before the location
+			// - Changed by starting a comment which encloses the location
+			if (loc.isDeleted() || loc.isContentChanged()
+					|| offset == loc.getOffset() - 1
+					|| sourceEditor.isInExcludedArea(loc.getOffset())) {
+				firstFound = true;
+			} else {
+				firstChangedLocation++;
+			}
+		}
+	}
+
+	/**
+	 * Processes the changed locations
+	 * 
+	 * @param offset
+	 *            the start offset
+	 */
+	private void processChangedLocations(int offset) {
+		// After the first changed entry has been found, the locations after
+		// that are processed. If a location has been moved to excluded source
+		// code areas, it is marked for deletion. If the content of a location
+		// has been changed, the new contents are verified and if they are not
+		// valid, the location is marked for deletion. When the first unchanged
+		// trace is found, all changes have been processed and this loop is
+		// terminated.
+		firstUnchangedLocation = locations.size();
+		int index = firstChangedLocation;
+		while (index < locations.size()) {
+			TraceLocation location = locations.get(index);
+			if (!location.isDeleted()) {
+				if (sourceEditor.isInExcludedArea(location.getOffset())) {
+					location.delete();
+				} else if (location.isContentChanged()
+						|| offset == location.getOffset() - 1) {
+					processChangedLocation(location);
+				} else {
+					firstUnchangedLocation = index;
+					index = locations.size();
+				}
+			}
+			index++;
+		}
+	}
+
+	/**
+	 * Finds the offset where trace updates should start
+	 * 
+	 * @param offset
+	 *            the change offset
+	 * @return the trace update offset
+	 */
+	private int findTraceUpdateStartIndex(int offset) {
+		// After the existing traces have been processed and marked for removal,
+		// the first ';' character preceeding the changed area is located from
+		// the source. The source file is reparsed starting from that point up
+		// to the next unchanged trace location. All new traces found from that
+		// area are added to the trace location list.
+		int start = findSemicolonOrBracket(offset, SourceParser.BACKWARD_SEARCH);
+		if (start == -1) {
+			start = 0;
+		}
+		return start;
+	}
+
+	/**
+	 * Finds the offset where trace updates should end
+	 * 
+	 * @param endOffset
+	 *            the end of change offset
+	 * @return the trace update end offset
+	 */
+	private int findTraceUpdateEndIndex(int endOffset) {
+		// The offset to the first unchanged location is fetched from
+		// the array. The contents of the source file between the change
+		// offset and the offset of the first unchanged trace is
+		// processed. If none of the traces changed, the area of effect
+		// determined by the source parser is used
+		int end;
+		if (firstUnchangedLocation < locations.size()) {
+			TraceLocation loc = locations.get(firstUnchangedLocation);
+			end = loc.getOffset();
+		} else {
+			end = findSemicolonOrBracket(endOffset, 0);
+			if (end == -1) {
+				end = sourceEditor.getDataLength();
+			}
+		}
+		return end;
+	}
+
+	/**
+	 * Called after listeners when source changes. Removes obsolete locations
+	 * and resets change flags
+	 */
+	void postProcessChange() {
+		int index = firstChangedLocation;
+		// The location list might have been reset while processing if there was
+		// an critical assertion
+		if (locations != null && locations.size() >= firstUnchangedLocation) {
+			// This loops through all changed locations. Deleted locations are
+			// removed and the flags are reset
+			while (index < firstUnchangedLocation) {
+				TraceLocation location = locations.get(index);
+				if (location.isDeleted()) {
+					// Removes from parser and document
+					location.dereference();
+					locations.remove(index);
+					index--;
+					firstUnchangedLocation--;
+				} else {
+					location.setContentChanged(false);
+				}
+				index++;
+			}
+			firstChangedLocation = -1;
+			firstUnchangedLocation = -1;
+			// When all processing has been done, the location updates of
+			// SourceLocation objects from the editor are sent to editor
+			// listeners
+			sourceEditor.notifyLocationUpdates();
+		} else {
+			firstChangedLocation = -1;
+			firstUnchangedLocation = -1;
+		}
+	}
+
+	/**
+	 * Pre-processes a full source sync
+	 * 
+	 * @param offset
+	 *            the offset of removed data
+	 * @param length
+	 *            the length of removed data
+	 * @param newText
+	 *            the new text
+	 * @throws SourceParserException
+	 *             if location is not valid
+	 */
+	void preProcessFullSync(int offset, int length, String newText)
+			throws SourceParserException {
+		preProcessInit();
+		firstUnchangedLocation = locations.size();
+		sourceEditor.prepareFullSync();
+		sourceEditor.sourceUpdated(offset, length, newText);
+		int index = 0;
+		// All locations except deleted ones are processed as changed when
+		// doing a full sync
+		while (index < locations.size()) {
+			TraceLocation location = locations.get(index);
+			if (!location.isDeleted()) {
+				if (sourceEditor.isInExcludedArea(location.getOffset())) {
+					location.delete();
+				} else {
+					processChangedLocation(location);
+				}
+			}
+			index++;
+		}
+		updateTraces(0, sourceEditor.getDataLength());
+	}
+
+	/**
+	 * Called after SourceListener.sourceProcessingComplete. Removes obsolete
+	 * locations and resets change flags
+	 */
+	void postProcessFullSync() {
+		postProcessChange();
+	}
+
+	/**
+	 * Searches the next semicolon or bracket from given index
+	 * 
+	 * @param offset
+	 *            the offset where to start
+	 * @param searchFlags
+	 *            search flags in addition to SKIP_ALL
+	 * @return the offset to semicolon or -1 if not found
+	 */
+	private int findSemicolonOrBracket(int offset, int searchFlags) {
+		SourceIterator srcitr = sourceEditor.createIterator(
+				offset > 0 ? offset - 1 : offset, searchFlags
+						| SourceParser.SKIP_ALL);
+		char c;
+		boolean found = false;
+		try {
+			while (!found && srcitr.hasNext()) {
+				c = srcitr.next();
+				if (c == ';' || c == '}' || c == '{') {
+					found = true;
+				}
+			}
+		} catch (Exception e) {
+		}
+		int retval = -1;
+		if (found) {
+			retval = srcitr.currentIndex();
+		}
+		return retval;
+	}
+
+	/**
+	 * Parses the document starting from given offset and locates the trace
+	 * entries from it. The first unchanged trace entry stops the search
+	 * 
+	 * @param startOffset
+	 *            the offset where to start the search
+	 * @param endOffset
+	 *            the offset where to end the search
+	 */
+	public void updateTraces(int startOffset, int endOffset) {
+		Iterator<SourceStringSearch> itr = searchers.iterator();
+		while (itr.hasNext()) {
+			SourceStringSearch searcher = itr.next();
+			searcher.resetSearch(startOffset, endOffset);
+			updateTraces(endOffset, searcher);
+		}
+	}
+
+	/**
+	 * Uses the given SourceSearch to parse traces
+	 * 
+	 * @param end
+	 *            the offset where parser should stop
+	 * @param searcher
+	 *            the searcher
+	 */
+	private void updateTraces(int end, SourceStringSearch searcher) {
+		int offset;
+		searchStartIndex = 0;
+		// If not updating, the entries contents are processed
+		do {
+			offset = searcher.findNext();
+			try {
+				if (offset != -1 && offset < end) {
+					String tag = isValidTrace(offset, searcher
+							.getSearchString().length(), searcher, false);
+					if (tag != null) {
+						parseTrace(offset, (SourceParserRule) searcher
+								.getSearchData(), tag);
+					}
+				}
+			} catch (Exception e) {
+				// If the parameters cannot be parsed, the trace is
+				// not added to the array
+			}
+		} while (offset != -1 && offset < end);
+	}
+
+	/**
+	 * Parses a trace found from the document and adds it to the document's list
+	 * of positions. The position updater keeps the trace location up-to-date.
+	 * 
+	 * @param offset
+	 *            the offset to the trace
+	 * @param parserRule
+	 *            the parser to be attached to the location
+	 * @param locationTag
+	 *            the tag of the location
+	 * @throws SourceParserException
+	 *             if trace cannot be parsed
+	 */
+	private void parseTrace(int offset, SourceParserRule parserRule,
+			String locationTag) throws SourceParserException {
+		int arrayIndex = -1;
+		// Checks the changed locations. If a matching offset if found, the
+		// location is an existing one. In that case the location is not
+		// added to the array. If an offset larger than the new offset is
+		// found from the array, the location is inserted into that slot. If
+		// all locations within the array are smaller than the new offset,
+		// the new location is inserted before the first unchanged location.
+		// Since the locations in the array are ordered, the checking can
+		// always start from the latest location that has been found from
+		// the array. The caller of this function must set
+		// parseTraceStartIndex to 0 before starting a loop where this
+		// function is called. If firstUnchangedLocation is -1, this is the
+		// first time the file is being parsed and thus all locations are
+		// checked
+		boolean found = false;
+		int searchEndIndex;
+		int newSearchStartIndex = -1;
+		if (firstUnchangedLocation >= 0) {
+			searchEndIndex = firstUnchangedLocation;
+		} else {
+			searchEndIndex = locations.size();
+		}
+		for (int i = searchStartIndex; i < searchEndIndex && !found; i++) {
+			TraceLocation location = locations.get(i);
+			// Deleted locations are ignored. If a trace was replaced, the
+			// new offset will match the offset of the deleted one.
+			if (!location.isDeleted()) {
+				// If the offset of the trace matches an existing offset,
+				// the trace is old one. If the offset within the array is
+				// larger than the source offset, the trace found from
+				// source is new.
+				if (location.getOffset() == offset) {
+					found = true;
+					// Starts the next search from the value following the
+					// trace that was found
+					searchStartIndex = i + 1;
+					arrayIndex = -1;
+				} else if (location.getOffset() > offset) {
+					found = true;
+					// A new trace will be added into the current index, so
+					// the next search will start from the same location as
+					// was checked now. The index is updated after the trace has
+					// succesfully been created
+					newSearchStartIndex = i + 1;
+					arrayIndex = i;
+				}
+			}
+		}
+		// If trace was not found from the list, the trace is new and all
+		// traces following it are also new. The start index is set to point
+		// past the first unchanged location and thus the next search will
+		// ignore the above loop.
+		if (!found) {
+			arrayIndex = searchEndIndex;
+			searchStartIndex = firstUnchangedLocation + 1;
+		}
+		if (arrayIndex >= 0) {
+			// Creates a new location if it was not found
+			ArrayList<String> list = new ArrayList<String>();
+			int endOfTrace = sourceEditor
+					.tokenizeParameters(offset, list, true);
+			TraceLocation location = new TraceLocation(this, offset, endOfTrace
+					- offset);
+			// The parser rules have been associated with the searchers. The
+			// parser rule that found the location is associated with the
+			// location and used to process its parameters
+			location.setTag(locationTag);
+			location.setParserRule(parserRule);
+			location.setData(list);
+			locations.add(arrayIndex, location);
+			// The changed flag is set to newly added traces. If a location
+			// is added prior to the first changed location, the index of first
+			// changed location needs to be adjusted so that the flag gets
+			// cleared in postprocessing. Also the index of first unchanged
+			// location needs to be updated to reflect the changed array
+			if (firstUnchangedLocation >= 0) {
+				location.setContentChanged(true);
+				if (arrayIndex < firstChangedLocation) {
+					firstChangedLocation = arrayIndex;
+				}
+				firstUnchangedLocation++;
+			}
+			// Updates the search start index if trace creation was succesful
+			if (newSearchStartIndex >= 0) {
+				searchStartIndex = newSearchStartIndex;
+			}
+		}
+	}
+
+	/**
+	 * Processes the contents of a changed location
+	 * 
+	 * @param location
+	 *            the location that was changed
+	 */
+	private void processChangedLocation(TraceLocation location) {
+		// If the trace still contains the trace identifier, the parameters are
+		// parsed. If not, the trace is deleted
+		Iterator<SourceStringSearch> itr = searchers.iterator();
+		String traceID = null;
+		while (itr.hasNext() && traceID == null) {
+			SourceStringSearch searcher = itr.next();
+			traceID = isValidTrace(location.getOffset(), location.getLength(),
+					searcher, true);
+		}
+		if (traceID != null) {
+			ArrayList<String> list = new ArrayList<String>();
+			try {
+				int offset = location.getOffset() + traceID.length();
+				int endOfTrace = sourceEditor.tokenizeParameters(offset, list,
+						true);
+				location.setTag(traceID);
+				location.setLength(endOfTrace - location.getOffset());
+				location.setData(list);
+			} catch (SourceParserException e) {
+				location.delete();
+			}
+		} else {
+			location.delete();
+		}
+	}
+
+	/**
+	 * Checks that a trace is valid
+	 * 
+	 * @param offset
+	 *            offset to trace identifier
+	 * @param length
+	 *            length of trace
+	 * @param searcher
+	 *            the source searcher
+	 * @param checkMainTag
+	 *            true if the main search tag needs to be checked, false if only
+	 *            the tag suffix is checked
+	 * @return the trace tag or null if trace is not valid
+	 */
+	private String isValidTrace(int offset, int length,
+			SourceStringSearch searcher, boolean checkMainTag) {
+		String retval = null;
+		try {
+			int idlen = searcher.getSearchString().length();
+			int idend = offset + idlen;
+			if (checkMainTag) {
+				if (length >= idlen
+						&& searcher.isSearchStringMatch(sourceEditor.getData(
+								offset, idlen))) {
+					// The previous character must be a separator or white space
+					if (offset == 0
+							|| !Character.isJavaIdentifierPart(sourceEditor
+									.getData(offset - 1))) {
+						retval = getSearchTag(offset, idend);
+					}
+				}
+			} else {
+				// If main tag is not checked
+				retval = getSearchTag(offset, idend);
+			}
+			retval = verifyTag(searcher, retval, idlen);
+		} catch (Exception e) {
+			if (TraceBuilderConfiguration.ASSERTIONS_ENABLED) {
+				TraceBuilderGlobals.getEvents().postAssertionFailed(
+						"Trace validity check failed", e); //$NON-NLS-1$
+			}
+		}
+		return retval;
+	}
+
+	/**
+	 * Verifies the tag against tag suffixes from parser
+	 * 
+	 * @param searcher
+	 *            the searcher
+	 * @param tag
+	 *            the tag include main tag and suffix
+	 * @param idlen
+	 *            the length of the main tag
+	 * @return the tag if it is valid, null if not
+	 */
+	private String verifyTag(SourceStringSearch searcher, String tag, int idlen) {
+		if (tag != null) {
+			// The trace suffix is verified by the parser. For example, if
+			// search data is "SymbianTrace" and the tag found from source
+			// is "SymbianTraceData1", the parser checks if "Data1" is a
+			// valid trace tag suffix.
+			if (!((SourceParserRule) searcher.getSearchData())
+					.isAllowedTagSuffix(tag.substring(idlen))) {
+				tag = null;
+			}
+		}
+		return tag;
+	}
+
+	/**
+	 * Gets the search tag between offset and next '(' character
+	 * 
+	 * @param offset
+	 *            the start of tag
+	 * @param idend
+	 *            the end of tag
+	 * @return the tag
+	 * @throws SourceParserException
+	 *             if parser fails
+	 */
+	private String getSearchTag(int offset, int idend)
+			throws SourceParserException {
+		// Locates the parameters starting from trace identifier
+		String retval = null;
+		SourceIterator srcitr = sourceEditor.createIterator(idend - 1,
+				SourceParser.SKIP_ALL);
+		boolean found = false;
+		while (srcitr.hasNext() && !found) {
+			char c = srcitr.next();
+			if (c == ';') {
+				// Trace must have parameters
+				found = true;
+			} else if (c == '(') {
+				found = true;
+				// Stores the tag into location
+				retval = sourceEditor.getData(offset, srcitr.previousIndex()
+						- offset + 1);
+			} else if (srcitr.hasSkipped()) {
+				// White spaces are not allowed within trace tag
+				found = true;
+			}
+		}
+		return retval;
+	}
+
+	/**
+	 * Checks if a trace can be inserted into given location
+	 * 
+	 * @param offset
+	 *            the offset to the location
+	 * @return true if location is valid
+	 */
+	boolean checkInsertLocation(int offset) {
+		boolean retval = true;
+		try {
+			offset = sourceEditor.findStartOfLine(offset, false, true);
+			if (sourceEditor.isInExcludedArea(offset)) {
+				retval = false;
+			}
+		} catch (SourceParserException e) {
+			retval = false;
+		}
+		return retval;
+	}
+
+	/**
+	 * Creates a trace string
+	 * 
+	 * @param trace
+	 *            the trace
+	 * @param offset
+	 *            the offset where to insert the trace
+	 * @param replacedLocation
+	 *            the existing location to be replaced
+	 * @param locationProperties
+	 *            properties to be used
+	 * @throws SourceParserException
+	 *             if source parser fails
+	 */
+	void internalInsertTrace(Trace trace, int offset,
+			TraceLocation replacedLocation,
+			TraceLocationProperties locationProperties)
+			throws SourceParserException {
+		String indent = sourceEditor.getIndent(offset);
+		TraceFormattingRule formatRule = null;
+		if (locationProperties != null) {
+			formatRule = locationProperties.getFormatRule();
+		}
+		Iterator<String> tags;
+		boolean fixedTags;
+		if (replacedLocation != null) {
+			// If replacing a location, the tags should not change
+			// -> FixedTags is set to true
+			tags = replacedLocation.getParameters();
+			fixedTags = true;
+		} else if (locationProperties != null) {
+			// If new location with explicit tags, the tags are processed
+			// -> FixedTags is set to false
+			tags = locationProperties.getParameterTags();
+			fixedTags = false;
+		} else {
+			// If no explicit tags, the fixedTags flag has no effect
+			tags = null;
+			fixedTags = false;
+		}
+		// Formatter creates the correct trace entry
+		StringBuffer sb = new StringBuffer();
+		sb.append(indent);
+		sb.append(SourceFormatter.formatTrace(trace, formatRule,
+				getFormatType(trace), tags, fixedTags));
+		// Adds indent to line feeds. Last line feed is ignored
+		int index = sb.length() - SourceConstants.LINE_FEED.length() - 1;
+		do {
+			index = sb.lastIndexOf(SourceConstants.LINE_FEED, index);
+			if (index >= 0) {
+				sb.insert(index + SourceConstants.LINE_FEED.length(), indent);
+				index--;
+			}
+		} while (index >= 0);
+		sourceEditor.updateSource(offset, 0, sb.toString());
+		if (isActive) {
+			SourceDocumentInterface owner = sourceEditor.getSource();
+			if (owner != null) {
+				SourceSelector selector = owner.getSourceSelector();
+				if (selector != null) {
+					selector.setSelection(offset + sb.length()
+							+ indent.length(), 0);
+				}
+			}
+		}
+	}
+
+	/**
+	 * Gets the format type to be used for the trace
+	 * 
+	 * @param trace
+	 *            the trace
+	 * @return the format type
+	 */
+	private TraceFormatType getFormatType(Trace trace) {
+		ComplexHeaderRule rule = trace.getExtension(ComplexHeaderRule.class);
+		TraceFormatType type;
+		if (rule != null) {
+			type = TraceFormatType.COMPLEX_TRACE;
+		} else {
+			type = TraceFormatType.NORMAL_TRACE;
+		}
+		return type;
+	}
+
+	/**
+	 * Adds a new parser
+	 * 
+	 * @param rule
+	 *            the new parser rule
+	 */
+	void addParserRule(SourceParserRule rule) {
+		SourceStringSearch searcher = sourceEditor.startStringSearch(rule
+				.getSearchTag(), 0, -1, SourceParser.MATCH_WORD_BEGINNING
+				| SourceParser.SKIP_ALL);
+		searcher.setSearchData(rule);
+		searchers.add(searcher);
+	}
+
+	/**
+	 * Removes a parser
+	 * 
+	 * @param rule
+	 *            the parser to be removed
+	 */
+	void removeParserRule(SourceParserRule rule) {
+		Iterator<SourceStringSearch> itr = searchers.iterator();
+		boolean found = false;
+		while (itr.hasNext() && !found) {
+			SourceStringSearch search = itr.next();
+			if (search.getSearchString().equals(rule.getSearchTag())) {
+				itr.remove();
+				found = true;
+			}
+		}
+	}
+
+	/**
+	 * Flag set by SourceEngine, which controls the parsing of this source
+	 * 
+	 * @return the active flag
+	 */
+	boolean isActive() {
+		return isActive;
+	}
+
+	/**
+	 * Sets the flag which controls source parsing
+	 * 
+	 * @param active
+	 *            the active flag
+	 */
+	void setActive(boolean active) {
+		isActive = active;
+	}
+
+	/**
+	 * Gets the update queue
+	 * 
+	 * @return the update queue
+	 */
+	SourceEditorUpdateQueue getUpdateQueue() {
+		return updateQueue;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/source/TraceFormattingRule.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,75 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Formatting rules are provided by Trace objects
+*
+*/
+package com.nokia.tracebuilder.engine.source;
+
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceObjectRule;
+import com.nokia.tracebuilder.model.TraceParameter;
+import com.nokia.tracebuilder.plugin.TraceAPIFormatter.TraceFormatType;
+
+/**
+ * Formatting rules are stored into traces as extension. When inserting a trace
+ * to source the formatting rules are used to convert the trace into source file
+ * representation.
+ * 
+ */
+public interface TraceFormattingRule extends TraceObjectRule {
+
+	/**
+	 * Gets the format for given trace
+	 * 
+	 * @param trace
+	 *            the trace
+	 * @param formatType
+	 *            the type of the format requested
+	 * @return the format
+	 */
+	public String getFormat(Trace trace, TraceFormatType formatType);
+
+	/**
+	 * Maps the trace name to name shown in source
+	 * 
+	 * @param trace
+	 *            the trace to be mapped
+	 * @return the name shown in source
+	 */
+	public String mapNameToSource(Trace trace);
+
+	/**
+	 * Maps the parameter count to source.
+	 * 
+	 * @param trace
+	 *            the trace
+	 * @param count
+	 *            the parameter count
+	 * @return mapped parameter count
+	 */
+	public String mapParameterCountToSource(Trace trace, int count);
+
+	/**
+	 * Removes parameter text from trace text
+	 * 
+	 * @param parameter
+	 *            the parameter 
+	 * @param index
+	 *            index of the parameter 
+	 */
+	public void parameterAboutToBeRemoved(TraceParameter parameter, int index);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/source/TraceLocationCreator.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,171 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* SourceEditorUpdater instance to add a new trace location
+*
+*/
+package com.nokia.tracebuilder.engine.source;
+
+import com.nokia.tracebuilder.engine.TraceLocationProperties;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.source.SourceContext;
+import com.nokia.tracebuilder.source.SourceLocationBase;
+import com.nokia.tracebuilder.source.SourceParser;
+import com.nokia.tracebuilder.source.SourceParserException;
+
+/**
+ * SourceEditorUpdater instance to add a new trace location
+ * 
+ */
+class TraceLocationCreator extends SourceEditorUpdater {
+
+	/**
+	 * Trace to be added to source
+	 */
+	private Trace trace;
+
+	/**
+	 * Offset where trace is added
+	 */
+	private SourceLocationBase location;
+
+	/**
+	 * Trace location properties
+	 */
+	private TraceLocationProperties locationProperties;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param properties
+	 *            the source to be updated
+	 * @param trace
+	 *            the trace to be added to source
+	 * @param offset
+	 *            the offset where trace is added
+	 * @param locationProperties
+	 *            optional properties for the new location
+	 * @throws SourceParserException
+	 *             if source parser fails
+	 */
+	TraceLocationCreator(SourceProperties properties, Trace trace, int offset,
+			TraceLocationProperties locationProperties)
+			throws SourceParserException {
+		super(properties);
+		this.trace = trace;
+		this.locationProperties = locationProperties;
+		// The location properties may adjust the location where the trace gets
+		// inserted. If the location properties do not contain a location rule,
+		// the trace is queried for it
+		SourceLocationRule locationRule = null;
+		if (locationProperties != null) {
+			locationRule = locationProperties.getLocationRule();
+		}
+		if (locationRule == null) {
+			locationRule = trace.getExtension(SourceLocationRule.class);
+			// The extension is removed from the trace to avoid relocation
+			// problems when inserting the trace to other places
+			if (locationRule != null && locationRule.isRemovedAfterInsert()) {
+				trace.removeExtension(locationRule);
+			}
+		}
+		offset = processLocationRule(locationRule, offset);
+		// Offset is stored into the document
+		// This is needed since the update is run asynchronously and the
+		// document may change before this update has chance to run
+		location = properties.getSourceEditor().createHiddenLocation(offset, 0);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.source.SourceEditorUpdater#runUpdate()
+	 */
+	@Override
+	protected boolean runUpdate() throws SourceParserException {
+		SourceProperties source = getSource();
+		try {
+			source.internalInsertTrace(trace, location.getOffset(), null,
+					locationProperties);
+		} finally {
+			// The location is removed after use
+			source.getSourceEditor().removeHiddenLocation(location);
+		}
+		// Always makes an update
+		return true;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.source.SourceEditorUpdater#getPosition()
+	 */
+	@Override
+	protected SourceLocationBase getPosition() {
+		return location;
+	}
+
+	/**
+	 * Processes the location rule of the trace and adjusts the
+	 * traceInsertLocation if the rule exists
+	 * 
+	 * @param locationRule
+	 *            the location rule of the trace
+	 * @param offset
+	 *            the original offset
+	 * @return the new offset or -1 if not adjusted
+	 * @throws SourceParserException
+	 *             if source parser fails
+	 */
+	private int processLocationRule(SourceLocationRule locationRule, int offset)
+			throws SourceParserException {
+		SourceParser sourceEditor = getSource().getSourceEditor();
+		if (locationRule != null) {
+			int start = 0;
+			int end = sourceEditor.getDataLength();
+			SourceContext context;
+			switch (locationRule.getLocationType()) {
+			case SourceLocationRule.ABSOLUTE:
+				offset = locationRule.getLocationOffset();
+				break;
+			case SourceLocationRule.CONTEXT_RELATIVE:
+				context = sourceEditor.getContext(offset);
+				if (context != null) {
+					offset = locationRule.getLocationOffset()
+							+ context.getOffset();
+					// If location traceInsertLocation is >0, the trace is exit
+					// trace and
+					// this needs to search for return statements
+					if (locationRule.getLocationOffset() > 0) {
+						end = sourceEditor.findReturn(context);
+					} else {
+						end = context.getOffset() + context.getLength();
+					}
+					start = context.getOffset();
+				}
+				break;
+			}
+			if (offset > end) {
+				offset = end;
+			} else if (offset < start) {
+				offset = start;
+			}
+		}
+		// Location is inserted to the beginning of the line
+		// Indent is calculated when the location is inserted
+		return sourceEditor.findStartOfLine(offset, false, true);
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/source/TraceLocationRemover.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,178 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Removes a location from source
+*
+*/
+package com.nokia.tracebuilder.engine.source;
+
+import com.nokia.tracebuilder.engine.TraceLocation;
+import com.nokia.tracebuilder.source.SourceConstants;
+import com.nokia.tracebuilder.source.SourceEditor;
+import com.nokia.tracebuilder.source.SourceExcludedArea;
+import com.nokia.tracebuilder.source.SourceLocationBase;
+import com.nokia.tracebuilder.source.SourceParserException;
+
+/**
+ * Removes a location from source
+ * 
+ */
+class TraceLocationRemover extends SourceEditorUpdater {
+
+	/**
+	 * The trace location to be removed
+	 */
+	TraceLocation location;
+
+	/**
+	 * Creates a new location remover for given location
+	 * 
+	 * @param location
+	 *            the location to be written to source
+	 */
+	TraceLocationRemover(TraceLocation location) {
+		super(location.getSource());
+		this.location = location;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.source.SourceEditorUpdater#runUpdate()
+	 */
+	@Override
+	protected boolean runUpdate() throws SourceParserException {
+		// If the location was already deleted by some other operation while
+		// waiting for this asynchronous operation to run, there is no need to
+		// remove it
+		boolean updated;
+		if (!location.isDeleted()) {
+			removeLocation(location);
+			updated = true;
+		} else {
+			updated = false;
+		}
+		return updated;
+	}
+
+	/**
+	 * Removes a location
+	 * 
+	 * @param location
+	 *            the location to be removed
+	 * @return the offset where the removed location started
+	 * @throws SourceParserException
+	 *             if remove fails
+	 */
+	static int removeLocation(TraceLocation location)
+			throws SourceParserException {
+
+		SourceEditor sourceEditor = location.getSource().getSourceEditor();
+		int start;
+		int end;
+
+		// Old Symbian traces could include comment associated with the location
+		// If it exists, it is also removed
+		String listTitle = location.getLocationList().getListTitle();
+		if (listTitle != null && listTitle.equals("SymbianTrace")) { //$NON-NLS-1$
+			SourceExcludedArea area = TraceLocationWriter
+					.findLocationComment(location);
+			if (area != null) {
+				if (area.getOffset() < location.getOffset()
+						&& area.getType() == SourceExcludedArea.LINE_COMMENT) {
+					start = area.getOffset();
+					end = location.getOffset() + location.getLength();
+				} else if (area.getOffset() > location.getOffset()
+						&& area.getType() == SourceExcludedArea.LINE_COMMENT) {
+					start = location.getOffset();
+					end = area.getOffset() + area.getLength();
+				} else {
+					start = location.getOffset();
+					end = start + location.getLength();
+				}
+			} else {
+				start = location.getOffset();
+				end = start + location.getLength();
+			}
+		} else {
+			start = location.getOffset();
+			end = start + location.getLength();
+		}
+
+		// If there is a line feed after the trace, the line feed is
+		// also removed
+		int lflen = SourceConstants.LINE_FEED.length();
+		if (end <= (sourceEditor.getDataLength() - lflen)) {
+			String data = sourceEditor.getData(end, lflen);
+			if (data.equals(SourceConstants.LINE_FEED)) {
+				end += lflen;
+			}
+		}
+		start = sourceEditor.findStartOfLine(start, true, true);
+		int len = end - start;
+		sourceEditor.updateSource(start, len, ""); //$NON-NLS-1$
+		return start;
+	}
+
+	/**
+	 * Finds the start offset of given location
+	 * 
+	 * @param location
+	 *            the location to be checked
+	 * @return the offset where the location starts
+	 * @throws SourceParserException
+	 *             if operation fails
+	 */
+	static int findStartOffset(TraceLocation location)
+			throws SourceParserException {
+		int start;
+		SourceEditor sourceEditor = location.getSource().getSourceEditor();
+
+		// Old Symbian traces could include comment associated with the location
+		// If it exists before location, it is also included
+		String listTitle = location.getLocationList().getListTitle();
+		if (listTitle != null && listTitle.equals("SymbianTrace")) { //$NON-NLS-1$
+			SourceExcludedArea area = TraceLocationWriter
+					.findLocationComment(location);
+
+			if (area != null) {
+				if (area.getOffset() < location.getOffset()
+						&& area.getType() == SourceExcludedArea.LINE_COMMENT) {
+					start = area.getOffset();
+				} else {
+					start = location.getOffset();
+				}
+			} else {
+				start = location.getOffset();
+			}
+		} else {
+			start = location.getOffset();
+		}
+
+		start = sourceEditor.findStartOfLine(start, true, true);
+		return start;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.source.SourceEditorUpdater#getPosition()
+	 */
+	@Override
+	protected SourceLocationBase getPosition() {
+		return location;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/source/TraceLocationUpdateWriter.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,78 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* SourceEditorUpdater instance to replace an existing trace location
+*
+*/
+package com.nokia.tracebuilder.engine.source;
+
+import com.nokia.tracebuilder.engine.TraceLocation;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.source.SourceLocationBase;
+import com.nokia.tracebuilder.source.SourceParserException;
+
+/**
+ * SourceEditorUpdater instance to replace an existing trace location
+ * 
+ */
+class TraceLocationUpdateWriter extends SourceEditorUpdater {
+
+	/**
+	 * The trace location to be updated
+	 */
+	private TraceLocation location;
+
+	/**
+	 * Creates a new location writer for given location
+	 * 
+	 * @param location
+	 *            the location to be written to source
+	 */
+	TraceLocationUpdateWriter(TraceLocation location) {
+		super(location.getSource());
+		this.location = location;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.source.SourceEditorUpdater#runUpdate()
+	 */
+	@Override
+	protected boolean runUpdate() throws SourceParserException {
+		// If location has been deleted, it cannot be updated
+		boolean updated;
+		if (!location.isDeleted()) {
+			Trace trace = location.getTrace();
+			int start = TraceLocationRemover.removeLocation(location);
+			location.getSource().internalInsertTrace(trace, start, location,
+					location.getProperties());
+			updated = true;
+		} else {
+			updated = false;
+		}
+		return updated;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.source.SourceEditorUpdater#getPosition()
+	 */
+	@Override
+	protected SourceLocationBase getPosition() {
+		return location;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/source/TraceLocationWriter.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,123 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Updates a trace location into source code
+*
+*/
+package com.nokia.tracebuilder.engine.source;
+
+import java.util.Iterator;
+
+import com.nokia.tracebuilder.engine.TraceLocation;
+import com.nokia.tracebuilder.engine.TraceLocationProperties;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.source.SourceExcludedArea;
+import com.nokia.tracebuilder.source.SourceParserException;
+
+/**
+ * Updates trace locations into source code
+ * 
+ */
+class TraceLocationWriter {
+
+	/**
+	 * Prevents construction
+	 */
+	private TraceLocationWriter() {
+	}
+
+	/**
+	 * Queues a location update operation
+	 * 
+	 * @param location
+	 *            the location to be updated
+	 */
+	static void updateLocation(TraceLocation location) {
+		TraceLocationUpdateWriter writer = new TraceLocationUpdateWriter(
+				location);
+		writer.update();
+	}
+
+	/**
+	 * Queues a add location operation
+	 * 
+	 * @param properties
+	 *            the source properties
+	 * @param trace
+	 *            the trace to be added to source
+	 * @param offset
+	 *            the offset where trace is added
+	 * @throws SourceParserException
+	 *             if source parser fails
+	 */
+	static void addLocation(SourceProperties properties, Trace trace, int offset)
+			throws SourceParserException {
+		TraceLocationCreator writer = new TraceLocationCreator(properties,
+				trace, offset, null);
+		writer.update();
+	}
+
+	/**
+	 * Queues a replace location operation
+	 * 
+	 * @param properties
+	 *            the source properties
+	 * @param trace
+	 *            the trace to be added to source
+	 * @param replaced
+	 *            the location which is replaced by the trace
+	 * @throws SourceParserException
+	 *             if source parser fails
+	 */
+	static void replaceLocation(SourceProperties properties, Trace trace,
+			TraceLocation replaced) throws SourceParserException {
+		TraceLocationProperties locprops = new TraceLocationProperties();
+		Iterator<String> itr = replaced.getParameters();
+		while (itr.hasNext()) {
+			locprops.addParameterTag(itr.next());
+		}
+		TraceLocationCreator replacer = new TraceLocationCreator(properties,
+				trace, TraceLocationRemover.findStartOffset(replaced), locprops);
+		replacer.update();
+	}
+
+	/**
+	 * Queues a remove location operation
+	 * 
+	 * @param location
+	 *            the location to be removed
+	 */
+	static void removeLocation(TraceLocation location) {
+		TraceLocationRemover remover = new TraceLocationRemover(location);
+		remover.update();
+	}
+
+	/**
+	 * Locates the comment related to given location
+	 * 
+	 * @param location
+	 *            the location
+	 * @return index to the start of comment
+	 */
+	static SourceExcludedArea findLocationComment(TraceLocation location) {
+		SourceExcludedArea retval = null;
+		if (location.getParserRule() != null) {
+			retval = location.getParserRule().getLocationParser()
+					.findLocationComment(location);
+		}
+		return retval;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/source/TraceParameterFormattingRule.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Rule interface for parameters
+*
+*/
+package com.nokia.tracebuilder.engine.source;
+
+import com.nokia.tracebuilder.model.TraceObjectRule;
+
+/**
+ * Rule interface for parameters. Each parameter may provide replacement text
+ * for the %EXT% formatting.
+ * 
+ */
+public interface TraceParameterFormattingRule extends TraceObjectRule {
+
+	/**
+	 * Determines if this object should be shown in source
+	 * 
+	 * @return true if shown in source, false otherwise
+	 */
+	public boolean isShownInSource();
+
+	/**
+	 * Maps parameter name to name shown in source. Note that the original name
+	 * passed to this function is not necessarily the name returned by
+	 * getOwner().getName()
+	 * 
+	 * @param originalName
+	 *            the original name to be inserted to source
+	 * @return the name shown in source
+	 */
+	public String mapNameToSource(String originalName);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/source/messages.properties	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,4 @@
+IncludeStatementAdder.IncludeAddedEventPrefix=#include "
+IncludeStatementAdder.IncludeAddedEventPostfix=" added
+SourceFormatter.defaultStateMachineNameText=, "REPLACE_WITH_CORRECT_MACHINE_NAME"
+SourceFormatter.defaultStateMachineStateText=, "REPLACE_WITH_CORRECT_STATE"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/source/package.html	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,3 @@
+<html><body>
+Source engine monitors the source editors opened into Eclipse UI
+</body></html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/utils/TraceMultiplierRule.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Rule which can be used to create copies of new traces
+*
+*/
+package com.nokia.tracebuilder.engine.utils;
+
+import java.util.Iterator;
+
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceObjectRule;
+
+/**
+ * Rule which can be used to create copies of new traces
+ * 
+ */
+public interface TraceMultiplierRule extends TraceObjectRule {
+
+	/**
+	 * Gets copies of the given trace which is about to be inserted into given
+	 * context. The new trace is added first and the the copies will be inserted
+	 * after it in the order they are received from the iterator.
+	 * 
+	 * @param trace
+	 *            the new trace
+	 * @return a list of copies
+	 */
+	public Iterator<Trace> createCopies(Trace trace);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/utils/TraceUtils.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,274 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Utility functions related to traces
+*
+*/
+package com.nokia.tracebuilder.engine.utils;
+
+import java.util.Iterator;
+
+import com.nokia.tracebuilder.engine.TraceBuilderConfiguration;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.source.SourceEngine;
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.plugin.TraceFormatConstants;
+import com.nokia.tracebuilder.source.SourceContext;
+
+/**
+ * Utility functions related to traces
+ * 
+ */
+public final class TraceUtils {
+
+	/**
+	 * Default name format
+	 */
+	private static final String DEFAULT_NAME_FORMAT = "{$CN}_{$FN}"; //$NON-NLS-1$
+
+	/**
+	 * Default trace format
+	 */
+	private static final String DEFAULT_TRACE_FORMAT = "{$cn}::{$fn}"; //$NON-NLS-1$
+
+	/**
+	 * Underscore character
+	 */
+	private static final String UNDERSCORE = "_"; //$NON-NLS-1$
+
+	/**
+	 * Underscore character
+	 */
+	private static final char UNDERSCORE_CHAR = '_';
+
+	/**
+	 * Cannot be constructed
+	 */
+	private TraceUtils() {
+	}
+
+	/**
+	 * Gets the default trace name format
+	 * 
+	 * @return the default trace name format
+	 */
+	public static String getDefaultNameFormat() {
+		return DEFAULT_NAME_FORMAT;
+	}
+
+	/**
+	 * Gets the default trace text format
+	 * 
+	 * @return the default trace text format
+	 */
+	public static String getDefaultTraceFormat() {
+		return DEFAULT_TRACE_FORMAT;
+	}
+
+	/**
+	 * Formats a trace
+	 * 
+	 * @param format
+	 *            the format specification
+	 * @param cname
+	 *            the class name
+	 * @param fname
+	 *            the function name
+	 * @return the formatted trace
+	 */
+	public static String formatTrace(String format, String cname, String fname) {
+		StringBuffer sb = new StringBuffer(format);
+		int cnindex = sb
+				.indexOf(TraceFormatConstants.FORMAT_CLASS_NAME_NORMAL_CASE);
+		if (cnindex >= 0) {
+			if (cname != null) {
+				sb.replace(cnindex, cnindex
+						+ TraceFormatConstants.FORMAT_CLASS_NAME_NORMAL_CASE
+								.length(), cname);
+			} else {
+				sb.replace(cnindex, cnindex
+						+ TraceFormatConstants.FORMAT_CLASS_NAME_NORMAL_CASE
+								.length(), ""); //$NON-NLS-1$
+			}
+		}
+		int cnup = sb
+				.indexOf(TraceFormatConstants.FORMAT_CLASS_NAME_UPPER_CASE);
+		if (cnup >= 0) {
+			if (cname != null) {
+				sb.replace(cnup, cnup
+						+ TraceFormatConstants.FORMAT_CLASS_NAME_UPPER_CASE
+								.length(), cname.toUpperCase());
+			} else {
+				sb.replace(cnup, cnup
+						+ TraceFormatConstants.FORMAT_CLASS_NAME_UPPER_CASE
+								.length(), ""); //$NON-NLS-1$
+			}
+		}
+		int fnindex = sb
+				.indexOf(TraceFormatConstants.FORMAT_FUNCTION_NAME_NORMAL_CASE);
+		if (fnindex >= 0) {
+			sb.replace(fnindex, fnindex
+					+ TraceFormatConstants.FORMAT_FUNCTION_NAME_NORMAL_CASE
+							.length(), fname);
+		}
+		int fnup = sb
+				.indexOf(TraceFormatConstants.FORMAT_FUNCTION_NAME_UPPER_CASE);
+		if (fnup >= 0) {
+			sb.replace(fnup, fnup
+					+ TraceFormatConstants.FORMAT_FUNCTION_NAME_UPPER_CASE
+							.length(), fname.toUpperCase());
+		}
+		return sb.toString();
+	}
+
+	/**
+	 * Replaces invalid characters with '_'
+	 * 
+	 * @param name
+	 *            name to be converted
+	 * @return the converted name
+	 */
+	public static String convertName(String name) {
+		StringBuffer sb;
+		if (name.length() > 0) {
+			boolean underscore = false;
+			sb = new StringBuffer(name);
+			if (Character.isDigit(name.charAt(0))) {
+				sb.insert(0, UNDERSCORE_CHAR);
+			}
+			for (int i = 0; i < sb.length(); i++) {
+				char c = sb.charAt(i);
+				if (!Character.isLetterOrDigit(c)) {
+					if (!underscore) {
+						sb.setCharAt(i, UNDERSCORE_CHAR);
+						underscore = true;
+					} else {
+						sb.deleteCharAt(i);
+						i--;
+					}
+				} else {
+					underscore = false;
+				}
+			}
+			if (sb.length() > 0) {
+				if (sb.charAt(sb.length() - 1) == UNDERSCORE_CHAR) {
+					sb.deleteCharAt(sb.length() - 1);
+				}
+			} else {
+				sb.append(UNDERSCORE);
+			}
+		} else {
+			sb = new StringBuffer();
+		}
+		// If parameter value is NULL, it would be used as name
+		String s = sb.toString();
+		if (s.equals("NULL")) { //$NON-NLS-1$
+			s = "_NULL"; //$NON-NLS-1$
+		}
+		return s;
+	}
+
+	/**
+	 * Creates copies of the trace if it has TraceMultiplierRule extensions
+	 * 
+	 * @param trace
+	 *            the trace to be multiplied
+	 * @param insertLocation
+	 *            the location where the original trace was inserted
+	 * @param sourceEngine
+	 *            the source engine
+	 */
+	public static void multiplyTrace(Trace trace, int insertLocation,
+			SourceEngine sourceEngine) {
+		// If multiplier rules have been added to the trace, they are
+		// used to create copies of the trace
+		TraceMultiplierRule multiplier;
+		trace.getModel().startProcessing();
+		try {
+			// Trace may contain multiple multipliers. This loop gets one,
+			// removes it and stops when there are no more multipliers
+			do {
+				multiplier = trace.getExtension(TraceMultiplierRule.class);
+				if (multiplier != null) {
+					processMultiplier(trace, multiplier, insertLocation,
+							sourceEngine);
+					// Multiplier extension is removed after use
+					trace.removeExtension(multiplier);
+				}
+			} while (multiplier != null);
+		} finally {
+			trace.getModel().processingComplete();
+		}
+	}
+
+	/**
+	 * Processes a trace multiplier
+	 * 
+	 * @param trace
+	 *            the trace
+	 * @param multiplier
+	 *            the multiplier
+	 * @param insertLocation
+	 *            the location where the original trace was inserted
+	 * @param sourceEngine
+	 *            the source engine
+	 */
+	private static void processMultiplier(Trace trace,
+			TraceMultiplierRule multiplier, int insertLocation,
+			SourceEngine sourceEngine) {
+		Iterator<Trace> itr = multiplier.createCopies(trace);
+		while (itr.hasNext()) {
+			Trace copy = itr.next();
+			addMultipliedTrace(copy, insertLocation, sourceEngine);
+		}
+	}
+
+	/**
+	 * Adds a trace that has been created by a multiplier rule. The trace is
+	 * inserted to the same location as the original trace.
+	 * 
+	 * @param trace
+	 *            the trace to be added
+	 * @param insertLocation
+	 *            the location where the original trace was inserted
+	 * @param sourceEngine
+	 *            the source engine
+	 */
+	private static void addMultipliedTrace(Trace trace, int insertLocation,
+			SourceEngine sourceEngine) {
+		try {
+			// If location is specified, the trace is inserted into it
+			if (insertLocation != -1) {
+				SourceContext context = TraceBuilderGlobals
+						.getSourceContextManager().getContext();
+				if (insertLocation >= context.getOffset()
+						&& insertLocation < context.getOffset()
+								+ context.getLength()) {
+					sourceEngine.insertTrace(trace, sourceEngine
+							.getSourceOfContext(context), insertLocation);
+				} else {
+					if (TraceBuilderConfiguration.ASSERTIONS_ENABLED) {
+						TraceBuilderGlobals.getEvents().postAssertionFailed(
+								"Out of context insert", trace); //$NON-NLS-1$
+					}
+				}
+			}
+		} catch (TraceBuilderException e) {
+			TraceBuilderGlobals.getEvents().postError(e);
+		}
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/utils/package.html	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,3 @@
+<html><body>
+Miscellaneus utility functions and interfaces that should not be in the public API
+</body></html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/file/FileUtils.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,302 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 utility functions
+*
+*/
+package com.nokia.tracebuilder.file;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.net.URI;
+
+import org.eclipse.core.runtime.IPath;
+
+import com.nokia.tracebuilder.source.SourceConstants;
+
+/**
+ * File utility functions
+ * 
+ */
+public final class FileUtils {
+
+	/**
+	 * File copy buffer size
+	 */
+	private static final int COPY_BUFFER_SIZE = 4096; // CodForChk_Dis_Magic
+
+	/**
+	 * cpp extension
+	 */
+	public final static String CPP_EXTENSION = "cpp"; //$NON-NLS-1$	
+
+	/**
+	 * c extension
+	 */
+	public final static String C_EXTENSION = "c"; //$NON-NLS-1$	
+
+	/**
+	 * Allowed files
+	 */
+	private final static String[] FILE_FILTERS = { ".cpp", //$NON-NLS-1$
+			".c", //$NON-NLS-1$
+			".inl", //$NON-NLS-1$
+			".h" //$NON-NLS-1$
+	};
+
+	/**
+	 * MMP file extension
+	 */
+	public static final String MMP = ".mmp"; //$NON-NLS-1$
+
+	/**
+	 * Creates a file output stream. This creates directories and overwriting
+	 * possible read-only flag
+	 * 
+	 * @param file
+	 *            the file
+	 * @return the file output stream
+	 * @throws FileNotFoundException
+	 *             if file cannot be created
+	 */
+	public static OutputStream createOutputStream(File file)
+			throws FileNotFoundException {
+		File parent = file.getParentFile();
+		if (!parent.exists()) {
+			parent.mkdirs();
+		}
+		FileOutputStream fos;
+		try {
+			fos = new FileOutputStream(file);
+		} catch (IOException e) {
+			if (file.exists()) {
+				file.delete();
+			}
+			fos = new FileOutputStream(file);
+		}
+		return new BufferedOutputStream(fos);
+	}
+
+	/**
+	 * Creates a copy of a file
+	 * 
+	 * @param source
+	 *            the source file
+	 * @param target
+	 *            the target file
+	 * @return true if written successfully
+	 */
+	public static boolean copyFile(File source, File target) {
+		boolean backup = true;
+		try {
+			byte[] buf = new byte[COPY_BUFFER_SIZE];
+			FileInputStream fis = new FileInputStream(source);
+			OutputStream fos = createOutputStream(target);
+			int len;
+			do {
+				len = fis.read(buf);
+				if (len > 0) {
+					fos.write(buf, 0, len);
+				}
+			} while (len > 0);
+			fis.close();
+			fos.close();
+		} catch (Exception e) {
+			backup = false;
+		}
+		return backup;
+	}
+
+	/**
+	 * Converts file separator characters
+	 * 
+	 * @param separator
+	 *            separator to be used
+	 * @param path
+	 *            string to be converted
+	 * @param addLast
+	 *            true if the converted string should end with a separator
+	 * @return the converted string
+	 */
+	public static String convertSeparators(char separator, String path,
+			boolean addLast) {
+		path = path.replace(SourceConstants.FORWARD_SLASH_CHAR, separator);
+		path = path.replace(SourceConstants.BACKSLASH_CHAR, separator);
+		String sepStr = String.valueOf(separator);
+		if (addLast && !path.endsWith(sepStr)) {
+			path += separator;
+		} else if (!addLast && path.endsWith(sepStr)) {
+			path = path.substring(0, path.length() - 1);
+		}
+		return path;
+	}
+
+	/**
+	 * Gets the relative path from source to target
+	 * 
+	 * @param source
+	 *            the source file
+	 * @param target
+	 *            the target file
+	 * @return the relative path without file name
+	 */
+	public static String getRelativePath(String source, String target) {
+		try {
+			source = new File(source).getCanonicalPath();
+			target = new File(target).getCanonicalPath();
+		} catch (IOException e) {
+		}
+		source = convertSeparators(SourceConstants.FORWARD_SLASH_CHAR, source,
+				false);
+		target = convertSeparators(SourceConstants.FORWARD_SLASH_CHAR, target,
+				false);
+		int len = Math.min(source.length(), target.length());
+		int start = -1;
+		for (int i = 0; i < len && start == -1; i++) {
+			if (source.charAt(i) != target.charAt(i)) {
+				start = i;
+			}
+		}
+		String retval;
+		if (start == -1) {
+			retval = getRelativePathSub(source, target);
+		} else {
+			retval = getRelativePathUnrelated(source, target, start);
+		}
+		return retval;
+	}
+
+	/**
+	 * Gets the relative path from source to target when either one is a
+	 * sub-directory of another
+	 * 
+	 * @param source
+	 *            the source
+	 * @param target
+	 *            the target
+	 * @return the relative path
+	 */
+	private static String getRelativePathSub(String source, String target) {
+		StringBuffer sb = new StringBuffer();
+		if (source.length() > target.length()) {
+			// Source is in sub-directory of target
+			for (int i = target.length(); i < source.length(); i++) {
+				if (source.charAt(i) == SourceConstants.FORWARD_SLASH_CHAR) {
+					sb.append(SourceConstants.PATH_UP);
+				}
+			}
+		} else if (target.length() > source.length()) {
+			// Target is in sub-directory of source
+			int lastIndex;
+			if (source.endsWith(String
+					.valueOf(SourceConstants.FORWARD_SLASH_CHAR))) {
+				lastIndex = source.length();
+			} else {
+				lastIndex = source.length() + 1;
+			}
+			for (int i = source.length(); i < target.length(); i++) {
+				if (target.charAt(i) == SourceConstants.FORWARD_SLASH_CHAR) {
+					sb.append(target.substring(lastIndex, i + 1));
+					lastIndex = i + 1;
+				}
+			}
+			if (new File(target).isDirectory() && lastIndex < target.length()) {
+				sb.append(target.substring(lastIndex));
+			}
+		} else {
+			// Paths were equal
+			sb.append(SourceConstants.THIS_PATH);
+		}
+		return sb.toString();
+	}
+
+	/**
+	 * Gets the relative path between two unrelated directories
+	 * 
+	 * @param source
+	 *            the source
+	 * @param target
+	 *            the target
+	 * @param start
+	 *            the start index where the paths differ
+	 * @return the relative path
+	 */
+	private static String getRelativePathUnrelated(String source,
+			String target, int start) {
+		String retval;
+		StringBuffer sb = new StringBuffer();
+		File f = new File(target);
+		// If target is absolute path and there is nothing in common between the
+		// paths, the target absolute path is returned as such
+		if (f.isAbsolute() && start == 0) {
+			int lastIndex = target
+					.lastIndexOf(SourceConstants.FORWARD_SLASH_CHAR) + 1;
+			sb.append(target.substring(0, lastIndex));
+		} else {
+			for (int i = start; i < source.length(); i++) {
+				if (source.charAt(i) == SourceConstants.FORWARD_SLASH_CHAR) {
+					sb.append(SourceConstants.PATH_UP);
+				}
+			}
+			int lastIndex;
+			// The previous directory separator is used as the root between the
+			// two paths.
+			lastIndex = target.lastIndexOf(SourceConstants.FORWARD_SLASH_CHAR,
+					start - 1) + 1;
+			for (int i = start; i < target.length(); i++) {
+				if (target.charAt(i) == SourceConstants.FORWARD_SLASH_CHAR) {
+					sb.append(target.substring(lastIndex, i + 1));
+					lastIndex = i + 1;
+				}
+			}
+		}
+		retval = sb.toString();
+		return retval;
+	}
+
+	/**
+	 * Checks if given file is allowed to be opened into TraceBuilder
+	 * 
+	 * @param fileName
+	 *            the file to be checked
+	 * @return true if filtered, false if not
+	 */
+	public static boolean isFileAllowed(String fileName) {
+		boolean allowed = false;
+		fileName = fileName.toLowerCase();
+		for (String filter : FILE_FILTERS) {
+			if (fileName.endsWith(filter)) {
+				allowed = true;
+				break;
+			}
+		}
+		return allowed;
+	}
+
+	/**
+	 * Creates URI from given IPath instance.
+	 * @param path
+	 * @return URI from given IPath instance
+	 */
+	public static URI makeURI(IPath path) {
+		File file = path.toFile();
+		return file.toURI();
+	}	
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/DuplicateConstantNameModifier.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 name modifier
+*
+*/
+package com.nokia.tracebuilder.model;
+
+/**
+ * Constant name modifier
+ * 
+ */
+final class DuplicateConstantNameModifier extends DuplicateValueModifier {
+
+	/**
+	 * The constant table
+	 */
+	private TraceConstantTable table;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param table
+	 *            the table owning the entry
+	 * @param name
+	 *            the constant name
+	 */
+	DuplicateConstantNameModifier(TraceConstantTable table, String name) {
+		super(name);
+		this.table = table;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceObjectUtils.DuplicateValueModifier#
+	 *      findObject(java.lang.String)
+	 */
+	@Override
+	TraceObject findObject(String name) {
+		TraceObject retval;
+		if (table != null) {
+			retval = table.findEntryByName(name);
+		} else {
+			retval = null;
+		}
+		return retval;
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/DuplicateConstantTableNameModifier.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Modifier for duplicate constant table names
+*
+*/
+package com.nokia.tracebuilder.model;
+
+/**
+ * Modifier for duplicate constant table names
+ * 
+ */
+final class DuplicateConstantTableNameModifier extends DuplicateValueModifier {
+
+	/**
+	 * Trace model
+	 */
+	private TraceModel model;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            the trace model
+	 * @param value
+	 *            the value to be modified
+	 */
+	DuplicateConstantTableNameModifier(TraceModel model, String value) {
+		super(value);
+		this.model = model;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.DuplicateValueModifier#findObject(java.lang.String)
+	 */
+	@Override
+	TraceObject findObject(String value) {
+		return model.findConstantTableByName(value);
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/DuplicateGroupNameModifier.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 name modifier
+*
+*/
+package com.nokia.tracebuilder.model;
+
+/**
+ * Group name modifier
+ * 
+ */
+final class DuplicateGroupNameModifier extends DuplicateValueModifier {
+
+	/**
+	 * Trace model
+	 */
+	private TraceModel model;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            the trace model
+	 * @param name
+	 *            the group name
+	 */
+	DuplicateGroupNameModifier(TraceModel model, String name) {
+		super(name);
+		this.model = model;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceObjectUtils.DuplicateValueModifier#
+	 *      findObject(java.lang.String)
+	 */
+	@Override
+	TraceObject findObject(String name) {
+		return model.findGroupByName(name);
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/DuplicateParameterNameModifier.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Parameter name modifier
+*
+*/
+package com.nokia.tracebuilder.model;
+
+/**
+ * Parameter name modifier
+ * 
+ */
+final class DuplicateParameterNameModifier extends DuplicateValueModifier {
+
+	/**
+	 * The parameter owner
+	 */
+	private Trace owner;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param owner
+	 *            the owner of the parameter
+	 * @param name
+	 *            the parameter name
+	 */
+	DuplicateParameterNameModifier(Trace owner, String name) {
+		super(name);
+		this.owner = owner;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceObjectUtils.DuplicateValueModifier#
+	 *      findObject(java.lang.String)
+	 */
+	@Override
+	TraceObject findObject(String name) {
+		TraceObject retval;
+		if (owner != null) {
+			retval = owner.findParameterByName(name);
+		} else {
+			retval = null;
+		}
+		return retval;
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/DuplicateTraceNameModifier.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 name modifier
+*
+*/
+package com.nokia.tracebuilder.model;
+
+/**
+ * Trace name modifier
+ * 
+ */
+final class DuplicateTraceNameModifier extends DuplicateValueModifier {
+
+	/**
+	 * The trace group
+	 */
+	private TraceGroup group;
+
+	/**
+	 * The trace group
+	 */
+	private TraceModel model;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param group
+	 *            the trace group owning the trace
+	 * @param name
+	 *            the trace name
+	 */
+	DuplicateTraceNameModifier(TraceGroup group, String name) {
+		super(name);
+		this.group = group;
+	}
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            the trace model
+	 * @param name
+	 *            the trace name
+	 */
+	DuplicateTraceNameModifier(TraceModel model, String name) {
+		super(name);
+		this.model = model;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceObjectUtils.DuplicateValueModifier#
+	 *      findObject(java.lang.String)
+	 */
+	@Override
+	TraceObject findObject(String name) {
+		TraceObject retval;
+		if (group != null) {
+			retval = group.findTraceByName(name);
+		} else {
+			retval = model.findTraceByName(name);
+		}
+		return retval;
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/DuplicateValueModifier.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,183 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 value modifiers
+*
+*/
+package com.nokia.tracebuilder.model;
+
+/**
+ * Base class for value modifiers
+ * 
+ */
+abstract class DuplicateValueModifier implements TraceObjectModifier {
+
+	/**
+	 * Duplicate tag for values
+	 */
+	private static final String DUPLICATE_TAG = "DUP"; //$NON-NLS-1$
+
+	/**
+	 * Duplicate tag separator
+	 */
+	private static final char DUPLICATE_SEPARATOR = '_';
+
+	/**
+	 * Value
+	 */
+	private String value;
+
+	/**
+	 * Changed flag
+	 */
+	private boolean changed;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param value
+	 *            the value
+	 */
+	DuplicateValueModifier(String value) {
+		this.value = value;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceObjectUtils.TraceObjectModifier#getData()
+	 */
+	public String getData() {
+		return value;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceObjectUtils.TraceObjectModifier#hasChanged()
+	 */
+	public boolean hasChanged() {
+		return changed;
+	}
+
+	/**
+	 * Gets the separator character
+	 * 
+	 * @return the char
+	 */
+	protected char getSeparator() {
+		return DUPLICATE_SEPARATOR;
+	}
+
+	/**
+	 * Processes the name and modifies if there are duplicates
+	 */
+	void processName() {
+		int index = getStartIndex(value);
+		TraceObject object;
+		do {
+			object = findObject(value);
+			if (object != null) {
+				changed = true;
+				value = appendIndexToString(value, index);
+				index++;
+			}
+		} while (object != null);
+	}
+
+	/**
+	 * Gets the start index from given text
+	 * 
+	 * @param value
+	 *            the value to be parsed
+	 * @return the start index
+	 */
+	private int getStartIndex(String value) {
+		String valueStr = null;
+		if (value.startsWith(DUPLICATE_TAG)) {
+			for (int i = DUPLICATE_TAG.length(); i < value.length(); i++) {
+				char c = value.charAt(i);
+				if (!Character.isDigit(c)) {
+					valueStr = value.substring(DUPLICATE_TAG.length(), i);
+					i = value.length();
+				}
+			}
+		}
+		int retval = -1;
+		if (valueStr != null && valueStr.length() > 0) {
+			retval = Integer.parseInt(valueStr);
+		}
+		return retval;
+	}
+
+	/**
+	 * Appends an index value to given string replacing existing index if it
+	 * exists
+	 * 
+	 * @param value
+	 *            the string
+	 * @param index
+	 *            the index
+	 * @return the changed string
+	 */
+	private String appendIndexToString(String value, int index) {
+		StringBuffer newValue = new StringBuffer();
+		if (index >= 0) {
+			String indexStr = String.valueOf(index);
+			newValue.append(DUPLICATE_TAG);
+			newValue.append(String.valueOf(index + 1));
+			newValue.append(getSeparator());
+			newValue.append(value.substring(DUPLICATE_TAG.length()
+					+ indexStr.length() + 1)); // Add separator
+		} else {
+			newValue.append(DUPLICATE_TAG);
+			newValue.append("1"); //$NON-NLS-1$
+			newValue.append(getSeparator());
+			newValue.append(value);
+		}
+		return newValue.toString();
+	}
+
+	/**
+	 * Gets the duplicate modifier from beginning of given text
+	 * 
+	 * @param text
+	 *            the text
+	 * @return the modifier
+	 */
+	static String getModifier(String text) {
+		String retval = null;
+		if (text.startsWith(DUPLICATE_TAG)) {
+			for (int i = DUPLICATE_TAG.length(); i < text.length(); i++) {
+				char c = text.charAt(i);
+				if (!Character.isDigit(c)) {
+					retval = text.substring(0, i + 1); // Add separator
+					i = text.length();
+				}
+			}
+		}
+		return retval;
+	}
+
+	/**
+	 * Finds the object from model
+	 * 
+	 * @param value
+	 *            the value
+	 * @return the object or null if not found
+	 */
+	abstract TraceObject findObject(String value);
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/Trace.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,294 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Represents the mapping of a trace ID into actual trace string
+*
+*/
+package com.nokia.tracebuilder.model;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+/**
+ * Represents the mapping of a trace ID into actual trace string. When a trace
+ * is decoded, the trace ID found from the binary trace file is converted to the
+ * text stored in this trace.
+ * 
+ */
+public class Trace extends TraceObject implements Iterable<TraceParameter> {
+
+	/**
+	 * The trace string
+	 */
+	private String trace = ""; //$NON-NLS-1$
+
+	/**
+	 * List of TraceParameter objects.
+	 */
+	private ArrayList<TraceParameter> parameters = new ArrayList<TraceParameter>();
+
+	/**
+	 * The trace group this trace belongs to
+	 */
+	private TraceGroup group;
+
+	/**
+	 * Creates a new trace and associates it with given TraceGroup
+	 * 
+	 * @param group
+	 *            the trace group
+	 */
+	Trace(TraceGroup group) {
+		setModel(group.getModel());
+		this.group = group;
+		group.addTrace(this);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceObject#reset()
+	 */
+	@Override
+	void reset() {
+		super.reset();
+		for (TraceParameter parameter : parameters) {
+			// Model listeners are not notified on reset, but if the
+			// parameter itself implements a delete notification interface,
+			// it must be called to do appropriate cleanup
+			notifyOnDelete(parameter);
+			parameter.reset();
+		}
+		parameters.clear();
+	}
+
+	/**
+	 * Sets the trace string. Generates propertyUpdated event to model listeners
+	 * if the string changes
+	 * 
+	 * @see TraceModelListener#propertyUpdated(TraceObject, int)
+	 * @param trace
+	 *            the trace string
+	 */
+	public void setTrace(String trace) {
+		if (trace == null) {
+			trace = ""; //$NON-NLS-1$
+		}
+		if (!trace.equals(this.trace)) {
+			this.trace = trace;
+			getModel().notifyPropertyUpdated(this, TraceModelListener.TRACE);
+		}
+	}
+
+	/**
+	 * Returns the trace string. This never returns null
+	 * 
+	 * @return the trace string
+	 */
+	public String getTrace() {
+		return trace;
+	}
+
+	/**
+	 * Returns the group to which this trace belongs
+	 * 
+	 * @return trace group
+	 */
+	public TraceGroup getGroup() {
+		return group;
+	}
+
+	/**
+	 * Adds a new parameter to the end of parameter list. Generates objectAdded
+	 * event to model listeners
+	 * 
+	 * @see TraceModelListener#objectAdded(TraceObject, TraceObject)
+	 * @param parameter
+	 *            the new parameter
+	 */
+	public void addParameter(TraceParameter parameter) {
+		parameters.add(parameter);
+		getModel().notifyObjectAdded(this, parameter);
+	}
+
+	/**
+	 * Inserts a new parameter to the given location. Generates objectAdded
+	 * event to model listeners
+	 * 
+	 * @see TraceModelListener#objectAdded(TraceObject, TraceObject)
+	 * @param index
+	 *            the index for new parameter
+	 * @param parameter
+	 *            the new parameter
+	 */
+	void insertParameter(int index, TraceParameter parameter) {
+		parameters.add(index, parameter);
+		getModel().notifyObjectAdded(this, parameter);
+	}
+
+	/**
+	 * Removes a parameter from this trace object. Generates a objectRemoved
+	 * event to model listeners if the parameter is actually removed
+	 * 
+	 * @see TraceModelListener#objectRemoved(TraceObject, TraceObject)
+	 * @param parameter
+	 *            the parameter to be removed
+	 */
+	public void removeParameter(TraceParameter parameter) {
+		if (parameters.remove(parameter)) {
+			getModel().notifyObjectRemoved(this, parameter);
+			parameter.reset();
+		}
+	}
+
+	/**
+	 * Removes parameter at given index
+	 * 
+	 * @param index
+	 *            the index of the parameter
+	 */
+	public void removeParameterAt(int index) {
+		if (index >= 0 && index < parameters.size()) {
+			TraceParameter parameter = parameters.get(index);
+			parameters.remove(index);
+			getModel().notifyObjectRemoved(this, parameter);
+			parameter.reset();
+		}
+	}
+
+	/**
+	 * Determines if this object has parameters.
+	 * 
+	 * @return true if this object has parameters
+	 */
+	public boolean hasParameters() {
+		return !parameters.isEmpty();
+	}
+
+	/**
+	 * Gets the number of parameters
+	 * 
+	 * @return the number of parameters
+	 */
+	public int getParameterCount() {
+		return parameters.size();
+	}
+
+	/**
+	 * Returns highest parameter ID + 1. Can be used to create an unique ID for
+	 * a new parameter.
+	 * 
+	 * @return the next parameter ID
+	 */
+	public int getNextParameterID() {
+		int max = 0;
+		for (TraceParameter parameter : parameters) {
+			int id = parameter.getID();
+			if (id > max) {
+				max = id;
+			}
+		}
+		return max + 1;
+	}
+
+	/**
+	 * Gets the parameter at given index
+	 * 
+	 * @param index
+	 *            the parameter index
+	 * @return the parameter at the index
+	 */
+	public TraceParameter getParameter(int index) {
+		return parameters.get(index);
+	}
+
+	/**
+	 * Returns the parameters of this object
+	 * 
+	 * @return iterator over the parameters
+	 */
+	public Iterator<TraceParameter> getParameters() {
+		return parameters.iterator();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Iterable#iterator()
+	 */
+	public Iterator<TraceParameter> iterator() {
+		return parameters.iterator();
+	}
+
+	/**
+	 * Gets a parameter by ID
+	 * 
+	 * @param id
+	 *            the parameter ID
+	 * @return the parameter or null
+	 */
+	public TraceParameter findParameterByID(int id) {
+		TraceParameter retval = null;
+		for (TraceParameter parameter : parameters) {
+			if (parameter.getID() == id) {
+				retval = parameter;
+				break;
+			}
+		}
+		return retval;
+	}
+
+	/**
+	 * Gets a parameter by name
+	 * 
+	 * @param name
+	 *            the name of a parameter
+	 * @return the parameter or null
+	 */
+	public TraceParameter findParameterByName(String name) {
+		TraceParameter retval = null;
+		for (TraceParameter parameter : parameters) {
+			if (parameter.getName().equals(name)) {
+				retval = parameter;
+				break;
+			}
+		}
+		return retval;
+	}
+
+	/**
+	 * Gets a parameter that implements the given extension class. If there are
+	 * multiple parameters with same extension class, the first one is returned
+	 * 
+	 * @param <T>
+	 *            the type of the extension
+	 * @param c
+	 *            the class
+	 * @return the parameter
+	 */
+	public <T extends TraceModelExtension> TraceParameter findParameterByExtension(
+			Class<T> c) {
+		TraceParameter retval = null;
+		for (TraceParameter parameter : parameters) {
+			T ext = parameter.getExtension(c);
+			if (ext != null) {
+				retval = parameter;
+				break;
+			}
+		}
+		return retval;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceBuilderErrorParameters.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Parameters for errors
+*
+*/
+package com.nokia.tracebuilder.model;
+
+/**
+ * Parameters for errors
+ * 
+ */
+public class TraceBuilderErrorParameters {
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceBuilderException.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,164 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Exceptions thrown by Trace Builder engine
+*
+*/
+package com.nokia.tracebuilder.model;
+
+/**
+ * Exceptions thrown by Trace Builder engine
+ * 
+ */
+public class TraceBuilderException extends Exception {
+
+	/**
+	 * Error codes for trace builder exceptions
+	 * 
+	 */
+	public interface TraceBuilderExceptionCode {
+	}
+
+	/**
+	 * UID
+	 */
+	private static final long serialVersionUID = -2991616409482985157L; // CodForChk_Dis_Magic
+
+	/**
+	 * Error code
+	 */
+	private TraceBuilderExceptionCode errorCode;
+
+	/**
+	 * Error parameters
+	 */
+	private TraceBuilderErrorParameters parameters;
+
+	/**
+	 * Source object
+	 */
+	private Object source;
+
+	/**
+	 * Flag that defines will event related to exception posted to trace event view
+	 */
+	private boolean postEvent = true;
+	
+	/**
+	 * Constructor with error code
+	 * 
+	 * @param errorCode
+	 *            the error code
+	 */
+	public TraceBuilderException(TraceBuilderExceptionCode errorCode) {
+		this.errorCode = errorCode;
+	}
+	
+	/**
+	 * Constructor with error code and postEvent flag
+	 * 
+	 * @param errorCode
+	 *            the error code
+	 * @param postEvent
+	 *            flag that defines will event related to exception posted to trace event view   
+	 */
+	public TraceBuilderException(TraceBuilderExceptionCode errorCode, boolean postEvent) {
+		this.errorCode = errorCode;
+		this.postEvent = postEvent;
+	}
+
+	/**
+	 * Constructor with error code and parameters
+	 * 
+	 * @param errorCode
+	 *            the error code
+	 * @param parameters
+	 *            the error parameters
+	 */
+	public TraceBuilderException(TraceBuilderExceptionCode errorCode,
+			TraceBuilderErrorParameters parameters) {
+		this.errorCode = errorCode;
+		this.parameters = parameters;
+	}
+
+	/**
+	 * Constructor with error code, parameters and source object
+	 * 
+	 * @param errorCode
+	 *            the error code
+	 * @param parameters
+	 *            the error parameters
+	 * @param source
+	 *            the source object
+	 */
+	public TraceBuilderException(TraceBuilderExceptionCode errorCode,
+			TraceBuilderErrorParameters parameters, Object source) {
+		this.errorCode = errorCode;
+		this.parameters = parameters;
+		this.source = source;
+	}
+	
+	/**
+	 * Constructor with error code and root cause
+	 * 
+	 * @param errorCode
+	 *            the error code
+	 * @param cause
+	 *            the reason for this exception
+	 */
+	public TraceBuilderException(TraceBuilderExceptionCode errorCode,
+			Throwable cause) {
+		super(cause);
+		this.errorCode = errorCode;
+	}
+
+	/**
+	 * Gets the error code
+	 * 
+	 * @return error code
+	 */
+	public TraceBuilderExceptionCode getErrorCode() {
+		return errorCode;
+	}
+
+	/**
+	 * Gets the parameters related to the error
+	 * 
+	 * @return the parameters
+	 */
+	public TraceBuilderErrorParameters getErrorParameters() {
+		return parameters;
+	}
+
+	/**
+	 * Gets the source of this error
+	 * 
+	 * @return the source
+	 */
+	public Object getErrorSource() {
+		return source;
+	}
+
+	/**
+	 * Is event related to exception wanted to post to trace event view
+	 * 
+	 * @return true is event is wanted to post trace event view
+	 *         false is event is not wanted to post trace event view
+	 */
+	public boolean isEventWantedToPost() {
+		return postEvent;
+	}
+	
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceConstantTable.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,252 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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-to-string mapping table for parameters
+*
+*/
+package com.nokia.tracebuilder.model;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+/**
+ * Integer-to-string mapping table for parameters
+ * 
+ */
+public class TraceConstantTable extends TraceObject implements
+		Iterable<TraceConstantTableEntry> {
+
+	/**
+	 * Table entries
+	 */
+	private ArrayList<TraceConstantTableEntry> entries = new ArrayList<TraceConstantTableEntry>();
+
+	/**
+	 * Table type
+	 */
+	private String type = TraceParameter.UDEC32;
+
+	/**
+	 * Parameter reference count
+	 */
+	private ArrayList<TraceParameter> parameterReferences = new ArrayList<TraceParameter>();
+
+	/**
+	 * Creates a new constant table
+	 * 
+	 * @param model
+	 *            the trace model
+	 */
+	TraceConstantTable(TraceModel model) {
+		setModel(model);
+		model.addConstantTable(this);
+	}
+
+	/**
+	 * Gets the type
+	 * 
+	 * @return the type
+	 */
+	public String getType() {
+		return type;
+	}
+
+	/**
+	 * Sets the constant type
+	 * 
+	 * @param type
+	 *            the parameter type
+	 */
+	public void setType(String type) {
+		this.type = type;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceObject#setName(java.lang.String)
+	 */
+	@Override
+	public void setName(String name) {
+		super.setName(name);
+		// Note: Currently name changes are disabled when a table is referenced
+		// by parameters. If enabled at some point, a notification about this
+		// needs to be sent to the parameters
+	}
+
+	/**
+	 * Adds a constant table entry to this table. This is called from the
+	 * constant table entry constructor, to this is not public. Generates a
+	 * objectAdded event to model listeners
+	 * 
+	 * @see TraceModelListener#objectAdded(TraceObject, TraceObject)
+	 * @param entry
+	 *            the table entry
+	 */
+	void addEntry(TraceConstantTableEntry entry) {
+		entries.add(entry);
+		getModel().notifyObjectAdded(this, entry);
+	}
+
+	/**
+	 * Removes the given constant table entry. Creates a objectRemoved event to
+	 * the model listeners
+	 * 
+	 * @see TraceModelListener#objectRemoved(TraceObject, TraceObject)
+	 * @param entry
+	 *            the entry to be removed
+	 */
+	public void removeEntry(TraceConstantTableEntry entry) {
+		if (entries.remove(entry)) {
+			getModel().notifyObjectRemoved(this, entry);
+			entry.reset();
+		}
+	}
+
+	/**
+	 * Gets the entry which has given ID
+	 * 
+	 * @param id
+	 *            the id
+	 * @return the entry or null
+	 */
+	public TraceConstantTableEntry findEntryByID(int id) {
+		TraceConstantTableEntry retval = null;
+		for (TraceConstantTableEntry entry : entries) {
+			if (entry.getID() == id) {
+				retval = entry;
+				break;
+			}
+		}
+		return retval;
+	}
+
+	/**
+	 * Gets the entry which has the given name
+	 * 
+	 * @param name
+	 *            the name
+	 * @return the entry or null
+	 */
+	public TraceConstantTableEntry findEntryByName(String name) {
+		TraceConstantTableEntry retval = null;
+		for (TraceConstantTableEntry entry : entries) {
+			if (entry.getName().equals(name)) {
+				retval = entry;
+				break;
+			}
+		}
+		return retval;
+	}
+
+	/**
+	 * Gets the constant table entries
+	 * 
+	 * @return the entries iterator
+	 */
+	public Iterator<TraceConstantTableEntry> getEntries() {
+		return entries.iterator();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Iterable#iterator()
+	 */
+	public Iterator<TraceConstantTableEntry> iterator() {
+		return entries.iterator();
+	}
+
+	/**
+	 * Determines if there are any entries in this table
+	 * 
+	 * @return true if there are entries
+	 */
+	public boolean hasEntries() {
+		return !entries.isEmpty();
+	}
+
+	/**
+	 * Adds a parameter reference
+	 * 
+	 * @param parameter
+	 *            the parameter to be added
+	 */
+	void addParameterReference(TraceParameter parameter) {
+		parameterReferences.add(parameter);
+	}
+
+	/**
+	 * Removes a parameter reference
+	 * 
+	 * @param parameter
+	 *            the reference to be removed
+	 */
+	void removeParameterReference(TraceParameter parameter) {
+		parameterReferences.remove(parameter);
+	}
+
+	/**
+	 * Checks if there are parameter references
+	 * 
+	 * @return true if this table is referenced from parameters
+	 */
+	public boolean hasParameterReferences() {
+		return !parameterReferences.isEmpty();
+	}
+
+	/**
+	 * Gets the parameter references
+	 * 
+	 * @return the iterator of the references
+	 */
+	public Iterator<TraceParameter> getParameterReferences() {
+		return parameterReferences.iterator();
+	}
+
+	/**
+	 * Gets the largest constant ID + 1
+	 * 
+	 * @return the ID
+	 */
+	public int getNextEntryID() {
+		int max = 0;
+		for (TraceConstantTableEntry entry : entries) {
+			int id = entry.getID();
+			if (id > max) {
+				max = id;
+			}
+		}
+		return max + 1;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceObject#reset()
+	 */
+	@Override
+	void reset() {
+		for (TraceConstantTableEntry entry : entries) {
+			// Model listeners are not notified on reset, but if the
+			// entry itself implements a delete notification interface,
+			// it must be called to do appropriate cleanup
+			notifyOnDelete(entry);
+			entry.reset();
+		}
+		super.reset();
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceConstantTableEntry.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* One entry in the integer-to-string mapping table
+*
+*/
+package com.nokia.tracebuilder.model;
+
+/**
+ * One entry in the integer-to-string mapping table
+ * 
+ */
+public class TraceConstantTableEntry extends TraceObject {
+
+	/**
+	 * Constant table that owns this parameter
+	 */
+	private TraceConstantTable table;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param table
+	 *            the constant table that owns this entry
+	 */
+	TraceConstantTableEntry(TraceConstantTable table) {
+		setModel(table.getModel());
+		this.table = table;
+		table.addEntry(this);
+	}
+
+	/**
+	 * Gets the table that owns this entry
+	 * 
+	 * @return the table
+	 */
+	public TraceConstantTable getTable() {
+		return table;
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceGroup.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,223 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Represents a logical collection of traces somehow related to each other
+*
+*/
+package com.nokia.tracebuilder.model;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+
+/**
+ * Represents a logical collection of traces somehow related to each other. Each
+ * trace group specifies a prefix that is attached to all trace lines made
+ * within that group.
+ * 
+ */
+public class TraceGroup extends TraceObject implements Iterable<Trace> {
+
+	/**
+	 * List of traces, sorted by ID
+	 */
+	private ArrayList<Trace> tracesByID = new ArrayList<Trace>();
+
+	/**
+	 * List of traces, sorted by name
+	 */
+	private ArrayList<Trace> tracesByName = new ArrayList<Trace>();
+
+	/**
+	 * Creates a new trace group and associates it with given trace model.
+	 * 
+	 * @param model
+	 *            the trace model
+	 */
+	TraceGroup(TraceModel model) {
+		setModel(model);
+		model.addGroup(this);
+	}
+
+	/**
+	 * Adds a trace to this group. Cretes objectAdded event to model listeners
+	 * 
+	 * @see TraceModelListener#objectAdded(TraceObject, TraceObject)
+	 * @param trace
+	 *            the trace to be added
+	 */
+	void addTrace(Trace trace) {
+		// Sorted when ID is set to trace
+		tracesByID.add(trace);
+		// Sorted when name is set to trace
+		tracesByName.add(trace);
+		getModel().notifyObjectAdded(this, trace);
+	}
+
+	/**
+	 * Removes a trace from this group. Creates objectRemoved event to model
+	 * listeners
+	 * 
+	 * @see TraceModelListener#objectRemoved(TraceObject, TraceObject)
+	 * @param trace
+	 *            the trace to be removed
+	 */
+	public void removeTrace(Trace trace) {
+		int index = Collections.binarySearch(tracesByID, trace,
+				TraceObjectUtils.traceObjectIDComparator);
+		if (index >= 0) {
+			tracesByID.remove(index);
+			index = Collections.binarySearch(tracesByName, trace,
+					TraceObjectUtils.traceObjectNameComparator);
+			tracesByName.remove(index);
+			getModel().notifyObjectRemoved(this, trace);
+			trace.reset();
+		}
+	}
+
+	/**
+	 * Determines if this group has traces.
+	 * 
+	 * @return true if the group contains traces
+	 */
+	public boolean hasTraces() {
+		return !tracesByID.isEmpty();
+	}
+
+	/**
+	 * Gets the number of traces in this group.
+	 * 
+	 * @return the number of traces
+	 */
+	public int getTraceCount() {
+		return tracesByID.size();
+	}
+
+	/**
+	 * Returns an iterator over the traces within this group.
+	 * 
+	 * @return the iterator
+	 */
+	public Iterator<Trace> getTraces() {
+		return tracesByID.iterator();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Iterable#iterator()
+	 */
+	public Iterator<Trace> iterator() {
+		return tracesByID.iterator();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceObject#reset()
+	 */
+	@Override
+	void reset() {
+		// Reset removes constant table references
+		for (Trace trace : tracesByID) {
+			// Model listeners are not notified on reset, but if the
+			// trace itself implements a delete notification interface,
+			// it must be called to do appropriate cleanup
+			notifyOnDelete(trace);
+			trace.reset();
+		}
+		tracesByID.clear();
+		tracesByName.clear();
+		super.reset();
+	}
+
+	/**
+	 * Returns highest trace ID + 1. Can be used to create an unique ID for a
+	 * new trace.
+	 * 
+	 * @return the next trace ID
+	 */
+	public int getNextTraceID() {
+		int ret;
+		if (tracesByID.size() > 0) {
+			ret = tracesByID.get(tracesByID.size() - 1).getID() + 1;
+		} else {
+			ret = 1;
+		}
+		return ret;
+	}
+
+	/**
+	 * Gets the trace which has given ID
+	 * 
+	 * @param id
+	 *            the trace ID
+	 * @return the trace or null
+	 */
+	public Trace findTraceByID(int id) {
+		int index = Collections.binarySearch(tracesByID, id,
+				TraceObjectUtils.traceToIDComparator);
+		Trace retval;
+		if (index >= 0) {
+			retval = tracesByID.get(index);
+		} else {
+			retval = null;
+		}
+		return retval;
+	}
+
+	/**
+	 * Locates a trace which has given name
+	 * 
+	 * @param name
+	 *            the trace name
+	 * @return the trace or null
+	 */
+	public Trace findTraceByName(String name) {
+		int index = Collections.binarySearch(tracesByName, name,
+				TraceObjectUtils.traceToNameComparator);
+		Trace retval;
+		if (index >= 0) {
+			retval = tracesByName.get(index);
+		} else {
+			retval = null;
+		}
+		return retval;
+	}
+
+	/**
+	 * Called by the model when a trace property is updated
+	 * 
+	 * @param source
+	 *            the trace that was changed
+	 * @param property
+	 *            the property that was changed
+	 */
+	void tracePropertyUpdated(TraceObject source, int property) {
+		if (property == TraceModelListener.NAME) {
+			Collections.sort(tracesByName,
+					TraceObjectUtils.traceObjectNameComparator);
+		} else if (property == TraceModelListener.ID) {
+			traceIDsUpdated();
+		}
+	}
+
+	/**
+	 * Sorts the trace array based on new ID configuration
+	 */
+	void traceIDsUpdated() {
+		Collections.sort(tracesByID, TraceObjectUtils.traceObjectIDComparator);
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceModel.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,894 @@
+/*
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 model is a collection of trace groups
+*
+*/
+package com.nokia.tracebuilder.model;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.Properties;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.project.FormattingUtils;
+import com.nokia.tracebuilder.project.GroupNameHandlerBase;
+import com.nokia.tracebuilder.source.SourceConstants;
+
+/**
+ * Trace model is a collection of trace groups. Listener interfaces can be
+ * attached to a trace model to receive change notifications when traces are
+ * added, removed or modified.
+ * 
+ */
+public class TraceModel extends TraceObject implements Iterable<TraceGroup> {
+
+	/**
+	 * Group property prefix
+	 */
+	public final String GROUP_PROPERTY_PREFIX = "[GROUP]"; //$NON-NLS-1$
+
+	/**
+	 * Trace property prefix
+	 */
+	public final String TRACE_PROPERTY_PREFIX = "[TRACE]"; //$NON-NLS-1$
+
+	/**
+	 * Obsolete property prefix
+	 */
+	public final String OBSOLETE_PROPERTY_PREFIX = "[[OBSOLETE]]"; //$NON-NLS-1$
+
+	/**
+	 * Group Id prefix
+	 */
+	public final String GROUP_ID_PREFIX = "["; //$NON-NLS-1$
+
+	/**
+	 * Group Id suffix
+	 */
+	public final String GROUP_ID_SUFFIX = "]"; //$NON-NLS-1$	
+
+	/**
+	 * Factory object for creating other trace objects
+	 */
+	private TraceObjectFactory factory;
+
+	/**
+	 * Property verifier interface
+	 */
+	private TraceObjectPropertyVerifier verifier;
+
+	/**
+	 * List of trace groups
+	 */
+	private ArrayList<TraceGroup> groups = new ArrayList<TraceGroup>();
+
+	/**
+	 * List of traces, sorted by name
+	 */
+	private ArrayList<Trace> tracesByName = new ArrayList<Trace>();
+
+	/**
+	 * List of model listeners
+	 */
+	private ArrayList<TraceModelListener> modelListeners = new ArrayList<TraceModelListener>();
+
+	/**
+	 * List of extension listeners
+	 */
+	private ArrayList<TraceModelExtensionListener> extensionListeners = new ArrayList<TraceModelExtensionListener>();
+
+	/**
+	 * List of reset listeners
+	 */
+	private ArrayList<TraceModelResetListener> resetListeners = new ArrayList<TraceModelResetListener>();
+
+	/**
+	 * Processing listeners
+	 */
+	private ArrayList<TraceProcessingListener> processingListeners = new ArrayList<TraceProcessingListener>();
+
+	/**
+	 * List of constant tables
+	 */
+	private ArrayList<TraceConstantTable> constantTables = new ArrayList<TraceConstantTable>();
+
+	/**
+	 * Validity flag
+	 */
+	private boolean valid;
+
+	/**
+	 * Number of nested calls to startProcessing
+	 */
+	private int isProcessing;
+
+	/**
+	 * Model was changed during processing
+	 */
+	private boolean modelChangedDuringProcessing;
+
+	/**
+	 * Hex radix
+	 */
+	public int HEX_RADIX = 16; // CodForChk_Dis_Magic
+
+	/**
+	 * Number of user defined groups
+	 */	
+	private int numberOfUserDefinedGroups = 0;
+	
+	/**
+	 * Constructor
+	 * 
+	 * @param factory
+	 *            the rule factory
+	 * @param verifier
+	 *            the property verifier
+	 */
+	public TraceModel(TraceObjectRuleFactory factory,
+			TraceObjectPropertyVerifier verifier) {
+		// Stored for callback purposes
+		setModel(this);
+		this.factory = new TraceObjectFactory(this, factory);
+		this.verifier = verifier;
+	}
+
+	/**
+	 * Adds a new trace model listener to this model
+	 * 
+	 * @param listener
+	 *            the new listener
+	 */
+	public void addModelListener(TraceModelListener listener) {
+		modelListeners.add(listener);
+	}
+
+	/**
+	 * Removes a trace model listener. Does nothing if the listener is not found
+	 * 
+	 * @param listener
+	 *            the listener to be removed
+	 */
+	public void removeModelListener(TraceModelListener listener) {
+		modelListeners.remove(listener);
+	}
+
+	/**
+	 * Adds a new trace model extension listener to this model
+	 * 
+	 * @param listener
+	 *            the new listener
+	 */
+	public void addExtensionListener(TraceModelExtensionListener listener) {
+		extensionListeners.add(listener);
+	}
+
+	/**
+	 * Removes a trace model extension listener. Does nothing if the listener is
+	 * not found
+	 * 
+	 * @param listener
+	 *            the listener to be removed
+	 */
+	public void removeExtensionListener(TraceModelExtensionListener listener) {
+		extensionListeners.remove(listener);
+	}
+
+	/**
+	 * Adds a new trace model reset listener to this model
+	 * 
+	 * @param listener
+	 *            the new listener
+	 */
+	public void addResetListener(TraceModelResetListener listener) {
+		resetListeners.add(listener);
+	}
+
+	/**
+	 * Removes a trace model reset listener. Does nothing if the listener is not
+	 * found
+	 * 
+	 * @param listener
+	 *            the listener to be removed
+	 */
+	public void removeResetListener(TraceModelResetListener listener) {
+		resetListeners.remove(listener);
+	}
+
+	/**
+	 * Adds a new trace model listener to this model
+	 * 
+	 * @param listener
+	 *            the new listener
+	 */
+	public void addProcessingListener(TraceProcessingListener listener) {
+		processingListeners.add(listener);
+	}
+
+	/**
+	 * Removes a processing listener. Does nothing if the listener is not found
+	 * 
+	 * @param listener
+	 *            the listener to be removed
+	 */
+	public void removeProcessingListener(TraceProcessingListener listener) {
+		processingListeners.remove(listener);
+	}
+
+	/**
+	 * Returns highest group ID + 1. Can be used to create an unique ID for a
+	 * new trace group.
+	 * 
+	 * @return the next trace group ID
+	 * @throws TraceBuilderException
+	 */
+	public int getNextGroupID() throws TraceBuilderException {
+		// Get current max group id in model
+		int maxGroupIdInModel = 0;
+		for (TraceGroup group : groups) {
+			int groupIdInModel = group.getID();
+			if (groupIdInModel > maxGroupIdInModel) {
+				maxGroupIdInModel = groupIdInModel;
+			}
+		}
+		int nextGroupId = maxGroupIdInModel + 1;
+
+		return nextGroupId;
+	}
+
+	/**
+	 * Returns highest constant table ID + 1. Can be used to create an unique ID
+	 * for a new constant table.
+	 * 
+	 * @return the next constant table ID
+	 */
+	public int getNextConstantTableID() {
+		int max = 0;
+		for (TraceConstantTable table : constantTables) {
+			int id = table.getID();
+			if (id > max) {
+				max = id;
+			}
+		}
+		return max + 1;
+	}
+
+	/**
+	 * Removes a trace group from this model. Create groupRemoved event to model
+	 * listeners
+	 * 
+	 * @param group
+	 *            the group to be removed
+	 */
+	public void removeGroup(TraceGroup group) {
+		if (groups.remove(group)) {
+			notifyObjectRemoved(this, group);
+			group.reset();
+			if (!isPredefinedGroup(group.getName())) {
+				decreaseNumberOfUserDefinedGroups();
+			}
+		}
+	}
+
+	/**
+	 * Determines if this model contains any trace groups
+	 * 
+	 * @return true if there are trace groups
+	 */
+	public boolean hasGroups() {
+		return !groups.isEmpty();
+	}
+
+	/**
+	 * Gets the number of trace groups
+	 * 
+	 * @return trace group count
+	 */
+	public int getGroupCount() {
+		return groups.size();
+	}
+
+	/**
+	 * Returns the trace groups of this model
+	 * 
+	 * @return the iterator over the groups
+	 */
+	public Iterator<TraceGroup> getGroups() {
+		return groups.iterator();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Iterable#iterator()
+	 */
+	public Iterator<TraceGroup> iterator() {
+		return groups.iterator();
+	}
+
+	/**
+	 * Removes all trace groups and parameters from this model. Extensions are
+	 * not removed. Notifies the reset listeners with modelResetting and
+	 * modelReset
+	 * 
+	 * @see TraceModelResetListener#modelResetting
+	 * @see TraceModelResetListener#modelReset
+	 */
+	@Override
+	public void reset() {
+		notifyModelResetting();
+		// Properties are removed, other extensions are left
+		removeExtensions(TraceObjectPropertyList.class);
+		groups.clear();
+		tracesByName.clear();
+		constantTables.clear();
+		numberOfUserDefinedGroups = 0;
+		super.reset();
+		notifyModelReset();
+	}
+
+	/**
+	 * Gets the group which has given ID
+	 * 
+	 * @param id
+	 *            the id
+	 * @return group or null
+	 */
+	public TraceGroup findGroupByID(int id) {
+		TraceGroup retval = null;
+		for (TraceGroup group : groups) {
+			if (group.getID() == id) {
+				retval = group;
+				break;
+			}
+		}
+		return retval;
+	}
+
+	/**
+	 * Locates a trace group which has the given name.
+	 * 
+	 * @param name
+	 *            the name of the trace group
+	 * @return the group or null if not found
+	 * @see TraceObject#getName
+	 */
+	public TraceGroup findGroupByName(String name) {
+		TraceGroup retval = null;
+		for (TraceGroup group : groups) {
+			if (group.getName().equals(name)) {
+				retval = group;
+				break;
+			}
+		}
+		return retval;
+	}
+
+	/**
+	 * Locates a trace which has the given name.
+	 * 
+	 * @param name
+	 *            the name of the trace
+	 * @return the trace or null if not found
+	 * @see TraceObject#getName
+	 */
+	public Trace findTraceByName(String name) {
+		Trace retval;
+		int index = Collections.binarySearch(tracesByName, name,
+				TraceObjectUtils.traceToNameComparator);
+		if (index >= 0) {
+			retval = tracesByName.get(index);
+		} else {
+			retval = null;
+		}
+		return retval;
+	}
+
+	/**
+	 * Returns the group at given index
+	 * 
+	 * @param index
+	 *            the group index
+	 * @return the group
+	 */
+	public TraceGroup getGroupAt(int index) {
+		return groups.get(index);
+	}
+
+	/**
+	 * Removes a constant table from this model. Creates objectRemoved event to
+	 * model listeners
+	 * 
+	 * @see TraceModelListener#objectRemoved(TraceObject, TraceObject)
+	 * @param table
+	 *            the table to be removed
+	 */
+	public void removeConstantTable(TraceConstantTable table) {
+		if (constantTables.remove(table)) {
+			notifyObjectRemoved(this, table);
+			table.reset();
+		}
+	}
+
+	/**
+	 * Gets the constant tables of this model
+	 * 
+	 * @return the tables iterator
+	 */
+	public Iterator<TraceConstantTable> getConstantTables() {
+		return constantTables.iterator();
+	}
+
+	/**
+	 * Gets a constant table by ID
+	 * 
+	 * @param id
+	 *            the ID
+	 * @return the table or null
+	 */
+	public TraceConstantTable findConstantTableByID(int id) {
+		TraceConstantTable retval = null;
+		for (TraceConstantTable table : constantTables) {
+			if (table.getID() == id) {
+				retval = table;
+				break;
+			}
+		}
+		return retval;
+	}
+
+	/**
+	 * Gets a constant table by name
+	 * 
+	 * @param tableName
+	 *            the name
+	 * @return the table or null
+	 */
+	public TraceConstantTable findConstantTableByName(String tableName) {
+		TraceConstantTable retval = null;
+		for (TraceConstantTable table : constantTables) {
+			if (table.getName().equals(tableName)) {
+				retval = table;
+				break;
+			}
+		}
+		return retval;
+	}
+
+	/**
+	 * Checks if this model contains constant tables
+	 * 
+	 * @return true if there are constant tables
+	 */
+	public boolean hasConstantTables() {
+		return !constantTables.isEmpty();
+	}
+
+	/**
+	 * Returns the constant table at given index
+	 * 
+	 * @param index
+	 *            the group index
+	 * @return the group
+	 */
+	public TraceConstantTable getConstantTableAt(int index) {
+		return constantTables.get(index);
+	}
+
+	/**
+	 * Adds a new trace group to this model. Creates objectAdded event to model
+	 * listeners. This is only intended to be called from TraceGroup
+	 * constructor, so this is not public.
+	 * 
+	 * @see TraceModelListener#objectAdded(TraceObject, TraceObject)
+	 * @param group
+	 *            the group to be added
+	 */
+	void addGroup(TraceGroup group) {
+		groups.add(group);
+		notifyObjectAdded(this, group);
+	}
+
+	/**
+	 * Adds a constant table to this model. Created objectAdded event to model
+	 * listeners. This is only intended to be called from constant table
+	 * constructor, so this is not public
+	 * 
+	 * @see TraceModelListener#objectAdded(TraceObject, TraceObject)
+	 * @param table
+	 *            the constant table
+	 */
+	void addConstantTable(TraceConstantTable table) {
+		constantTables.add(table);
+		notifyObjectAdded(this, table);
+	}
+
+	/**
+	 * Fires propertiesUpdated event. Called from trace objects when their
+	 * properties change.
+	 * 
+	 * @see TraceModelListener#propertyUpdated(TraceObject, int)
+	 * @param source
+	 *            the object that changed
+	 * @param property
+	 *            the property that changed
+	 */
+	void notifyPropertyUpdated(TraceObject source, int property) {
+		if (source instanceof Trace) {
+			if (property == TraceModelListener.NAME) {
+				Collections.sort(tracesByName,
+						TraceObjectUtils.traceObjectNameComparator);
+			}
+			((Trace) source).getGroup().tracePropertyUpdated(source, property);
+		}
+		for (TraceModelListener l : modelListeners) {
+			l.propertyUpdated(source, property);
+		}
+		modelChangedDuringProcessing = true;
+	}
+
+	/**
+	 * Fires objectAdded event to listeners
+	 * 
+	 * @see TraceModelListener#objectAdded(TraceObject, TraceObject)
+	 * @param owner
+	 *            the owner object
+	 * @param object
+	 *            the object that was added
+	 */
+	void notifyObjectAdded(TraceObject owner, TraceObject object) {
+		// List is sorted when the name is set to the trace
+		if (object instanceof Trace) {
+			tracesByName.add((Trace) object);
+		}
+		for (TraceModelListener l : modelListeners) {
+			l.objectAdded(owner, object);
+		}
+		modelChangedDuringProcessing = true;
+	}
+
+	/**
+	 * Fires objectRemoved event to listeners
+	 * 
+	 * @see TraceModelListener#objectRemoved(TraceObject, TraceObject)
+	 * @param owner
+	 *            the owner object
+	 * @param object
+	 *            the object that was removed
+	 */
+	void notifyObjectRemoved(TraceObject owner, TraceObject object) {
+		if (object instanceof Trace) {
+			int index = Collections.binarySearch(tracesByName, (Trace) object,
+					TraceObjectUtils.traceObjectNameComparator);
+			tracesByName.remove(index);
+		}
+		notifyOnDelete(object);
+		for (TraceModelListener l : modelListeners) {
+			l.objectRemoved(owner, object);
+		}
+		modelChangedDuringProcessing = true;
+	}
+
+	/**
+	 * Notifies that an object creation is complete
+	 * 
+	 * @see TraceModelListener#objectCreationComplete(TraceObject)
+	 * @param object
+	 *            the object
+	 */
+	void notifyObjectCreationComplete(TraceObject object) {
+		for (TraceModelListener l : modelListeners) {
+			l.objectCreationComplete(object);
+		}
+	}
+
+	/**
+	 * Fires modelResetting event to all listeners
+	 * 
+	 * @see TraceModelResetListener#modelResetting()
+	 */
+	private void notifyModelResetting() {
+		for (TraceModelResetListener l : resetListeners) {
+			l.modelResetting();
+		}
+	}
+
+	/**
+	 * Fires modelReset event to all listeners
+	 * 
+	 * @see TraceModelResetListener#modelReset()
+	 */
+	private void notifyModelReset() {
+		for (TraceModelResetListener l : resetListeners) {
+			l.modelReset();
+		}
+	}
+
+	/**
+	 * Fires extensionAdded event. Called from TraceObject when extension is
+	 * added to it
+	 * 
+	 * @see TraceModelExtensionListener#extensionAdded(TraceObject,
+	 *      TraceModelExtension)
+	 * @param object
+	 *            the trace object
+	 * @param extension
+	 *            the new extension
+	 */
+	void notifyExtensionAdded(TraceObject object, TraceModelExtension extension) {
+		for (TraceModelExtensionListener l : extensionListeners) {
+			l.extensionAdded(object, extension);
+		}
+		modelChangedDuringProcessing = true;
+	}
+
+	/**
+	 * Fires extensionRemoved event. Called from TraceObject when extension is
+	 * removed from it
+	 * 
+	 * @see TraceModelExtensionListener#extensionRemoved(TraceObject,
+	 *      TraceModelExtension)
+	 * @param object
+	 *            the object
+	 * @param extension
+	 *            the removed extension
+	 */
+	void notifyExtensionRemoved(TraceObject object,
+			TraceModelExtension extension) {
+		for (TraceModelExtensionListener l : extensionListeners) {
+			l.extensionRemoved(object, extension);
+		}
+		modelChangedDuringProcessing = true;
+	}
+
+	/**
+	 * Gets the validity flag of this model
+	 * 
+	 * @return the validity flag
+	 */
+	public boolean isValid() {
+		return valid;
+	}
+
+	/**
+	 * Sets the validity flag
+	 * 
+	 * @param valid
+	 *            new flag value
+	 */
+	public void setValid(boolean valid) {
+		if (valid != this.valid) {
+			this.valid = valid;
+			for (TraceModelResetListener l : resetListeners) {
+				l.modelValid(valid);
+			}
+		}
+	}
+
+	/**
+	 * Gets the trace object factory
+	 * 
+	 * @return the factory
+	 */
+	public TraceObjectFactory getFactory() {
+		return factory;
+	}
+
+	/**
+	 * Gets the object verifier interface. The verifier should be used before
+	 * updating object properties
+	 * 
+	 * @return the verifier
+	 */
+	public TraceObjectPropertyVerifier getVerifier() {
+		return verifier;
+	}
+
+	/**
+	 * Notifies the process listeners that a process the results in multiple
+	 * listener updates is about to start
+	 */
+	public void startProcessing() {
+		isProcessing++;
+		if (isProcessing == 1) {
+			modelChangedDuringProcessing = false;
+			for (TraceProcessingListener l : processingListeners) {
+				l.processingStarted();
+			}
+		}
+	}
+
+	/**
+	 * Notifies the process listeners that a process the results in multiple
+	 * listener updates has finished
+	 */
+	public void processingComplete() {
+		isProcessing--;
+		if (isProcessing == 0) {
+			for (TraceProcessingListener l : processingListeners) {
+				l.processingComplete(modelChangedDuringProcessing);
+			}
+			modelChangedDuringProcessing = false;
+		}
+	}
+
+	/**
+	 * Checks the state of the processing flag
+	 * 
+	 * @return the processing flag
+	 */
+	public boolean isProcessing() {
+		return isProcessing > 0;
+	}
+
+	/**
+	 * Checks if model has traces
+	 * 
+	 * @return true if there's traces, false if not
+	 */
+	public boolean hasTraces() {
+		boolean retval = false;
+		for (TraceGroup group : groups) {
+			if (group.hasTraces()) {
+				retval = true;
+				break;
+			}
+		}
+		return retval;
+	}
+
+	/**
+	 * Gets group ID from properties
+	 * 
+	 * @param properties
+	 *            the properties
+	 * @param group
+	 *            the group
+	 * @return the group ID
+	 * @throws TraceBuilderException
+	 */
+	public int getGroupID(Properties properties, TraceGroup group)
+			throws TraceBuilderException {
+		String value = properties.getProperty(GROUP_PROPERTY_PREFIX
+				+ group.getName());
+		int id;
+		if (value == null) {
+			// Not found, assign a proper ID
+			id = getNewIdForGroup(group);
+
+		} else {
+			try {
+				id = Integer.decode(value).intValue();
+				TraceGroup traceGroup = findGroupByID(id);
+				if (traceGroup != null && !traceGroup.equals(group)) {
+					// Id already in use, assign a proper ID
+					id = getNewIdForGroup(group);
+				}
+			} catch (NumberFormatException e) {
+				// Corrupted, assign a proper ID
+				id = getNewIdForGroup(group);
+			}
+		}
+		group.internalSetID(id);
+		return id;
+	}
+
+	/**
+	 * Gets a new ID for this group
+	 * 
+	 * @param group
+	 *            the group
+	 * @return a new ID for this group
+	 * @throws TraceBuilderException
+	 */
+	private int getNewIdForGroup(TraceGroup group) throws TraceBuilderException {
+		int id = FormattingUtils.getGroupID(group.getModel(), group.getName());
+		return id;
+	}
+
+	/**
+	 * Saves trace and group identifiers to given properties.
+	 * 
+	 * @param properties
+	 *            the properties to use
+	 */
+	public void saveIDs(Properties properties) {
+		properties.clear();
+		StringBuffer sb = new StringBuffer();
+		for (TraceGroup group : this) {
+			int groupId = group.getID();
+			properties.setProperty(GROUP_PROPERTY_PREFIX + group.getName(),
+					SourceConstants.HEX_PREFIX + Integer.toHexString(groupId));
+			for (Trace trace : group) {
+				int traceId = trace.getID();
+				properties.setProperty(TRACE_PROPERTY_PREFIX
+						+ createTraceName(sb, group, trace),
+						SourceConstants.HEX_PREFIX
+								+ Integer.toHexString(traceId));
+			}
+		}
+	}
+
+	/**
+	 * Merges the group and trace names together
+	 * 
+	 * @param sb
+	 *            the buffer where name is stored
+	 * @param group
+	 *            group
+	 * @param trace
+	 *            trace
+	 * @return the trace name
+	 */
+	public String createTraceName(StringBuffer sb, TraceGroup group, Trace trace) {
+		sb.setLength(0);
+		sb.append(group.getName());
+		sb.append(GROUP_ID_PREFIX);
+		int groupId = group.getID();
+		String groupIdString = SourceConstants.HEX_PREFIX
+				+ Integer.toString(groupId, HEX_RADIX).toUpperCase();
+		sb.append(groupIdString);
+		sb.append(GROUP_ID_SUFFIX);
+		sb.append(SourceConstants.UNDERSCORE);
+		sb.append(trace.getName());
+		return sb.toString();
+	}
+
+	/**
+	 * 
+	 * Get number of user defined groups
+	 * 
+	 * @return the number of user defined groups
+	 */
+	public int getNumberOfUserdefinedGroups() {
+		return numberOfUserDefinedGroups;
+	}
+	
+	/**
+	 * 
+	 * Increase number of user defined groups
+	 */
+	public void increaseNumberOfUserDefinedGroups() {
+		numberOfUserDefinedGroups++;
+	}
+	
+	/**
+	 * 
+	 * Decrease number of user defined groups
+	 */
+	public void decreaseNumberOfUserDefinedGroups() {
+		numberOfUserDefinedGroups--;
+	}
+
+	/**
+	 * Check is group predefined group
+	 * @param name of the group
+	 * @return true if group is predefined group, otherwise false
+	 */
+	public boolean isPredefinedGroup(String name) {
+		boolean isPredefinedGroup = false;
+		GroupNameHandlerBase groupNameHandler = TraceBuilderGlobals.getGroupNameHandler();
+		String[] defaultGroups = groupNameHandler.getDefaultGroups();
+		for (int i = 0; i < defaultGroups.length; i++) {
+			if (name.equals(defaultGroups[i])) {
+				isPredefinedGroup = true;
+				break;
+			}
+		}
+		return isPredefinedGroup;
+	}	
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceModelExtension.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 trace model extensions
+*
+*/
+package com.nokia.tracebuilder.model;
+
+/**
+ * Interface implemented by trace model extensions
+ * 
+ */
+public interface TraceModelExtension {
+
+	/**
+	 * Sets the owner of this extension. Called when extension is added to a
+	 * trace object and called with null when removed from trace object
+	 * 
+	 * @param owner
+	 *            the owning object
+	 */
+	public void setOwner(TraceObject owner);
+
+	/**
+	 * Gets the owner of this extension
+	 * 
+	 * @return the owner
+	 */
+	public TraceObject getOwner();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceModelExtensionListener.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Listener interface for trace model extension notifications
+*
+*/
+package com.nokia.tracebuilder.model;
+
+/**
+ * Listener interface for trace model extension notifications
+ * 
+ */
+public interface TraceModelExtensionListener {
+
+	/**
+	 * Notifies that an extension was added to the trace object
+	 * 
+	 * @param object
+	 *            the object where the extension was added
+	 * @param extension
+	 *            the new extension object
+	 */
+	public void extensionAdded(TraceObject object, TraceModelExtension extension);
+
+	/**
+	 * Notifies that an extension was removed from the trace object
+	 * 
+	 * @param object
+	 *            the object from where the extension was removed
+	 * @param extension
+	 *            the removed extension object
+	 */
+	public void extensionRemoved(TraceObject object,
+			TraceModelExtension extension);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceModelExtensionUpdateListener.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Extension change listener
+*
+*/
+package com.nokia.tracebuilder.model;
+
+/**
+ * Extension change listener
+ * 
+ */
+public interface TraceModelExtensionUpdateListener {
+
+	/**
+	 * Update notification
+	 */
+	public void extensionUpdated();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceModelListener.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Listener interface for trace model change notifications
+*
+*/
+package com.nokia.tracebuilder.model;
+
+/**
+ * Listener interface for trace model change notifications
+ * 
+ */
+public interface TraceModelListener {
+
+	/**
+	 * Object name has been updated
+	 */
+	int NAME = 1;
+
+	/**
+	 * Object ID has been updated
+	 */
+	int ID = 2;
+
+	/**
+	 * Trace text has been updated
+	 */
+	int TRACE = 3;
+
+	/**
+	 * Parameter type has been updated
+	 */
+	int TYPE = 4;
+
+	/**
+	 * Notification which is fired when a trace object has been added
+	 * 
+	 * @param owner
+	 *            the owner of the object
+	 * @param object
+	 *            the object
+	 */
+	public void objectAdded(TraceObject owner, TraceObject object);
+
+	/**
+	 * Notification that is fired a trace object is removed from the model
+	 * 
+	 * @param owner
+	 *            the owner of the object
+	 * @param object
+	 *            the removed object
+	 */
+	public void objectRemoved(TraceObject owner, TraceObject object);
+
+	/**
+	 * Notifies that the one of the properties of an object have been updated
+	 * 
+	 * @param object
+	 *            the object which was updated
+	 * @param property
+	 *            the property that was updated
+	 */
+	public void propertyUpdated(TraceObject object, int property);
+
+	/**
+	 * Notifies that object creation is complete
+	 * 
+	 * @param object
+	 *            the object
+	 */
+	public void objectCreationComplete(TraceObject object);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceModelPersistentExtension.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 trace model extensions that need to store themselves 
+* into persistent storage along with other model elements
+*
+*/
+package com.nokia.tracebuilder.model;
+
+/**
+ * Interface implemented by trace model extensions that need to store themselves
+ * into persistent storage along with other model elements. The storage format
+ * is left to the implementation. When loading, the trace provider calls
+ * TraceObjectFactory.createExtension with the storage name. The object factory
+ * returns an instance of this interface and the provider calls setData to
+ * initialize this.
+ * 
+ */
+public interface TraceModelPersistentExtension extends TraceModelExtension {
+
+	/**
+	 * Gets the name used when storing this extension
+	 * 
+	 * @return the storage name
+	 */
+	public String getStorageName();
+
+	/**
+	 * Gets the data of this extension
+	 * 
+	 * @return the extension data
+	 */
+	public String getData();
+
+	/**
+	 * Sets the data of this extension
+	 * 
+	 * @param data
+	 *            the data
+	 * @return true if extension should be added to model, false if not
+	 */
+	public boolean setData(String data);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceModelResetListener.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Listener interface for trace model reset notifications
+*
+*/
+package com.nokia.tracebuilder.model;
+
+/**
+ * Listener interface for trace model reset notifications
+ * 
+ */
+public interface TraceModelResetListener {
+
+	/**
+	 * Notification that is fired before the model is reset.
+	 */
+	public void modelResetting();
+
+	/**
+	 * Notification that is fired after the model is reset.
+	 */
+	public void modelReset();
+
+	/**
+	 * Validity changed notification
+	 * 
+	 * @param valid
+	 *            the validity changed flag
+	 */
+	public void modelValid(boolean valid);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceModelUpdatableExtension.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Extension that can notify listeners about updates
+*
+*/
+package com.nokia.tracebuilder.model;
+
+/**
+ * Extension that can notify listeners about updates
+ * 
+ */
+public interface TraceModelUpdatableExtension extends TraceModelExtension {
+
+	/**
+	 * Adds an update listener to this extension
+	 * 
+	 * @param listener
+	 *            the listener
+	 */
+	public void addUpdateListener(TraceModelExtensionUpdateListener listener);
+
+	/**
+	 * Removes an update listener from this extension
+	 * 
+	 * @param listener
+	 *            the listener
+	 */
+	public void removeUpdateListener(TraceModelExtensionUpdateListener listener);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceObject.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,270 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 trace model objects
+*
+*/
+package com.nokia.tracebuilder.model;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+/**
+ * Base class for all trace model objects
+ * 
+ */
+public abstract class TraceObject {
+
+	/**
+	 * The extensions can be used by trace providers to associate extra data to
+	 * the object.
+	 */
+	private ArrayList<TraceModelExtension> extensions = new ArrayList<TraceModelExtension>();
+
+	/**
+	 * Object ID.
+	 */
+	private int id;
+
+	/**
+	 * Object name.
+	 */
+	private String name = ""; //$NON-NLS-1$
+
+	/**
+	 * The trace model.
+	 */
+	private TraceModel model;
+
+	/**
+	 * Complete flag
+	 */
+	private boolean complete;
+
+	/**
+	 * Associates this object to a trace model.
+	 * 
+	 * @param model
+	 *            the model where this object belongs to
+	 */
+	void setModel(TraceModel model) {
+		this.model = model;
+	}
+
+	/**
+	 * Returns the trace model this object is associated to.
+	 * 
+	 * @return the trace model
+	 */
+	public TraceModel getModel() {
+		return model;
+	}
+
+	/**
+	 * Sets the ID of this object. Generates propertyUpdated event to model
+	 * listeners if the ID changes
+	 * 
+	 * @see TraceModelListener#propertyUpdated(TraceObject, int)
+	 * @param id
+	 *            the new ID
+	 */
+	public void setID(int id) {
+		if (this.id != id) {
+			this.id = id;
+			model.notifyPropertyUpdated(this, TraceModelListener.ID);
+		}
+	}
+
+	/**
+	 * Sets the ID of this object but does not generate any notifications
+	 * 
+	 * @param id
+	 *            the new ID
+	 */
+	void internalSetID(int id) {
+		this.id = id;
+	}
+
+	/**
+	 * Returns the ID of this object.
+	 * 
+	 * @return the ID
+	 */
+	public int getID() {
+		return id;
+	}
+
+	/**
+	 * Sets the name of this object. Generates propertyUpdated event to model
+	 * listeners if the name changes
+	 * 
+	 * @see TraceModelListener#propertyUpdated(TraceObject, int)
+	 * @param name
+	 *            the new name
+	 */
+	public void setName(String name) {
+		if (name == null) {
+			name = ""; //$NON-NLS-1$
+		}
+		if (!name.equals(this.name)) {
+			this.name = name;
+			model.notifyPropertyUpdated(this, TraceModelListener.NAME);
+		}
+	}
+
+	/**
+	 * Returns the name of this object. This never returns null
+	 * 
+	 * @return the name
+	 */
+	public String getName() {
+		return name;
+	}
+
+	/**
+	 * Adds an extension to this object. Generates extensionAdded event to model
+	 * listeners
+	 * 
+	 * @param extension
+	 *            the new extension
+	 */
+	public void addExtension(TraceModelExtension extension) {
+		if (extension == null) {
+			throw new NullPointerException();
+		}
+		extensions.add(extension);
+		extension.setOwner(this);
+		model.notifyExtensionAdded(this, extension);
+	}
+
+	/**
+	 * Removes an extension from this object. Generates extensionRemoved event
+	 * to model listeners if the extension was actually removed
+	 * 
+	 * @param extension
+	 *            the extension to be removed
+	 */
+	public void removeExtension(TraceModelExtension extension) {
+		if (extensions.remove(extension)) {
+			extension.setOwner(null);
+			model.notifyExtensionRemoved(this, extension);
+		}
+	}
+
+	/**
+	 * Removes all extensions which are of given type
+	 * 
+	 * @param <T>
+	 *            the type of the extension
+	 * @param extClass
+	 *            the extension type
+	 */
+	public <T extends TraceModelExtension> void removeExtensions(
+			Class<T> extClass) {
+		Iterator<TraceModelExtension> itr = extensions.iterator();
+		while (itr.hasNext()) {
+			TraceModelExtension ext = itr.next();
+			if (extClass.isAssignableFrom(ext.getClass())) {
+				itr.remove();
+				ext.setOwner(null);
+				model.notifyExtensionRemoved(this, ext);
+			}
+		}
+	}
+
+	/**
+	 * Returns the first extension which is of given type. The extensions are
+	 * stored in a list in the order they have been added. This returns the
+	 * first instance found from the list.
+	 * 
+	 * @param <T>
+	 *            the type of the extension
+	 * @param extClass
+	 *            the extension type
+	 * @return the extension or null if not found
+	 */
+	@SuppressWarnings("unchecked")
+	public <T extends TraceModelExtension> T getExtension(Class<T> extClass) {
+		T ret = null;
+		for (TraceModelExtension ext : extensions) {
+			if (extClass.isAssignableFrom(ext.getClass())) {
+				ret = (T) ext;
+				break;
+			}
+		}
+		return ret;
+	}
+
+	/**
+	 * Returns the extensions which are of given type.
+	 * 
+	 * @param <T>
+	 *            the type of the extension
+	 * @param extClass
+	 *            the extension type
+	 * @return iterator over the list of extension
+	 */
+	@SuppressWarnings("unchecked")
+	public <T extends TraceModelExtension> Iterator<T> getExtensions(
+			Class<T> extClass) {
+		ArrayList<T> list = new ArrayList<T>();
+		for (TraceModelExtension ext : extensions) {
+			if (extClass.isAssignableFrom(ext.getClass())) {
+				list.add((T) ext);
+			}
+		}
+		return list.iterator();
+	}
+
+	/**
+	 * Resets the ID and name
+	 */
+	void reset() {
+		id = 0;
+		name = ""; //$NON-NLS-1$
+	}
+
+	/**
+	 * Sets the complete flag and fires complete event
+	 */
+	void setComplete() {
+		complete = true;
+		model.notifyObjectCreationComplete(this);
+	}
+
+	/**
+	 * Calls OnDelete rules if the object owns them
+	 * 
+	 * @param object
+	 *            the object that was removed
+	 */
+	protected void notifyOnDelete(TraceObject object) {
+		Iterator<TraceObjectRuleOnDelete> rules = object
+				.getExtensions(TraceObjectRuleOnDelete.class);
+		while (rules.hasNext()) {
+			rules.next().objectDeleted();
+		}
+	}
+
+	/**
+	 * Gets the complete flag
+	 * 
+	 * @return the flag
+	 */
+	public boolean isComplete() {
+		return complete;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceObjectFactory.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,328 @@
+/*
+ * Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ * Creates trace objects and provides configurable rules for trace object creation
+ *
+ */
+package com.nokia.tracebuilder.model;
+
+import java.util.Iterator;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.TraceBuilderErrorCode;
+
+/**
+ * Creates trace objects and provides configurable rules for trace object
+ * creation
+ * 
+ */
+public class TraceObjectFactory {
+
+	/**
+	 * The trace model
+	 */
+	private TraceModel model;
+
+	/**
+	 * Rule factory
+	 */
+	private TraceObjectRuleFactory ruleFactory;
+
+	/**
+	 * Creates a new factory
+	 * 
+	 * @param model
+	 *            the model
+	 * @param factory
+	 *            the rule factory
+	 */
+	TraceObjectFactory(TraceModel model, TraceObjectRuleFactory factory) {
+		this.model = model;
+		this.ruleFactory = factory;
+		processNewObjectRules(model);
+		model.setComplete();
+	}
+
+	/**
+	 * Gets the rule factory
+	 * 
+	 * @return the rule factory
+	 */
+	public TraceObjectRuleFactory getRuleFactory() {
+		return ruleFactory;
+	}
+
+	/**
+	 * Creates a new trace group
+	 * 
+	 * @param id
+	 *            the group ID
+	 * @param name
+	 *            the name for the group
+	 * @param extensions
+	 *            list of extensions to be added to the group
+	 * @return the new group
+	 * @throws TraceBuilderException
+	 */
+	public TraceGroup createTraceGroup(int id, String name,
+			TraceModelExtension[] extensions) throws TraceBuilderException {
+
+		boolean isPredefineGroup = model.isPredefinedGroup(name);
+		if (!isPredefineGroup
+				&& model.getNumberOfUserdefinedGroups() >= TraceBuilderGlobals
+						.getGroupNameHandler()
+						.getMaxNumberOfUserDefinedGroups()) {
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.RUN_OUT_OF_USER_DEFINED_GROUP_IDS,
+					true);
+		}
+
+		TraceGroup group = new TraceGroup(model);
+		group.setID(id);
+		group.setName(name);
+		setExtensions(group, extensions);
+		processNewObjectRules(group);
+		group.setComplete();
+		if (!isPredefineGroup) {
+			model.increaseNumberOfUserDefinedGroups();
+		}
+		return group;
+	}
+
+	/**
+	 * Creates a new trace
+	 * 
+	 * @param group
+	 *            the trace group
+	 * @param id
+	 *            the id for the trace
+	 * @param name
+	 *            the trace name
+	 * @param traceText
+	 *            the trace text
+	 * @param extensions
+	 *            list of extensions to be added to the trace
+	 * @return the new trace
+	 */
+	public Trace createTrace(TraceGroup group, int id, String name,
+			String traceText, TraceModelExtension[] extensions) {
+		Trace trace = new Trace(group);
+		trace.setID(id);
+		trace.setName(name);
+		trace.setTrace(traceText);
+		setExtensions(trace, extensions);
+		processNewObjectRules(trace);
+		trace.setComplete();
+		return trace;
+	}
+
+	/**
+	 * Creates a new trace parameter
+	 * 
+	 * @param trace
+	 *            the trace the parameter is associated to
+	 * @param id
+	 *            the parameter ID
+	 * @param name
+	 *            the parameter name
+	 * @param type
+	 *            parameter type
+	 * @param extensions
+	 *            list of extensions to be added to the parameter
+	 * @return the new parameter
+	 */
+	public TraceParameter createTraceParameter(Trace trace, int id,
+			String name, String type, TraceModelExtension[] extensions) {
+		TraceParameter parameter = new TraceParameter(trace);
+		initializeParameter(parameter, id, name, type, extensions);
+		return parameter;
+	}
+
+	/**
+	 * Creates a new trace parameter inserting it into the specified index
+	 * 
+	 * @param objectIndex
+	 *            the index for the object
+	 * @param trace
+	 *            the trace the parameter is associated to
+	 * @param id
+	 *            the parameter ID
+	 * @param name
+	 *            the parameter name
+	 * @param type
+	 *            parameter type
+	 * @param extensions
+	 *            list of extensions to be added to the parameter
+	 * @return the new parameter
+	 */
+	public TraceParameter createTraceParameter(int objectIndex, Trace trace,
+			int id, String name, String type, TraceModelExtension[] extensions) {
+		TraceParameter parameter = new TraceParameter(trace, objectIndex);
+		initializeParameter(parameter, id, name, type, extensions);
+		return parameter;
+	}
+
+	/**
+	 * Initializes a parameter
+	 * 
+	 * @param parameter
+	 *            the parameter
+	 * @param id
+	 *            the parameter ID
+	 * @param name
+	 *            the parameter name
+	 * @param type
+	 *            parameter type
+	 * @param extensions
+	 *            list of extensions to be added to the parameter
+	 */
+	private void initializeParameter(TraceParameter parameter, int id,
+			String name, String type, TraceModelExtension[] extensions) {
+		parameter.setID(id);
+		parameter.setName(name);
+		parameter.setType(type);
+		setExtensions(parameter, extensions);
+		processNewObjectRules(parameter);
+		parameter.setComplete();
+	}
+
+	/**
+	 * Creates a new constant table
+	 * 
+	 * @param id
+	 *            id for the table
+	 * @param typeName
+	 *            the name for the table
+	 * @param extensions
+	 *            list of extensions to be added to the table
+	 * @return the constant table
+	 */
+	public TraceConstantTable createConstantTable(int id, String typeName,
+			TraceModelExtension[] extensions) {
+		TraceConstantTable table = new TraceConstantTable(model);
+		table.setID(id);
+		table.setName(typeName);
+		setExtensions(table, extensions);
+		processNewObjectRules(table);
+		table.setComplete();
+		for (TraceGroup group : model) {
+			for (Trace trace : group) {
+				for (TraceParameter param : trace) {
+					if (param.getType().equals(typeName)) {
+						table.addParameterReference(param);
+					}
+				}
+			}
+		}
+		return table;
+	}
+
+	/**
+	 * Creates a new constant table entry
+	 * 
+	 * @param table
+	 *            constant table
+	 * @param id
+	 *            id for the entry
+	 * @param value
+	 *            value for the entry
+	 * @param extensions
+	 *            list of extensions to be added to the constant
+	 * @return the constant table entry
+	 */
+	public TraceConstantTableEntry createConstantTableEntry(
+			TraceConstantTable table, int id, String value,
+			TraceModelExtension[] extensions) {
+		TraceConstantTableEntry entry = new TraceConstantTableEntry(table);
+		entry.setID(id);
+		entry.setName(value);
+		setExtensions(entry, extensions);
+		processNewObjectRules(entry);
+		entry.setComplete();
+		return entry;
+	}
+
+	/**
+	 * Creates an extension based on its name. This does not add the extension
+	 * to the object, since the setData method should be called first
+	 * 
+	 * @param object
+	 *            the target object for the extension
+	 * @param name
+	 *            the extension name
+	 * @return the created extension
+	 */
+	public TraceModelPersistentExtension createExtension(TraceObject object,
+			String name) {
+		return ruleFactory.createExtension(object, name);
+	}
+
+	/**
+	 * Adds extensions to given object
+	 * 
+	 * @param object
+	 *            the object
+	 * @param extensions
+	 *            extensions to be added
+	 */
+	private void setExtensions(TraceObject object,
+			TraceModelExtension[] extensions) {
+		if (extensions != null) {
+			for (TraceModelExtension element : extensions) {
+				object.addExtension(element);
+			}
+		}
+	}
+
+	/**
+	 * Processes the rules of a new object
+	 * 
+	 * @param object
+	 *            the object to be processed
+	 */
+	private void processNewObjectRules(TraceObject object) {
+		// Calls the factory to preprocess the extensions passed to
+		// create-function
+		ruleFactory.preProcessNewRules(object);
+		// The rules may contain object creation rules
+		Iterator<TraceObjectRule> rules = object
+				.getExtensions(TraceObjectRule.class);
+		while (rules.hasNext()) {
+			TraceObjectRule rule = rules.next();
+			if (rule instanceof TraceObjectRuleCreateObject) {
+				TraceObjectRuleCreateObject createRule = (TraceObjectRuleCreateObject) rule;
+				createRule.createObject();
+			}
+		}
+		// Some rules are removed after the objects have been created
+		Iterator<TraceObjectRuleRemoveOnCreate> itr;
+		boolean changed;
+		do {
+			changed = false;
+			itr = object.getExtensions(TraceObjectRuleRemoveOnCreate.class);
+			while (itr.hasNext() && !changed) {
+				TraceObjectRuleRemoveOnCreate ext = itr.next();
+				if (ext.canBeRemoved()) {
+					object.removeExtension(ext);
+					changed = true;
+				}
+			}
+		} while (changed);
+		// After processing is complete, the rule factory is used to do
+		// post-processing
+		ruleFactory.postProcessNewRules(object);
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceObjectModifier.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Modifier properties is returned by one of the TraceObjectUtils.modify methods
+*
+*/
+package com.nokia.tracebuilder.model;
+
+/**
+ * Modifier properties is returned by one of the TraceObjectUtils.modify
+ * methods.
+ * 
+ */
+public interface TraceObjectModifier {
+
+	/**
+	 * Gets the data
+	 * 
+	 * @return the data
+	 */
+	public String getData();
+
+	/**
+	 * Checks if the data was changed during the modify call
+	 * 
+	 * @return true if data was changed
+	 */
+	public boolean hasChanged();
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceObjectProperty.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 associated with a trace object
+*
+*/
+package com.nokia.tracebuilder.model;
+
+/**
+ * Property associated with a trace object
+ * 
+ */
+public interface TraceObjectProperty {
+
+	/**
+	 * Gets the name of the property
+	 * 
+	 * @return the name
+	 */
+	public String getName();
+
+	/**
+	 * Gets the value of the property
+	 * 
+	 * @return the value
+	 */
+	public String getValue();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceObjectPropertyList.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* List of properties associated to a trace object
+*
+*/
+package com.nokia.tracebuilder.model;
+
+/**
+ * List of properties associated to a trace object
+ * 
+ */
+public interface TraceObjectPropertyList extends TraceModelExtension,
+		Iterable<TraceObjectProperty> {
+
+	/**
+	 * Gets a property by name
+	 * 
+	 * @param name
+	 *            the property name
+	 * @return the property
+	 */
+	public TraceObjectProperty getProperty(String name);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceObjectPropertyVerifier.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,143 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 verifier interface for trace objects
+*
+*/
+package com.nokia.tracebuilder.model;
+
+/**
+ * Content verifier interface for trace objects
+ * 
+ */
+public interface TraceObjectPropertyVerifier {
+
+	/**
+	 * Checks the properties of a trace before it is created or modified
+	 * 
+	 * @param group
+	 *            the group for the trace
+	 * @param trace
+	 *            trace to be modified. If creating new, this is null
+	 * @param id
+	 *            the trace ID
+	 * @param name
+	 *            the name of the trace
+	 * @param data
+	 *            the trace data
+	 * @throws TraceBuilderException
+	 *             if properties are not valid. The error code from the
+	 *             exception is used to create an error dialog
+	 */
+	public void checkTraceProperties(TraceGroup group, Trace trace, int id,
+			String name, String data) throws TraceBuilderException;
+
+	/**
+	 * Checks the properties of a trace group before it is created or modified
+	 * 
+	 * @param owner
+	 *            the model owning the trace group
+	 * @param group
+	 *            group to be modified. If creating new, this is null
+	 * @param id
+	 *            the trace ID
+	 * @param name
+	 *            the name of the trace
+	 * @throws TraceBuilderException
+	 *             if properties are not valid. The error code from the
+	 *             exception is used to create an error dialog
+	 */
+	public void checkTraceGroupProperties(TraceModel owner, TraceGroup group,
+			int id, String name) throws TraceBuilderException;
+
+	/**
+	 * Checks the properties of a parameter before it is created or modified
+	 * 
+	 * @param owner
+	 *            the parameter owner
+	 * @param parameter
+	 *            parameter to be modified. If creating new, this is null
+	 * @param id
+	 *            the parameter ID
+	 * @param name
+	 *            the name of the parameter
+	 * @param type
+	 *            the type of the parameter
+	 * @throws TraceBuilderException
+	 *             if properties are not valid. The error code from the
+	 *             exception is used to create an error dialog
+	 */
+	public void checkTraceParameterProperties(Trace owner,
+			TraceParameter parameter, int id, String name, String type)
+			throws TraceBuilderException;
+
+	/**
+	 * Checks the properties of a constant table before it is created or
+	 * modified
+	 * 
+	 * @param owner
+	 *            the model owning the constant table
+	 * @param table
+	 *            the table to be changed. If creating new, this is null
+	 * @param id
+	 *            the ID of the table
+	 * @param tableName
+	 *            the name of the table
+	 * @throws TraceBuilderException
+	 *             if properties are not valid. The error code from the
+	 *             exception is used to create an error dialog
+	 */
+	public void checkConstantTableProperties(TraceModel owner,
+			TraceConstantTable table, int id, String tableName)
+			throws TraceBuilderException;
+
+	/**
+	 * Checks the properties of a constant table entry before it is created
+	 * 
+	 * @param table
+	 *            the constant table
+	 * @param entry
+	 *            the entry to be modified. If creating new, this is null
+	 * @param id
+	 *            the ID for the new entry
+	 * @param value
+	 *            the value for the new entry
+	 * @throws TraceBuilderException
+	 *             if properties are not valid. The error code from the
+	 *             exception is used to create an error dialog
+	 */
+	public void checkConstantProperties(TraceConstantTable table,
+			TraceConstantTableEntry entry, int id, String value)
+			throws TraceBuilderException;
+
+	/**
+	 * Checks the properties of trace model before it is modified
+	 * 
+	 * @param model
+	 *            the trace model
+	 * @param id
+	 *            the model ID
+	 * @param name
+	 *            the model name
+	 * @param path
+	 *            the model path
+	 * @throws TraceBuilderException
+	 *             if properties are not valid. The error code from the
+	 *             exception is used to create an error dialog
+	 */
+	public void checkTraceModelProperties(TraceModel model, int id,
+			String name, String path) throws TraceBuilderException;
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceObjectRule.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 interface for trace model object processing rules
+*
+*/
+package com.nokia.tracebuilder.model;
+
+/**
+ * Base interface for trace model object processing rules
+ * 
+ */
+public interface TraceObjectRule extends TraceModelExtension {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceObjectRuleCreateObject.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Rule for automatic object creation
+*
+*/
+package com.nokia.tracebuilder.model;
+
+/**
+ * Rule for automatic object creation
+ * 
+ */
+public interface TraceObjectRuleCreateObject extends TraceObjectRule {
+
+	/**
+	 * Called to create a new object into the owner of this rule
+	 */
+	public void createObject();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceObjectRuleFactory.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Creates trace objects and provides configurable rules for trace object creation
+*
+*/
+package com.nokia.tracebuilder.model;
+
+/**
+ * Allows registration of rules into the trace object factory
+ * 
+ */
+public interface TraceObjectRuleFactory {
+
+	/**
+	 * Called before the rules of a new object are processed by object factory
+	 * 
+	 * @param object
+	 *            new object
+	 */
+	public void preProcessNewRules(TraceObject object);
+
+	/**
+	 * Called after the rules of a new object are processed by object factory
+	 * 
+	 * @param object
+	 *            new object
+	 */
+	public void postProcessNewRules(TraceObject object);
+
+	/**
+	 * Creates an extension based on extension name
+	 * 
+	 * @param object
+	 *            the target object
+	 * @param name
+	 *            the name of the extension
+	 * @return the new extension
+	 */
+	public TraceModelPersistentExtension createExtension(TraceObject object,
+			String name);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceObjectRuleOnDelete.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Rule to perform processing when object is deleted
+*
+*/
+package com.nokia.tracebuilder.model;
+
+/**
+ * Rule to perform processing when object is deleted
+ * 
+ */
+public interface TraceObjectRuleOnDelete extends TraceObjectRule {
+
+	/**
+	 * Called when the object that owns this rule is deleted
+	 */
+	public void objectDeleted();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceObjectRuleRemoveOnCreate.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Extension that is removed from the object after it has been created
+*
+*/
+package com.nokia.tracebuilder.model;
+
+/**
+ * Extension that is removed from the object after it has been created
+ * 
+ */
+public interface TraceObjectRuleRemoveOnCreate extends TraceObjectRule {
+
+	/**
+	 * Returns true if this rule can be removed
+	 * 
+	 * @return true if remove, false otherwise
+	 */
+	public boolean canBeRemoved();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceObjectUtils.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,315 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Utility functions for checking properties of trace objects
+*
+*/
+package com.nokia.tracebuilder.model;
+
+import java.util.Comparator;
+
+/**
+ * Utility functions for checking properties of trace objects.
+ * 
+ */
+public class TraceObjectUtils {
+
+	/**
+	 * Compares a trace to trace ID
+	 */
+	static Comparator<Object> traceToIDComparator = new Comparator<Object>() {
+
+		/**
+		 * Compares a trace to trace name
+		 * 
+		 * @param t1
+		 *            the trace
+		 * @param t2
+		 *            the trace name
+		 * @return the comparison result
+		 */
+		public int compare(Object t1, Object t2) {
+			int n1 = ((Trace) t1).getID();
+			int n2 = (Integer) t2;
+			return n1 > n2 ? 1 : n1 < n2 ? -1 : 0;
+		}
+
+	};
+
+	/**
+	 * Compares a trace to trace name
+	 */
+	static Comparator<Object> traceToNameComparator = new Comparator<Object>() {
+
+		/**
+		 * Compares a trace to trace name
+		 * 
+		 * @param t1
+		 *            the trace
+		 * @param t2
+		 *            the trace name
+		 * @return the comparison result
+		 */
+		public int compare(Object t1, Object t2) {
+			String n1 = ((Trace) t1).getName();
+			String n2 = (String) t2;
+			if (n1 == null) {
+				n1 = ""; //$NON-NLS-1$
+			}
+			if (n2 == null) {
+				n2 = ""; //$NON-NLS-1$
+			}
+			return n1.compareTo(n2);
+		}
+
+	};
+
+	/**
+	 * Compares a trace to trace text
+	 */
+	static Comparator<Object> traceToTextComparator = new Comparator<Object>() {
+
+		/**
+		 * Compares a trace to trace text
+		 * 
+		 * @param t1
+		 *            the trace
+		 * @param t2
+		 *            the trace text
+		 * @return the comparison result
+		 */
+		public int compare(Object t1, Object t2) {
+			String n1 = ((Trace) t1).getTrace();
+			String n2 = (String) t2;
+			if (n1 == null) {
+				n1 = ""; //$NON-NLS-1$
+			}
+			if (n2 == null) {
+				n2 = ""; //$NON-NLS-1$
+			}
+			return n1.compareTo(n2);
+		}
+
+	};
+
+	/**
+	 * Compares trace objects by ID
+	 */
+	static Comparator<TraceObject> traceObjectIDComparator = new Comparator<TraceObject>() {
+
+		/**
+		 * Compares ID's of trace objects
+		 * 
+		 * @param t1
+		 *            trace 1
+		 * @param t2
+		 *            trace 2
+		 * @return the comparison result
+		 */
+		public int compare(TraceObject t1, TraceObject t2) {
+			int n1 = t1.getID();
+			int n2 = t2.getID();
+			return n1 > n2 ? 1 : n1 < n2 ? -1 : 0;
+		}
+
+	};
+
+	/**
+	 * Compares trace objects by name
+	 */
+	static Comparator<TraceObject> traceObjectNameComparator = new Comparator<TraceObject>() {
+
+		/**
+		 * Compares names of trace objects
+		 * 
+		 * @param t1
+		 *            trace 1
+		 * @param t2
+		 *            trace 2
+		 * @return the comparison result
+		 */
+		public int compare(TraceObject t1, TraceObject t2) {
+			String n1 = t1.getName();
+			String n2 = t2.getName();
+			if (n1 == null) {
+				n1 = ""; //$NON-NLS-1$
+			}
+			if (n2 == null) {
+				n2 = ""; //$NON-NLS-1$
+			}
+			return n1.compareTo(n2);
+		}
+
+	};
+
+	/**
+	 * Prevents construction
+	 */
+	private TraceObjectUtils() {
+	}
+
+	/**
+	 * Checks if group name is already in use and changes if it is. The group
+	 * name is constructed by merging <code>prefix</code>, <code>base</code>
+	 * and <code>postfix</code> together. If a group with the name already
+	 * exists, a integer value starting from 1 is added to the <code>base</code>
+	 * and the name is re-constructed. The integer value is incremented until a
+	 * matching group is not found.
+	 * 
+	 * @param model
+	 *            the trace model
+	 * @param name
+	 *            the group name
+	 * @return the modifier interface
+	 */
+	public static TraceObjectModifier modifyDuplicateGroupName(
+			TraceModel model, String name) {
+		DuplicateGroupNameModifier modifier = new DuplicateGroupNameModifier(
+				model, name);
+		modifier.processName();
+		return modifier;
+	}
+
+	/**
+	 * Checks if trace name is already in use and changes if it is.
+	 * 
+	 * @param group
+	 *            the trace group to be checked
+	 * @param name
+	 *            the trace name
+	 * @return the modifier interface
+	 */
+	public static TraceObjectModifier modifyDuplicateTraceName(
+			TraceGroup group, String name) {
+		DuplicateTraceNameModifier modifier = new DuplicateTraceNameModifier(
+				group, name);
+		modifier.processName();
+		return modifier;
+	}
+
+	/**
+	 * Checks if trace name is already in use globally and changes if it is.
+	 * 
+	 * @param model
+	 *            the trace model
+	 * @param name
+	 *            the trace name
+	 * @return the modifier interface
+	 */
+	public static TraceObjectModifier modifyDuplicateTraceName(
+			TraceModel model, String name) {
+		DuplicateTraceNameModifier modifier = new DuplicateTraceNameModifier(
+				model, name);
+		modifier.processName();
+		return modifier;
+	}
+
+	/**
+	 * Checks if trace parameter name is already in use and changes if it is.
+	 * 
+	 * @param owner
+	 *            the owner of the parameter
+	 * @param name
+	 *            the parameter name
+	 * @return the modifier interface
+	 */
+	public static TraceObjectModifier modifyDuplicateParameterName(Trace owner,
+			String name) {
+		DuplicateParameterNameModifier modifier = new DuplicateParameterNameModifier(
+				owner, name);
+		modifier.processName();
+		return modifier;
+	}
+
+	/**
+	 * Checks if constant table name is already in use and changes if it is
+	 * 
+	 * @param model
+	 *            the trace model
+	 * @param name
+	 *            the table name
+	 * @return the modified name
+	 */
+	public static TraceObjectModifier modifyDuplicateConstantTableName(
+			TraceModel model, String name) {
+		DuplicateConstantTableNameModifier modifier = new DuplicateConstantTableNameModifier(
+				model, name);
+		modifier.processName();
+		return modifier;
+	}
+
+	/**
+	 * Checks if constant table entry name is already in use and changes if it
+	 * is.
+	 * 
+	 * @param table
+	 *            the constant table owning the entry
+	 * @param name
+	 *            the constant table entry name
+	 * @return the modifier interface
+	 */
+	public static TraceObjectModifier modifyDuplicateConstantName(
+			TraceConstantTable table, String name) {
+		DuplicateConstantNameModifier modifier = new DuplicateConstantNameModifier(
+				table, name);
+		modifier.processName();
+		return modifier;
+	}
+
+	/**
+	 * Gets the duplicate modifier from given text
+	 * 
+	 * @param text
+	 *            the text
+	 * @return the duplicate modifier
+	 */
+	public static String removeDuplicateModifier(String text) {
+		String retval;
+		String s = DuplicateValueModifier.getModifier(text);
+		if (s != null) {
+			retval = text.substring(s.length());
+		} else {
+			retval = text;
+		}
+		return retval;
+	}
+
+	/**
+	 * Finds a property from a trace object. This returns an empty string if not
+	 * found
+	 * 
+	 * @param object
+	 *            the object
+	 * @param name
+	 *            the property name
+	 * @return the property value
+	 */
+	public static String findProperty(TraceObject object, String name) {
+		String retval = null;
+		TraceObjectPropertyList propertyList = object
+				.getExtension(TraceObjectPropertyList.class);
+		if (propertyList != null) {
+			TraceObjectProperty property = propertyList.getProperty(name);
+			if (property != null) {
+				retval = property.getValue();
+			}
+		}
+		if (retval == null) {
+			retval = ""; //$NON-NLS-1$
+		}
+		return retval;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceParameter.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,248 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* All trace objects may contain parameters
+*
+*/
+package com.nokia.tracebuilder.model;
+
+/**
+ * Traces may contain parameters
+ * 
+ */
+public class TraceParameter extends TraceObject {
+
+	/**
+	 * The type of this parameter
+	 */
+	private String type;
+
+	/**
+	 * Hexadecimal (%p), pointer type
+	 */
+	public static final String POINTER = "void*"; //$NON-NLS-1$
+	
+	/**
+	 * Signed decimal (%d), 32-bit type
+	 */
+	public static final String SDEC32 = "int32"; //$NON-NLS-1$
+
+	/**
+	 * Hexadecimal (%x), 32-bit type
+	 */
+	public static final String HEX32 = "hex32"; //$NON-NLS-1$
+
+	/**
+	 * Unsigned decimal (%u), 32-bit type
+	 */
+	public static final String UDEC32 = "uint32"; //$NON-NLS-1$
+	
+	/**
+	 * Octal (%o), 32-bit type
+	 */
+	public static final String OCT32 = "oct32"; //$NON-NLS-1$	
+
+	/**
+	 * Signed decimal (%hd), 16-bit type
+	 */
+	public static final String SDEC16 = "int16"; //$NON-NLS-1$
+
+	/**
+	 * Hexadecimal (%hx), 16-bit type
+	 */
+	public static final String HEX16 = "hex16"; //$NON-NLS-1$
+
+	/**
+	 * Unsigned decimal (%hu), 16-bit type
+	 */
+	public static final String UDEC16 = "uint16"; //$NON-NLS-1$
+	
+	/**
+	 * Octal (%ho), 16-bit type
+	 */
+	public static final String OCT16 = "oct16"; //$NON-NLS-1$	
+
+	/**
+	 * Signed decimal (%hhd), 8-bit type
+	 */
+	public static final String SDEC8 = "int8"; //$NON-NLS-1$
+
+	/**
+	 * Hexadecimal (%hhx), 8-bit type
+	 */
+	public static final String HEX8 = "hex8"; //$NON-NLS-1$
+
+	/**
+	 * Unsigned decimal (%hhu), 8-bit type
+	 */
+	public static final String UDEC8 = "uint8"; //$NON-NLS-1$
+	
+	/**
+	 * Octal (%hho), 8-bit type
+	 */
+	public static final String OCT8 = "oct8"; //$NON-NLS-1$
+
+	/**
+	 * Signed decimal (%ld), 64-bit type
+	 */
+	public static final String SDEC64 = "int64"; //$NON-NLS-1$
+
+	/**
+	 * Time, 64-bit type
+	 */
+	public static final String TIME = "time"; //$NON-NLS-1$	
+	
+	/**
+	 * Hexadecimal (%lx), 64-bit type
+	 */
+	public static final String HEX64 = "hex64"; //$NON-NLS-1$
+
+	/**
+	 * Unsigned decimal (%lu), 64-bit type
+	 */
+	public static final String UDEC64 = "uint64"; //$NON-NLS-1$
+	
+	/**
+	 * Octal (%lo), 64-bit type
+	 */
+	public static final String OCT64 = "oct64"; //$NON-NLS-1$	
+
+	/**
+	 * Ascii string (%s) type
+	 */
+	public static final String ASCII = "ascii"; //$NON-NLS-1$
+
+	/**
+	 * Unicode string (%S) type
+	 */
+	public static final String UNICODE = "unicode"; //$NON-NLS-1$
+
+	/**
+	 * Fixed floating point (%f), 64-bit
+	 */
+	public static final String FLOAT_FIX = "ffix"; //$NON-NLS-1$
+
+	/**
+	 * Exponent floating point (%e), 64-bit
+	 */
+	public static final String FLOAT_EXP = "fexp"; //$NON-NLS-1$
+
+	/**
+	 * Fixed / exponential floating point (%g), 64-bit
+	 */
+	public static final String FLOAT_OPT = "fopt"; //$NON-NLS-1$
+
+	/**
+	 * The trace this parameter belongs to
+	 */
+	private Trace owner;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param owner
+	 *            the object owning this parameter
+	 */
+	public TraceParameter(Trace owner) {
+		setModel(owner.getModel());
+		owner.addParameter(this);
+		this.owner = owner;
+	}
+
+	/**
+	 * Constructor, which inserts the parameter into specified index
+	 * 
+	 * @param owner
+	 *            the object owning this parameter
+	 * @param index
+	 *            the parameter index
+	 */
+	TraceParameter(Trace owner, int index) {
+		setModel(owner.getModel());
+		owner.insertParameter(index, this);
+		this.owner = owner;
+	}
+
+	/**
+	 * Gets the trace this parameter is associated to.
+	 * 
+	 * @return the trace
+	 */
+	public Trace getTrace() {
+		return owner;
+	}
+
+	/**
+	 * Sets the parameter type. Generates propertyUpdated event to model
+	 * listeners if type changes
+	 * 
+	 * @see TraceModelListener#propertyUpdated(TraceObject, int)
+	 * @param type
+	 *            the parameter type
+	 */
+	public void setType(String type) {
+		if (!type.equals(this.type)) {
+			removeTableReference();
+			this.type = type;
+			addTableReference();
+			getModel().notifyPropertyUpdated(this, TraceModelListener.TYPE);
+		}
+	}
+
+	/**
+	 * Gets the parameter type
+	 * 
+	 * @return the parameter type
+	 */
+	public String getType() {
+		return type;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceObject#reset()
+	 */
+	@Override
+	void reset() {
+		removeTableReference();
+		super.reset();
+	}
+
+	/**
+	 * Adds a constant table reference
+	 */
+	private void addTableReference() {
+		if (type != null) {
+			TraceConstantTable table = getModel().findConstantTableByName(type);
+			if (table != null) {
+				table.addParameterReference(this);
+			}
+		}
+	}
+
+	/**
+	 * Removes the constant table reference
+	 */
+	private void removeTableReference() {
+		if (type != null) {
+			TraceConstantTable table = getModel().findConstantTableByName(type);
+			if (table != null) {
+				table.removeParameterReference(this);
+			}
+		}
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/TraceProcessingListener.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Multi-update optimization
+*
+*/
+package com.nokia.tracebuilder.model;
+
+/**
+ * Callback interface which should be notified when performing multiple updates
+ * to the trace model. The implementation of TraceModelListener can also
+ * implement this interface to avoid performing unnecessary updates.
+ * 
+ */
+public interface TraceProcessingListener {
+
+	/**
+	 * Called when a sequence of trace model updates is about to start
+	 */
+	public void processingStarted();
+
+	/**
+	 * Called when a sequence of trace model updates has finished
+	 * 
+	 * @param changed
+	 *            true if the model was changed while processing, false if not
+	 */
+	public void processingComplete(boolean changed);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/model/package.html	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,3 @@
+<html><body>
+Contains the model of Trace Builder
+</body></html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/package.html	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,3 @@
+<html><body>
+TraceBuilder engine Eclipse plug-in
+</body></html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/plugin/TraceAPIFormatter.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,102 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 API formatter plug-in
+*
+*/
+package com.nokia.tracebuilder.plugin;
+
+/**
+ * Trace API formatter plug-in
+ * 
+ */
+public interface TraceAPIFormatter {
+
+	/**
+	 * Formatting types for traces
+	 * 
+	 */
+	public enum TraceFormatType {
+
+		/**
+		 * Format for normal trace which does not need extension function
+		 */
+		NORMAL_TRACE,
+
+		/**
+		 * Format for calling an extension function from source file
+		 */
+		COMPLEX_TRACE,
+
+		/**
+		 * Format for extension function header
+		 */
+		HEADER,
+
+		/**
+		 * Format for trace buffer function. Added to extension function
+		 * definition if trace contains more data than is supported by the API
+		 */
+		TRACE_BUFFER,
+
+		/**
+		 * Format for trace function if the extension function parameters can be
+		 * packed into normal trace API call. For example, if the extension
+		 * function takes 4 8-bit arguments, they are packed into a single
+		 * 32-bit parameter
+		 */
+		TRACE_PACKED,
+
+		/**
+		 * Format for trace activation check function. Added to extension
+		 * function definition
+		 */
+		TRACE_ACTIVATION,
+
+		/**
+		 * Empty declaration for an extension function header
+		 */
+		EMPTY_MACRO,
+
+		/**
+		 * Include that is added to source
+		 */
+		INCLUDE_FORMAT
+	}
+
+	/**
+	 * Gets the name of this formatter
+	 * 
+	 * @return the name
+	 */
+	public String getName();
+
+	/**
+	 * Gets the title shown in the API selection preferences dialog
+	 * 
+	 * @return the title
+	 */
+	public String getTitle();
+
+	/**
+	 * Gets the trace format based on format type
+	 * 
+	 * @param type
+	 *            the format type
+	 * @return the trace format
+	 */
+	public String getTraceFormat(TraceFormatType type);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/plugin/TraceAPIParser.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,60 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 API parser plug-in
+*
+*/
+package com.nokia.tracebuilder.plugin;
+
+import com.nokia.tracebuilder.engine.TraceLocation;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.TraceBuilderErrorCode;
+
+/**
+ * Trace API parser plug-in
+ * 
+ */
+public interface TraceAPIParser {
+
+	/**
+	 * Gets the tag to be located from source
+	 * 
+	 * @return the tag
+	 */
+	public String getSourceTag();
+
+	/**
+	 * Gets the list of suffixes that are allowed with the source tag
+	 * 
+	 * @return the suffixes
+	 */
+	public String[] getTagSuffixes();
+
+	/**
+	 * Verifies the validity of given location
+	 * 
+	 * @param location
+	 *            the location to be checked
+	 * @return error code from TraceBuilderErrorCodes
+	 */
+	public TraceBuilderErrorCode checkLocationValidity(TraceLocation location);
+
+	/**
+	 * Gets the name of the group where locations created by this parser belong
+	 * 
+	 * @return the location group
+	 */
+	public String getLocationGroup();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/plugin/TraceAPIPlugin.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 which provides trace API extensions
+*
+*/
+package com.nokia.tracebuilder.plugin;
+
+/**
+ * Plug-in which provides trace API extensions
+ * 
+ */
+public interface TraceAPIPlugin extends TraceBuilderPlugin {
+
+	/**
+	 * Gets the list of trace API formatters
+	 * 
+	 * @return the formatters
+	 */
+	public TraceAPIFormatter[] getFormatters();
+
+	/**
+	 * Gets the list of trace API parsers
+	 * 
+	 * @return the parsers
+	 */
+	public TraceAPIParser[] getParsers();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/plugin/TraceBuilderExport.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 plug-in interface for trace projects
+*
+*/
+package com.nokia.tracebuilder.plugin;
+
+import com.nokia.tracebuilder.model.TraceBuilderException;
+
+/**
+ * Export plug-in interface for trace projects.
+ * 
+ */
+public interface TraceBuilderExport extends TraceBuilderPlugin {
+
+	/**
+	 * Exports the trace project. This is called when the user selects the
+	 * export action from the menu
+	 * 
+	 * @throws TraceBuilderException
+	 *             if export fails
+	 */
+	public void exportTraceProject() throws TraceBuilderException;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/plugin/TraceBuilderImport.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Provides support to import a project file into TraceBuilder
+*
+*/
+package com.nokia.tracebuilder.plugin;
+
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceModel;
+
+/**
+ * Provides support to import a project file into TraceBuilder
+ * 
+ */
+public interface TraceBuilderImport extends TraceBuilderPlugin {
+
+	/**
+	 * Gets the file extensions for this import plug-in. These are used as file
+	 * filter in query dialog.
+	 * 
+	 * @return the file extensions
+	 */
+	public String[] getFileExtensions();
+
+	/**
+	 * Imports a trace project
+	 * 
+	 * @param model
+	 *            the trace model to be updated
+	 * @param file
+	 *            the file to be opened
+	 * @throws TraceBuilderException
+	 *             if opening fails
+	 */
+	public void importTraceProject(TraceModel model, String file)
+			throws TraceBuilderException;
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/plugin/TraceBuilderPlugin.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* TraceBuilder plug-in interface
+*
+*/
+package com.nokia.tracebuilder.plugin;
+
+import com.nokia.tracebuilder.model.TraceModel;
+
+/**
+ * TraceBuilder plug-in interface
+ * 
+ */
+public interface TraceBuilderPlugin {
+
+	/**
+	 * Notification that the trace project has been opened. Provides the model
+	 * to this plug-in. The model is not changed until closeTraceProject and
+	 * thus no null-checks are needed.
+	 * 
+	 * @param model
+	 *            the trace model
+	 */
+	public void traceProjectOpened(TraceModel model);
+
+	/**
+	 * Notification that the trace project has been closed
+	 */
+	public void traceProjectClosed();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/plugin/TraceFormatConstants.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ * Formatting constants for traces
+ *
+ */
+package com.nokia.tracebuilder.plugin;
+
+/**
+ * Formatting constants for traces
+ * 
+ */
+public interface TraceFormatConstants {
+
+	/**
+	 * Function name in upper case
+	 */
+	String FORMAT_FUNCTION_NAME_UPPER_CASE = "{$FN}"; //$NON-NLS-1$
+
+	/**
+	 * Function name in normal case
+	 */
+	String FORMAT_FUNCTION_NAME_NORMAL_CASE = "{$fn}"; //$NON-NLS-1$
+
+	/**
+	 * Class name in upper case
+	 */
+	String FORMAT_CLASS_NAME_UPPER_CASE = "{$CN}"; //$NON-NLS-1$
+
+	/**
+	 * Class name in normal case
+	 */
+	String FORMAT_CLASS_NAME_NORMAL_CASE = "{$cn}"; //$NON-NLS-1$
+
+	/**
+	 * Tag which is replaced by trace text when inserting a trace to source
+	 */
+	String FORMATTED_TRACE = "%FORMATTED_TRACE%"; //$NON-NLS-1$
+
+	/**
+	 * Tag which is replaced by parameters when inserting a trace to source
+	 */
+	String PARAMETERS_FORMAT = "%PARAMETERS%"; //$NON-NLS-1$
+
+	/**
+	 * Insert format for include header
+	 */
+	String INCLUDE_FORMAT = "%INCLUDE%"; //$NON-NLS-1$
+
+	/**
+	 * Tag which is replaced by parameter count when inserting a trace to source
+	 */
+	String PARAM_COUNT_FORMAT = "%PC%"; //$NON-NLS-1$
+
+	/**
+	 * Tag which is replaced by group name when inserting a trace to source
+	 */
+	String GROUP_FORMAT = "%GROUP%"; //$NON-NLS-1$
+
+	/**
+	 * Tag which is replaced by trace name when inserting a trace to source
+	 */
+	String NAME_FORMAT = "%NAME%"; //$NON-NLS-1$
+
+	/**
+	 * Tag which is replaced by state machine name when inserting a trace to
+	 * source
+	 */
+	String STATE_MACHINE_NAME_FORMAT = "%STATE_MACHINE_NAME%"; //$NON-NLS-1$
+
+	/**
+	 * Tag which is replaced by state machine state when inserting a trace to
+	 * source
+	 */
+	String STATE_MACHINE_STATE_FORMAT = "%STATE_MACHINE_STATE%"; //$NON-NLS-1$
+
+	/**
+	 * Tag which is replaced by event name when inserting a trace to source
+	 */
+	String EVENT_NAME_FORMAT = "%EVENT_NAME%"; //$NON-NLS-1$
+
+	/**
+	 * Tag which is replaced by event start trace name when inserting a trace to
+	 * source
+	 */
+	String EVENT_START_TRACE_NAME_FORMAT = "%EVENT_START_TRACE_NAME%"; //$NON-NLS-1$
+
+	/**
+	 * Tag which is replaced by trace text when inserting a trace to source
+	 */
+	String TEXT_FORMAT = "%TEXT%"; //$NON-NLS-1$
+
+	/**
+	 * Tag which is replaced with the data buffer pointer when formatting
+	 * complex traces into the trace header
+	 */
+	String DATA_BUFFER_FORMAT = "%DATA%"; //$NON-NLS-1$
+
+	/**
+	 * Tag which is replaced with the data buffer length when formatting complex
+	 * traces into the trace header
+	 */
+	String DATA_LENGTH_FORMAT = "%LENGTH%"; //$NON-NLS-1$
+
+	/**
+	 * Comment format which needs to be used. Otherwise the comment before /
+	 * after trace configuration will not work
+	 */
+	String COMMENT_FORMAT = " //"; //$NON-NLS-1$
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/plugin/TraceHeaderContribution.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 header contribution
+*
+*/
+package com.nokia.tracebuilder.plugin;
+
+import com.nokia.tracebuilder.model.TraceModelExtension;
+
+/**
+ * Interface which can be added to model by plug-in's to contribute data to the
+ * trace header
+ * 
+ */
+public interface TraceHeaderContribution extends TraceModelExtension {
+
+	/**
+	 * List of possible contributions to the trace header file
+	 * 
+	 */
+	public enum TraceHeaderContributionType {
+
+		/**
+		 * #define statements to be added to the header
+		 */
+		GLOBAL_DEFINES,
+
+		/**
+		 * #include statements to be added to the header
+		 */
+		GLOBAL_INCLUDES,
+
+		/**
+		 * Content for the main header file
+		 */
+		MAIN_HEADER_CONTENT
+
+	}
+
+	/**
+	 * Gets data to be added to the trace header
+	 * 
+	 * @param type
+	 *            the contribution type
+	 * @return the data to be added, depends on type
+	 */
+	public String[] getContribution(TraceHeaderContributionType type);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/plugin/package.html	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,3 @@
+<html><body>
+Interfaces for TraceBuilder plug-ins
+</body></html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/project/FormattingUtils.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Utilities for trace formatting
+*
+*/
+package com.nokia.tracebuilder.project;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceGroup;
+import com.nokia.tracebuilder.model.TraceModel;
+
+/**
+ * Utilities for trace formatting
+ * 
+ */
+public final class FormattingUtils {
+
+	/**
+	 * Gets a group ID based on group name
+	 * 
+	 * @param model
+	 *            the trace model
+	 * @param name
+	 *            the group name
+	 * @return the group ID
+	 * @throws TraceBuilderException
+	 */
+	public static int getGroupID(TraceModel model, String name)
+			throws TraceBuilderException {
+		int retval = 0;
+		
+		// First check that is group one of the default groups
+		// Groups start from index 1
+		GroupNameHandlerBase groupNameHandler = TraceBuilderGlobals.getGroupNameHandler();
+		String[] defaultGroups = groupNameHandler.getDefaultGroups();
+		for (int i = 1; i < defaultGroups.length && retval == 0; i++) {
+			String defaultName = defaultGroups[i];
+			if (name.equals(defaultName)) {
+				retval = i;
+			}
+		}
+		// If group was not one of the default groups then get next group Id from model
+		if (retval == 0) {
+			retval = model.getNextGroupID();
+			if (retval < groupNameHandler.getUserGroupIdFirst()) {
+				retval = groupNameHandler.getUserGroupIdFirst();
+			}
+		}
+		return retval;
+	}
+
+	/**
+	 * Gets a list of available group names
+	 * 
+	 * @param traceModel
+	 *            the model
+	 * @return the group names
+	 */
+	public static Iterator<String> getGroupNames(TraceModel traceModel) {
+		ArrayList<String> list = new ArrayList<String>();
+		GroupNameHandlerBase groupNameHandler = TraceBuilderGlobals.getGroupNameHandler();
+		String[] defaultGroups = groupNameHandler.getDefaultGroups();
+		for (int i = 1; i < defaultGroups.length; i++) {
+			String defaultGroup = defaultGroups[i];
+			list.add(defaultGroup);
+		}
+		Iterator<TraceGroup> groups = TraceBuilderGlobals.getTraceModel()
+				.getGroups();
+		while (groups.hasNext()) {
+			String name = groups.next().getName();
+			if (!list.contains(name)) {
+				list.add(name);
+			}
+		}
+		return list.iterator();
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/project/GroupNameHandlerBase.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ * Default names for trace groups
+ *
+ */
+package com.nokia.tracebuilder.project;
+
+/**
+ * Default names for trace groups
+ * 
+ */
+public class GroupNameHandlerBase {
+
+	/**
+	 * Array of default groups
+	 */
+	protected String[] defaultGroups;
+	
+	/**
+	 * First user defined group ID
+	 */
+	protected int userGroupIdFirst;
+	
+	/**
+	 * Last user defined group ID
+	 */
+	protected int userGroupIdLast;
+	
+	/**
+	 * Index of TRACE_STATE group
+	 */
+	protected int stateGroupIdIndex;
+	
+	/**
+	 * Index of TRACE_PERFORMANCE group
+	 */
+	protected int performanceGroupIdIndex;
+	
+	/**
+	 * Index of TRACE_FLOW group
+	 */
+	protected int flowGroupIdIndex;
+	
+	/**
+	 * Index of TRACE_NORMAL group
+	 */
+	protected int normalGroupIdIndex;
+	
+	/**
+	 * OST version in use
+	 */
+	protected String usedOstVersion;
+	
+	
+	/**
+	 * Max group ID
+	 */
+	protected int maxGroupId;
+	
+	/**
+	 * Constructor
+	 */
+	public GroupNameHandlerBase() {
+
+	}
+
+	/**
+	 * Get list of default groups
+	 * 
+	 * @return list of default groups
+	 */
+	public String[] getDefaultGroups() {
+		return defaultGroups;
+	}
+
+	/**
+	 * Get first user defined group ID
+	 * 
+	 * @return first user defined group ID
+	 */
+	public int getUserGroupIdFirst() {
+		return userGroupIdFirst;
+	}
+
+	/**
+	 * Get last user defined group ID
+	 * 
+	 * @return last user defined group ID
+	 */
+	public int getUserGroupIdLast() {
+		return userGroupIdLast;
+	}
+
+	/**
+	 * Get state group ID index
+	 * 
+	 * @return state group ID index
+	 */
+	public int getStateGroupIdIndex() {
+		return stateGroupIdIndex;
+	}
+
+	/**
+	 * Get performance group ID index
+	 * 
+	 * @return performance group ID index
+	 */
+	public int getPerformanceGroupIdIndex() {
+		return performanceGroupIdIndex;
+	}
+
+	/**
+	 * Get flow group ID index
+	 * 
+	 * @return flow group ID index
+	 */
+	public int getFlowGroupIdIndex() {
+		return flowGroupIdIndex;
+	}
+
+	/**
+	 * Get normal group ID index
+	 * 
+	 * @return normal group ID index
+	 */
+	public int getNormalGroupIdIndex() {
+		return normalGroupIdIndex;
+	}
+
+	/**
+	 * Get max number of user defined groups
+	 * 
+	 * @return normal group ID index
+	 */
+	public int getMaxNumberOfUserDefinedGroups() {
+		return userGroupIdLast - userGroupIdFirst + 1;
+	}
+	
+	/**
+	 * Get max group ID
+	 * 
+	 * @return max group ID
+	 */
+	public int getMaxGroupId() {
+		return maxGroupId;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/project/GroupNameHandlerOSTv1.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ * Default names for OSTv1 trace groups
+ *
+ */
+package com.nokia.tracebuilder.project;
+
+/**
+ * Default names for trace groups
+ * 
+ */
+public final class GroupNameHandlerOSTv1 extends GroupNameHandlerBase {
+
+	/**
+	 * Default names for OSTv1 groups.
+	 */
+	private static String[] DEFAULT_GROUPS = { "", //$NON-NLS-1$
+			"TRACE_FATAL", //$NON-NLS-1$
+			"TRACE_IMPORTANT", //$NON-NLS-1$
+			"TRACE_NORMAL", //$NON-NLS-1$
+			"TRACE_PERFORMANCE", //$NON-NLS-1$
+			"TRACE_STATE", //$NON-NLS-1$
+			"TRACE_API", //$NON-NLS-1$
+			"TRACE_FLOW", //$NON-NLS-1$
+			"TRACE_DETAILED", //$NON-NLS-1$
+			"TRACE_DEBUG" //$NON-NLS-1$
+	};
+
+	/**
+	 * Start of OSTv1 user-defined groups
+	 */
+	private static int USER_GROUP_ID_FIRST = 64; // CodForChk_Dis_Magic
+
+	/**
+	 * End of OSTv1 user-defined groups
+	 */
+	private static int USER_GROUP_ID_LAST = 65535; // CodForChk_Dis_Magic
+	
+	/**
+	 * Max group ID
+	 */
+	public static final int MAX_GROUP_ID = 65535; // CodForChk_Dis_Magic
+
+	/**
+	 * Index of OSTv1 state group
+	 */
+	private static int STATE_GROUP_ID_INDEX = 5; // CodForChk_Dis_Magic
+
+	/**
+	 * Index of OSTv1 performance group
+	 */
+	private static int PERFORMANCE_GROUP_ID_INDEX = 4; // CodForChk_Dis_Magic
+
+	/**
+	 * Index of OSTv1 flow group
+	 */
+	private static int FLOW_GROUP_ID_INDEX = 7; // CodForChk_Dis_Magic
+
+	/**
+	 * Index of OSTv1 normal group
+	 */
+	private static int NORMAL_GROUP_ID_INDEX = 3; // CodForChk_Dis_Magic
+	
+	/**
+	 * OSTv1 version text
+	 */
+	private static final String OST_VERSION_1_X_X = "1.x.x"; //$NON-NLS-1$
+
+	/**
+	 * Constructor
+	 */
+	public GroupNameHandlerOSTv1() {
+		defaultGroups = DEFAULT_GROUPS;
+		userGroupIdFirst = USER_GROUP_ID_FIRST;
+		userGroupIdLast = USER_GROUP_ID_LAST;
+		stateGroupIdIndex = STATE_GROUP_ID_INDEX;
+		performanceGroupIdIndex = PERFORMANCE_GROUP_ID_INDEX;
+		flowGroupIdIndex = FLOW_GROUP_ID_INDEX;
+		normalGroupIdIndex = NORMAL_GROUP_ID_INDEX;
+		usedOstVersion = OST_VERSION_1_X_X;
+		maxGroupId = MAX_GROUP_ID;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/project/GroupNameHandlerOSTv2.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ * Default names for OSTv2 trace groups
+ *
+ */
+package com.nokia.tracebuilder.project;
+
+/**
+ * Default names for trace groups
+ * 
+ */
+public final class GroupNameHandlerOSTv2 extends GroupNameHandlerBase {
+
+	/**
+	 * Default names for OSTv2 groups.
+	 */
+	private static String[] DEFAULT_GROUPS = { "", //$NON-NLS-1$
+			"TRACE_FATAL", //$NON-NLS-1$
+			"TRACE_ERROR", //$NON-NLS-1$
+			"TRACE_WARNING", //$NON-NLS-1$
+			"TRACE_BORDER", //$NON-NLS-1$
+			"TRACE_NORMAL", //$NON-NLS-1$
+			"TRACE_STATE", //$NON-NLS-1$
+			"TRACE_INTERNALS", //$NON-NLS-1$
+			"TRACE_DUMP", //$NON-NLS-1$
+			"TRACE_FLOW", //$NON-NLS-1$
+			"TRACE_PERFORMANCE", //$NON-NLS-1$
+			"TRACE_ADHOC", //$NON-NLS-1$
+			"TRACE_EXTENSION", //$NON-NLS-1$
+			"TRACE_TESTING1", //$NON-NLS-1$
+			"TRACE_TESTING2" //$NON-NLS-1$
+	};
+
+	/**
+	 * Start of OSTv2 user-defined groups
+	 */
+	private static int USER_GROUP_ID_FIRST = 222; // CodForChk_Dis_Magic
+
+	/**
+	 * End of OSTv2 user-defined groups
+	 */
+	private static int USER_GROUP_ID_LAST = 253; // CodForChk_Dis_Magic
+	
+	/**
+	 * Max group ID
+	 */
+	public static final int MAX_GROUP_ID = 255; // CodForChk_Dis_Magic
+
+	/**
+	 * Index of OSTv2 state group
+	 */
+	private static int STATE_GROUP_ID_INDEX = 6; // CodForChk_Dis_Magic
+
+	/**
+	 * Index of OSTv2 performance group
+	 */
+	private static int PERFORMANCE_GROUP_ID_INDEX = 10; // CodForChk_Dis_Magic
+
+	/**
+	 * Index of OSTv2 flow group
+	 */
+	private static int FLOW_GROUP_ID_INDEX = 9; // CodForChk_Dis_Magic
+
+	/**
+	 * Index of OSTv2 normal group
+	 */
+	private static int NORMAL_GROUP_ID_INDEX = 5; // CodForChk_Dis_Magic
+
+	/**
+	 * OSTv2 version text
+	 */
+	private static final String OST_VERSION_2_X_X = "2.x.x"; //$NON-NLS-1$
+
+	
+	/**
+	 * Constructor
+	 */
+	public GroupNameHandlerOSTv2() {
+		defaultGroups = DEFAULT_GROUPS;
+		userGroupIdFirst = USER_GROUP_ID_FIRST;
+		userGroupIdLast = USER_GROUP_ID_LAST;
+		stateGroupIdIndex = STATE_GROUP_ID_INDEX;
+		performanceGroupIdIndex = PERFORMANCE_GROUP_ID_INDEX;
+		flowGroupIdIndex = FLOW_GROUP_ID_INDEX;
+		normalGroupIdIndex = NORMAL_GROUP_ID_INDEX;
+		usedOstVersion = OST_VERSION_2_X_X;
+		maxGroupId = MAX_GROUP_ID;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/project/Messages.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 project package
+*
+*/
+package com.nokia.tracebuilder.project;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * Localized strings for project package
+ * 
+ */
+class Messages {
+
+	/**
+	 * Bundle name
+	 */
+	private static final String BUNDLE_NAME = "com.nokia.tracebuilder.project.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/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/project/ProjectFileParser.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,85 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 project file parsers
+*
+*/
+package com.nokia.tracebuilder.project;
+
+import java.io.File;
+
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.FileErrorParameters;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.TraceBuilderErrorCode;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceModel;
+
+/**
+ * Base class for project file parsers
+ * 
+ */
+public abstract class ProjectFileParser {
+
+	/**
+	 * Trace model
+	 */
+	protected TraceModel model;
+
+	/**
+	 * Project file to be parsed
+	 */
+	protected File projectFile;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            the trace model
+	 * @param fileName
+	 *            the project file name
+	 * @throws TraceBuilderException
+	 *             if file does not exist
+	 */
+	protected ProjectFileParser(TraceModel model, String fileName)
+			throws TraceBuilderException {
+		File file = new File(fileName);
+		if (file.exists()) {
+			this.model = model;
+			this.projectFile = file;
+			createParser();
+		} else {
+			FileErrorParameters params = new FileErrorParameters();
+			params.file = fileName;
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.FILE_NOT_FOUND, params);
+		}
+	}
+
+	/**
+	 * Creates the file parser
+	 * 
+	 * @throws TraceBuilderException
+	 *             if creation fails
+	 */
+	protected abstract void createParser() throws TraceBuilderException;
+
+	/**
+	 * Parses the project file
+	 * 
+	 * @throws TraceBuilderException
+	 *             if parser fails
+	 */
+	public abstract void parse() throws TraceBuilderException;
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/project/ProjectUtils.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,291 @@
+/*
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Project file utilities
+*
+*/
+package com.nokia.tracebuilder.project;
+
+import java.io.File;
+import java.util.ArrayList;
+
+import com.nokia.tracebuilder.engine.TraceBuilderConfiguration;
+import com.nokia.tracebuilder.engine.TraceBuilderDialogs;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceBuilderDialogs.DirectoryDialogQueryParameters;
+import com.nokia.tracebuilder.engine.TraceBuilderDialogs.QueryDialogType;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.TraceBuilderErrorCode;
+import com.nokia.tracebuilder.engine.project.ProjectEngine;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceModel;
+import com.nokia.tracebuilder.source.SymbianConstants;
+
+/**
+ * Project file utilities
+ * 
+ */
+public final class ProjectUtils {
+
+
+	/**
+	 * Tries to locate existing file with given extension and if not found,
+	 * proposes a new location for that file. The new location will be
+	 * <i>createPath</i> or if that is null, the directory where the trace
+	 * project file (.tbprj) resides. Trace project must be open before this can
+	 * be called
+	 * 
+	 * @param model
+	 *            the trace model
+	 * @param createPath
+	 *            the path to create if existing file is not found
+	 * @param fileName
+	 *            the name for the new file
+	 * @param appendProjectName
+	 *            true if the name is appended to end of model name
+	 * @return the project file path for the new file
+	 * @throws TraceBuilderException
+	 *             if the model does not have any project files
+	 */
+	public static String getLocationForFile(TraceModel model,
+			String createPath, String fileName, boolean appendProjectName)
+			throws TraceBuilderException {
+		TraceProjectFile projectFile = model
+				.getExtension(TraceProjectFile.class);
+		if (projectFile == null) {
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.MODEL_NOT_READY);
+		}
+		String projectName = ""; //$NON-NLS-1$
+		if (appendProjectName) {
+			projectName = projectFile.getProjectName();
+		}
+		return getLocationForFile(projectFile.getPath(), projectName,
+				createPath, fileName);
+	}
+
+	/**
+	 * Tries to locate existing file with given extension and if not found,
+	 * proposes a new location for that file. The new location will be
+	 * <i>createPath</i> or if that is null, the directory where the trace
+	 * project file resides. Trace project must be open before this can
+	 * be called
+	 * 
+	 * @param projectPath
+	 *            path to the project
+	 * @param projectName
+	 *            name of the project
+	 * @param createPath
+	 *            the path to create if existing file is not found
+	 * @param extension
+	 *            the file extension for the new file
+	 * @return the project file path for the new file
+	 */
+	public static String getLocationForFile(String projectPath,
+			String projectName, String createPath, String extension) {
+		ArrayList<String> searchPaths = new ArrayList<String>();
+		if (createPath != null && createPath.length() > 0) {
+			// If create path is explicitly specified, it is added to the search
+			// path list
+			searchPaths.add(createPath);
+		}
+		// Default directories are always included into search
+		searchPaths.add(ProjectEngine.traceFolderName);
+		searchPaths.add(SymbianConstants.GROUP_DIRECTORY);
+		searchPaths.add(SymbianConstants.INCLUDE_DIRECTORY);
+		String[] pathArr = new String[searchPaths.size()];
+		searchPaths.toArray(pathArr);
+		return getLocationForFile(projectPath, projectName, pathArr,
+				createPath, extension);
+	}
+
+	/**
+	 * Tries to locate existing file and if not found, proposes a new location
+	 * for that file. The search starts from <i>projectPath</i>. If
+	 * <i>checkParents</i> is true, the parent directories are also checked if
+	 * the file is not found
+	 * 
+	 * @param projectPath
+	 *            path where to start the search
+	 * @param projectName
+	 *            the name of the project
+	 * @param searchPaths
+	 *            the sub-paths to be searched
+	 * @param createPath
+	 *            the sub-path to create if file is not found
+	 * @param fileName
+	 *            extension of the file to be located
+	 * @return the project file path for the new file
+	 */
+	private static String getLocationForFile(String projectPath,
+			String projectName, String[] searchPaths, String createPath,
+			String fileName) {
+		
+		// If the project file is in one of the search paths, the path is
+		// changed to its parent
+		for (int i = 0; i < searchPaths.length; i++) {
+			String projectPathInLowerCase = projectPath.toLowerCase();
+			String searchPathInLowerCase = searchPaths[i].toLowerCase();
+			if (projectPathInLowerCase.endsWith(searchPathInLowerCase)) {
+				int endIndex = projectPathInLowerCase.indexOf(searchPathInLowerCase);
+				projectPath = projectPath.substring(0, endIndex);
+				i = searchPaths.length;
+			}
+		}
+		// Tries to find an existing file based on project path and project name
+		String filePath = findProjectFile(projectPath, projectName,
+				searchPaths, fileName, false);
+		if (filePath == null) {
+			// If file is not found, this returns a new path
+			filePath = projectPath + File.separator + createPath
+					+ File.separator + projectName + fileName;
+		}
+		return filePath;
+	}
+
+	/**
+	 * Finds a project file or directory based on a file or directory
+	 * 
+	 * @param startPath
+	 *            the file name or path where to start search
+	 * @param projectName
+	 *            the name of the project file
+	 * @param searchDirectories
+	 *            the directories to search
+	 * @param fileExtension
+	 *            the file extension to be located or null if locating one of
+	 *            the search directories
+	 * @param checkParents
+	 *            true if parent directories should be checked
+	 * @return the file or directory path if found or null if not
+	 */
+	private static String findProjectFile(String startPath, String projectName,
+			String[] searchDirectories, String fileExtension,
+			boolean checkParents) {
+		String foundFile = null;
+		if (startPath != null) {
+			File file = new File(startPath);
+			if (!file.isDirectory()) {
+				file = file.getParentFile();
+			}
+			if (file != null) {
+				do {
+					for (int i = 0; i < searchDirectories.length
+							&& foundFile == null; i++) {
+						foundFile = findProjectFile(searchDirectories[i],
+								projectName, fileExtension, file);
+					}
+					file = file.getParentFile();
+				} while (file != null && foundFile == null && checkParents);
+			}
+		}
+		return foundFile;
+	}
+
+	/**
+	 * Searches a single directory for a project file
+	 * 
+	 * @param searchDirectory
+	 *            the directory to search
+	 * @param fileExtension
+	 *            the file extension to be located or null if locating one of
+	 *            the search directories
+	 * @param projectName
+	 *            the name of the project file
+	 * @param file
+	 *            the current file
+	 * @return the file or directory path if found or null if not
+	 */
+	private static String findProjectFile(String searchDirectory,
+			String projectName, String fileExtension, File file) {
+		String foundFile = null;
+		File projectPath = new File(file.getAbsolutePath() + File.separator
+				+ searchDirectory + File.separator);
+		if (projectPath.exists()) {
+			if (fileExtension == null) {
+				foundFile = projectPath.getAbsolutePath();
+			} else {
+				foundFile = findProjectFileFromDirectory(projectPath,
+						projectName, fileExtension);
+			}
+		}
+		return foundFile;
+	}
+
+	/**
+	 * Gets the first file with given extension from given directory
+	 * 
+	 * @param path
+	 *            the path to search
+	 * @param projectName
+	 *            the name of the project file
+	 * @param fileExtension
+	 *            the file extension
+	 * @return the file name if found or null if not
+	 */
+	private static String findProjectFileFromDirectory(File path,
+			String projectName, String fileExtension) {
+		String proposal = null;
+		File[] files = path.listFiles();
+		if (projectName != null) {
+			// If project name is specified, only the file that matches the name
+			// is returned
+			String nameFromProjectFile = projectName + fileExtension;
+			for (int i = 0; i < files.length && proposal == null; i++) {
+				String fname = files[i].getName();
+				if (fname.equals(nameFromProjectFile)) {
+					proposal = files[i].getAbsolutePath();
+				}
+			}
+		} else {
+			// If project name is not specified, this proposes the first file
+			// which ends with the file extension
+			for (int i = 0; i < files.length && proposal == null; i++) {
+				String fname = files[i].getName();
+				if (fname.length() > fileExtension.length()) {
+					int extstart = fname.length() - fileExtension.length();
+					if (fname.substring(extstart).equals(fileExtension)) {
+						proposal = files[i].getAbsolutePath();
+					}
+				}
+			}
+		}
+		return proposal;
+	}
+
+	/**
+	 * Shows the directory query for environment root
+	 * 
+	 * @param dialogType
+	 *            the query dialog type
+	 * @return the environment root
+	 */
+	public static String queryEnvironmentRoot(QueryDialogType dialogType) {
+		String path = TraceBuilderGlobals.getConfiguration().getText(
+				TraceBuilderConfiguration.ENVIRONMENT_ROOT);
+		DirectoryDialogQueryParameters query = new DirectoryDialogQueryParameters();
+		query.path = path;
+		query.dialogType = dialogType;
+		int res = TraceBuilderGlobals.getDialogs().showConfirmationQuery(query);
+		if (res == TraceBuilderDialogs.OK) {
+			// Environment root is stored to configuration
+			TraceBuilderGlobals.getConfiguration().setText(
+					TraceBuilderConfiguration.ENVIRONMENT_ROOT, query.path);
+		} else {
+			query.path = null;
+		}
+		return query.path;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/project/PropertyNames.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* List of supported property names
+*
+*/
+package com.nokia.tracebuilder.project;
+
+/**
+ * List of supported property names
+ * 
+ */
+public interface PropertyNames {
+
+	/**
+	 * Group / component prefix
+	 */
+	public String PREFIX = "prefix"; //$NON-NLS-1$
+
+	/**
+	 * Group / component suffix
+	 */
+	public String SUFFIX = "suffix"; //$NON-NLS-1$
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/project/TraceLocationParser.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 location parser
+*
+*/
+package com.nokia.tracebuilder.project;
+
+import com.nokia.tracebuilder.engine.TraceLocation;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.TraceBuilderErrorCode;
+import com.nokia.tracebuilder.engine.source.SourceParserRule.TraceConversionResult;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.source.SourceExcludedArea;
+
+/**
+ * Interface to location parser. The parser is implemented into the project API
+ * 
+ */
+public interface TraceLocationParser {
+
+	/**
+	 * Processes a newly parsed location. The location has not yet been
+	 * associated with a trace.
+	 * 
+	 * @param location
+	 *            the new location
+	 */
+	public void processNewLocation(TraceLocation location);
+
+	/**
+	 * Gets the group where locations created by this parser belong
+	 * 
+	 * @return the location group
+	 */
+	public String getLocationGroup();
+
+	/**
+	 * Converts a location to trace
+	 * 
+	 * @param location
+	 *            the location to be parsed
+	 * @return properties for new trace
+	 * @throws TraceBuilderException
+	 *             if the location cannot be converted
+	 */
+	public TraceConversionResult convertLocation(TraceLocation location)
+			throws TraceBuilderException;
+
+	/**
+	 * Finds the comment related to given location
+	 * 
+	 * @param location
+	 *            the location to be checked
+	 * @return the comment related to the location or null if not found
+	 */
+	public SourceExcludedArea findLocationComment(TraceLocation location);
+
+	/**
+	 * Determines if a location parsed from source should be automatically
+	 * converted to a trace. This is called only if
+	 * isLocationAutoConvertSupported has returned true
+	 * 
+	 * @param location
+	 *            the location to be checked
+	 * 
+	 * @return true if automatically converted, false if not
+	 */
+	public boolean isLocationConverted(TraceLocation location);
+
+	/**
+	 * Checks if a location matches its trace
+	 * 
+	 * @param location
+	 *            the location to be checked
+	 * @return error code from TraceBuilderErrorCodes
+	 */
+	public TraceBuilderErrorCode checkLocationValidity(TraceLocation location);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/project/TraceProjectAPI.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,76 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 properties of the trace API used by the currently open trace project
+*
+*/
+package com.nokia.tracebuilder.project;
+
+import com.nokia.tracebuilder.model.Trace;
+import com.nokia.tracebuilder.model.TraceModelExtension;
+
+/**
+ * Interface to the properties of the trace API used by the currently open trace
+ * project
+ * 
+ */
+public interface TraceProjectAPI extends TraceModelExtension {
+
+	/**
+	 * Formatting flags for formatTraceForExport
+	 * 
+	 */
+	public class TraceFormatFlags {
+
+		/**
+		 * Formatting characters supported flag
+		 */
+		public boolean isFormattingSupported;
+	}
+
+	/**
+	 * Gets the name of this API
+	 * 
+	 * @return the name
+	 */
+	public String getName();
+
+	/**
+	 * Gets the title that is shown in the API selection preferences dialog
+	 * 
+	 * @return the title
+	 */
+	public String getTitle();
+
+	/**
+	 * Flag which determines if this API is shown in the TraceBuilder
+	 * configuration
+	 * 
+	 * @return the flag
+	 */
+	public boolean isVisibleInConfiguration();
+
+	/**
+	 * Formats a trace for into a string suitable for export
+	 * 
+	 * @param trace
+	 *            the trace to be formatted
+	 * @param flags
+	 *            the formatting flags
+	 * @return the formatted text
+	 */
+	public String formatTraceForExport(Trace trace, TraceFormatFlags flags);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/project/TraceProjectAPIList.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 list of trace project API's registered to TraceBuilder
+*
+*/
+package com.nokia.tracebuilder.project;
+
+import java.util.Iterator;
+
+import com.nokia.tracebuilder.model.TraceModelExtension;
+
+/**
+ * Interface to the list of trace project API's registered to TraceBuilder
+ * 
+ */
+public interface TraceProjectAPIList extends TraceModelExtension {
+
+	/**
+	 * Gets the list of API's
+	 * 
+	 * @return the list
+	 */
+	public Iterator<TraceProjectAPI> getAPIs();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/project/TraceProjectFile.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,446 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Generic trace project file properties
+*
+*/
+package com.nokia.tracebuilder.project;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import com.nokia.tracebuilder.engine.TraceBuilderConfiguration;
+import com.nokia.tracebuilder.engine.TraceBuilderEvents;
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceViewExtension;
+import com.nokia.tracebuilder.file.FileUtils;
+import com.nokia.tracebuilder.model.TraceModel;
+import com.nokia.tracebuilder.model.TraceModelExtensionUpdateListener;
+import com.nokia.tracebuilder.model.TraceModelListener;
+import com.nokia.tracebuilder.model.TraceModelUpdatableExtension;
+import com.nokia.tracebuilder.model.TraceObject;
+import com.nokia.tracebuilder.source.SourceConstants;
+
+/**
+ * Generic trace project file properties
+ * 
+ */
+public abstract class TraceProjectFile implements TraceModelUpdatableExtension,
+		TraceViewExtension, TraceModelListener {
+
+	/**
+	 * The trace model
+	 */
+	private TraceModel owner;
+
+	/**
+	 * Name of the project file
+	 */
+	private String name;
+
+	/**
+	 * Project file path
+	 */
+	private String path;
+
+	/**
+	 * Update listeners
+	 */
+	private ArrayList<TraceModelExtensionUpdateListener> listeners;
+
+	/**
+	 * View reference
+	 */
+	private Object viewReference;
+
+	/**
+	 * Project file name is based on model name and updated when model changes
+	 */
+	protected boolean hasModelName;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param path
+	 *            the path to the file
+	 * @param name
+	 *            the name of the project or empty if this file does not use the
+	 *            project name
+	 */
+	protected TraceProjectFile(String path, String name) {
+		this.path = path;
+		this.name = name;
+		if (name == null || name.length() == 0) {
+			this.hasModelName = false;
+		} else {
+			this.hasModelName = true;
+		}
+	}
+
+	/**
+	 * Constructor
+	 * 
+	 * @param absolutePath
+	 *            the absolute path to the file
+	 * @param hasModelName
+	 *            flag, which tells to update the project file name if model
+	 *            name changes
+	 */
+	protected TraceProjectFile(String absolutePath, boolean hasModelName) {
+		this.hasModelName = hasModelName;
+		updatePath(absolutePath);
+	}
+
+	/**
+	 * Gets the file extension of this project file
+	 * 
+	 * @return the extension
+	 */
+	protected abstract String getFileExtension();
+
+	/**
+	 * Gets the title to be shown in UI
+	 * 
+	 * @return the title
+	 */
+	public abstract String getTitle();
+
+	/**
+	 * Gets the name of the project
+	 * 
+	 * @return the project name
+	 */
+	public final String getProjectName() {
+		return name;
+	}
+
+	/**
+	 * Gets the path of this project file
+	 * 
+	 * @return the project file path
+	 */
+	public final String getPath() {
+		return path;
+	}
+
+	/**
+	 * Gets the name of this project file
+	 * 
+	 * @return the file name
+	 */
+	public final String getFileName() {
+		StringBuffer sb = new StringBuffer();
+		addFileName(sb, false);
+		return sb.toString();
+	}
+
+	/**
+	 * Checks if this file is valid
+	 * 
+	 * @return true if valid, false if not
+	 */
+	public boolean isValid() {
+		return path != null && name != null;
+	}
+
+	/**
+	 * Model update notification. This renames the project file according to the
+	 * new model name
+	 */
+	protected void modelChanged() {
+		if (hasModelName && !getOwner().getName().equals(this.name)) {
+			File oldFile = new File(getAbsolutePath());
+			this.name = getOwner().getName();
+			File newFile = new File(getAbsolutePath());
+			boolean renamed = oldFile.renameTo(newFile);
+			if (renamed) {
+				String prefix = Messages
+						.getString("TraceProjectFile.ProjectFileRenamedPrefix"); //$NON-NLS-1$
+				String middle = Messages
+						.getString("TraceProjectFile.ProjectFileRenamedMiddle"); //$NON-NLS-1$
+				TraceBuilderGlobals.getEvents().postInfoMessage(
+						getTitle() + prefix + oldFile.getName() + middle
+								+ newFile.getName(), null);
+			}
+			notifyUpdate();
+		}
+	}
+
+	/**
+	 * Notifies the listeners that this file has changed
+	 */
+	private void notifyUpdate() {
+		if (listeners != null) {
+			for (int i = 0; i < listeners.size(); i++) {
+				listeners.get(i).extensionUpdated();
+			}
+		}
+	}
+
+	/**
+	 * Posts a project file written event
+	 * 
+	 * @param path
+	 *            the path where file was written
+	 */
+	public void postFileWrittenEvent(String path) {
+		TraceBuilderEvents events = TraceBuilderGlobals.getEvents();
+		String oldCategory = events
+				.setEventCategory(TraceBuilderEvents.VERBOSE_INFO);
+		String msg = Messages
+				.getString("TraceProjectFile.ProjectFileWrittenMiddle"); //$NON-NLS-1$
+		TraceBuilderGlobals.getEvents().postInfoMessage(
+				getTitle() + msg + path, null);
+		events.setEventCategory(oldCategory);
+	}
+
+	/**
+	 * Updates the project file name and path
+	 * 
+	 * @param absolutePath
+	 *            the new path including the file name
+	 */
+	public void updatePath(String absolutePath) {
+		File file = new File(absolutePath);
+		path = file.getParent();
+		name = file.getName();
+		String ext = getFileExtension();
+		if (name.endsWith(ext)) {
+			name = name.substring(0, name.length() - ext.length());
+		}
+		notifyUpdate();
+	}
+
+	/**
+	 * Gets the path including file name
+	 * 
+	 * @return the path
+	 */
+	public final String getAbsolutePath() {
+		String retval;
+		if (isValid()) {
+			StringBuffer sb = new StringBuffer();
+			sb.append(FileUtils.convertSeparators(
+					SourceConstants.FORWARD_SLASH_CHAR, path, true));
+			addFileName(sb, false);
+			retval = sb.toString();
+		} else {
+			retval = null;
+		}
+		return retval;
+	}
+
+	/**
+	 * Gets the absolute path to this file, including the model ID in file name
+	 * 
+	 * @return the path
+	 */
+	public final String getAbsolutePathWithID() {
+		String retval;
+		if (isValid()) {
+			StringBuffer sb = new StringBuffer();
+			sb.append(FileUtils.convertSeparators(
+					SourceConstants.FORWARD_SLASH_CHAR, path, true));
+			addFileName(sb, true);
+			retval = sb.toString();
+		} else {
+			retval = null;
+		}
+		return retval;
+	}
+
+	/**
+	 * Adds the file name to the given buffer
+	 * 
+	 * @param sb
+	 *            the buffer
+	 * @param addID
+	 *            true if ID needs to be added to name
+	 */
+	private void addFileName(StringBuffer sb, boolean addID) {
+		sb.append(name);
+		if (addID) {
+			sb.append("_0x"); //$NON-NLS-1$
+			sb.append(Integer.toHexString(getOwner().getModel().getID()));
+			sb.append("_"); //$NON-NLS-1$
+		}
+		sb.append(getFileExtension());
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelExtension#getOwner()
+	 */
+	public TraceObject getOwner() {
+		return owner;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelExtension#
+	 *      setOwner(com.nokia.tracebuilder.model.TraceObject)
+	 */
+	public void setOwner(TraceObject owner) {
+		if (this.owner != null) {
+			this.owner.removeModelListener(this);
+		}
+		if (owner instanceof TraceModel) {
+			this.owner = (TraceModel) owner;
+			this.owner.addModelListener(this);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceViewExtension#getChildren()
+	 */
+	public Iterator<?> getChildren() {
+		List<Object> list = Collections.emptyList();
+		return list.iterator();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceViewExtension#hasChildren()
+	 */
+	public boolean hasChildren() {
+		return false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceViewExtension#hideWhenEmpty()
+	 */
+	public boolean hideWhenEmpty() {
+		return !TraceBuilderConfiguration.SHOW_PROJECT_FILES;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelUpdatableExtension#
+	 *      addUpdateListener(com.nokia.tracebuilder.model.TraceModelExtensionUpdateListener)
+	 */
+	public void addUpdateListener(TraceModelExtensionUpdateListener listener) {
+		if (listeners == null) {
+			listeners = new ArrayList<TraceModelExtensionUpdateListener>();
+		}
+		listeners.add(listener);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelUpdatableExtension#
+	 *      removeUpdateListener(com.nokia.tracebuilder.model.TraceModelExtensionUpdateListener)
+	 */
+	public void removeUpdateListener(TraceModelExtensionUpdateListener listener) {
+		if (listeners != null) {
+			listeners.remove(listener);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceViewExtension#getViewReference()
+	 */
+	public Object getViewReference() {
+		return viewReference;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.engine.TraceViewExtension#
+	 *      setViewReference(java.lang.Object)
+	 */
+	public void setViewReference(Object reference) {
+		this.viewReference = reference;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelListener#
+	 *      objectAdded(com.nokia.tracebuilder.model.TraceObject,
+	 *      com.nokia.tracebuilder.model.TraceObject)
+	 */
+	public void objectAdded(TraceObject owner, TraceObject object) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelListener#
+	 *      objectCreationComplete(com.nokia.tracebuilder.model.TraceObject)
+	 */
+	public void objectCreationComplete(TraceObject object) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelListener#
+	 *      objectRemoved(com.nokia.tracebuilder.model.TraceObject,
+	 *      com.nokia.tracebuilder.model.TraceObject)
+	 */
+	public void objectRemoved(TraceObject owner, TraceObject object) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.model.TraceModelListener#
+	 *      propertyUpdated(com.nokia.tracebuilder.model.TraceObject, int)
+	 */
+	public void propertyUpdated(TraceObject object, int property) {
+		// Model change notifications are processed
+		if (object instanceof TraceModel) {
+			modelChanged();
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString() {
+		StringBuffer retval = new StringBuffer();
+		retval.append(getTitle());
+		retval.append(": "); //$NON-NLS-1$
+		if (isValid()) {
+			retval.append(name);
+			retval.append(getFileExtension());
+			retval.append(" ("); //$NON-NLS-1$
+			retval.append(path);
+			retval.append(")"); //$NON-NLS-1$
+		} else {
+			retval.append(Messages.getString("TraceProjectFile.NotValid")); //$NON-NLS-1$
+		}
+		return retval.toString();
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/project/messages.properties	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,4 @@
+TraceProjectFile.ProjectFileRenamedPrefix=\ renamed from 
+TraceProjectFile.ProjectFileRenamedMiddle=\ to 
+TraceProjectFile.NotValid=Not Valid
+TraceProjectFile.ProjectFileWrittenMiddle=\ written to 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/project/package.html	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,3 @@
+<html><body>
+Interface to the trace project management
+</body></html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/rules/ArrayParameterRule.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Rule interface for parameters that represent array types
+*
+*/
+package com.nokia.tracebuilder.rules;
+
+import com.nokia.tracebuilder.model.TraceObjectRule;
+
+/**
+ * Rule interface for parameters that represent array types
+ * 
+ */
+public interface ArrayParameterRule extends TraceObjectRule {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/rules/FillerParameterRule.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Rule that defines a filler parameter
+*
+*/
+package com.nokia.tracebuilder.rules;
+
+/**
+ * Rule that defines a filler parameter. A filler does not have a source or view
+ * representation, but does have a representation in the header and decoder
+ * files. It aligns trace parameters to 32-bit boundaries.
+ * 
+ */
+public interface FillerParameterRule extends HiddenTraceObjectRule {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/rules/HiddenTraceObjectRule.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Rule that allows an object to be marked as hidden
+*
+*/
+package com.nokia.tracebuilder.rules;
+
+import com.nokia.tracebuilder.model.TraceObjectRule;
+
+/**
+ * Rule that allows an object to be marked as hidden in the view
+ * 
+ */
+public interface HiddenTraceObjectRule extends TraceObjectRule {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/rules/ReadOnlyObjectRule.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Rule which marks an object "read-only"
+*
+*/
+package com.nokia.tracebuilder.rules;
+
+import com.nokia.tracebuilder.model.TraceObjectRule;
+
+/**
+ * Rule which marks an object "read-only". Read-only objects cannot be updated
+ * via UI
+ * 
+ */
+public interface ReadOnlyObjectRule extends TraceObjectRule {
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/rules/SingletonParameterRule.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Rule for singleton parameters
+*
+*/
+package com.nokia.tracebuilder.rules;
+
+import com.nokia.tracebuilder.model.TraceObjectRule;
+
+/**
+ * Rule which marks a parameter type as singleton. If a parameter contains an
+ * extension implementing this interface, a second parameter which contains the
+ * same type of extension cannot be added. The extension type is determined by
+ * <code>existingExtension.getClass().equals(newExtension.getClass())</code>
+ * 
+ */
+public interface SingletonParameterRule extends TraceObjectRule {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/rules/TraceParameterRestrictionRule.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 which can be added to a TraceObject to prevent parameter addition
+*
+*/
+package com.nokia.tracebuilder.rules;
+
+import com.nokia.tracebuilder.model.TraceObjectRule;
+
+/**
+ * Interface which can be used to restrict changes to the parameters of trace
+ * objects
+ * 
+ */
+public interface TraceParameterRestrictionRule extends TraceObjectRule {
+
+	/**
+	 * Called before showing add parameter dialog to user. If this returns
+	 * false, an error message is displayed
+	 * 
+	 * @return true if the dialog can be shown, false if an error message needs
+	 *         to be displayed
+	 */
+	public boolean canAddParameters();
+
+	/**
+	 * Called before removing a parameter. If this returns false, the parameter
+	 * is not removed and error message is displayed
+	 * 
+	 * @return true if the dialog can be shown, false if an error message needs
+	 *         to be displayed
+	 */
+	public boolean canRemoveParameters();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/rules/package.html	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,3 @@
+<html><body>
+Rules for trace objects
+</body></html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/ContextAreaParser.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,521 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Parser for source contexts
+*
+*/
+package com.nokia.tracebuilder.source;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * Parser for source contexts
+ * 
+ */
+class ContextAreaParser {
+
+	/**
+	 * Source parser
+	 */
+	private SourceParser parser;
+
+	/**
+	 * List of source file contexts
+	 */
+	protected ArrayList<SourceContext> contextAreas = new ArrayList<SourceContext>();
+
+	/**
+	 * Comparator for array sorting and searching
+	 */
+	private PositionArrayComparator arrayComparator = new PositionArrayComparator();
+
+	/**
+	 * "usingnamespace" text
+	 */
+	private static final String USINGNAMESPACE = "usingnamespace"; //$NON-NLS-1$
+
+	/**
+	 * Start index of "using" substring in "usingnamespace" string
+	 */
+	private static final int START_INDEX_OF_USING_SUBSTRING = 0; // CodForChk_Dis_Magic
+
+	/**
+	 * End index of "using" substring in "usingnamespace" string
+	 */
+	private static final int END_INDEX_OF_USING_SUBSTRING = 5; // CodForChk_Dis_Magic
+
+	/**
+	 * Start index of "namespace" substring in "usingnamespace" string
+	 */
+	private static final int START_INDEX_OF_NAMESPACE_SUBSTRING = 5; // CodForChk_Dis_Magic
+
+	/**
+	 * End index of "namespace" substring in "usingnamespace" string
+	 */
+	private static final int END_INDEX_OF_NAMESPACE_SUBSTRING = 14; // CodForChk_Dis_Magic
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parser
+	 *            the source parser
+	 */
+	ContextAreaParser(SourceParser parser) {
+		this.parser = parser;
+	}
+
+	/**
+	 * Resets the context areas
+	 */
+	void reset() {
+		contextAreas.clear();
+	}
+
+	/**
+	 * Returns the context at given offset
+	 * 
+	 * @param offset
+	 *            the offset to the source data
+	 * @return the context at the offset or null if no context exists
+	 * @throws SourceParserException
+	 *             if parser fails
+	 */
+	SourceContext parseAndGet(int offset) throws SourceParserException {
+		if (contextAreas.isEmpty()) {
+			parseAll();
+		}
+		int index = find(offset);
+		SourceContext context = null;
+		if (index >= 0) {
+			context = contextAreas.get(index);
+		}
+		return context;
+	}
+
+	/**
+	 * Gets the context areas. If the areas have not been parsed, this parses
+	 * them
+	 * 
+	 * @return the areas
+	 * @throws SourceParserException
+	 *             if parser fails
+	 */
+	Iterator<SourceContext> parseAndGetAll() throws SourceParserException {
+		if (contextAreas.isEmpty()) {
+			parseAll();
+		}
+		return contextAreas.iterator();
+	}
+
+	/**
+	 * Gets the context area list. This does not parse the areas
+	 * 
+	 * @return the list of context areas
+	 */
+	List<SourceContext> getContextList() {
+		return contextAreas;
+	}
+
+	/**
+	 * Finds the array index of the context area which contains the offset. If
+	 * none of the areas contain the offset, returns negative integer indicating
+	 * the index of the context area following the offset
+	 * 
+	 * @param offset
+	 *            the offset to the data
+	 * @return the context area index
+	 */
+	int find(int offset) {
+		return Collections.binarySearch(contextAreas, new SourceLocationBase(
+				parser, offset), arrayComparator);
+	}
+
+	/**
+	 * Builds the context array
+	 * 
+	 * @throws SourceParserException
+	 *             if parser fails
+	 */
+	void parseAll() throws SourceParserException { // CodForChk_Dis_ComplexFunc
+		contextAreas.clear();
+		char value;
+		
+		int inBrackets = 0;
+		int inContext = 0;
+		int inNamespace = 0;
+
+		int usingIndex = START_INDEX_OF_USING_SUBSTRING;
+		int usingKeywordEnd = 0;
+		int namespaceIndex = START_INDEX_OF_NAMESPACE_SUBSTRING;
+		int nameSpaceKeywordEnd = 0;
+		int previousIndexBeforeNamespace = 0;
+		boolean checkNextCharacter = false;
+
+		SourceContext context = null;
+		SourceIterator itr = parser.createIterator(0, SourceParser.SKIP_ALL);
+
+		while (itr.hasNext()) {
+			value = itr.next();
+
+			// Next character check is need only if we have found "namespace"
+			// text
+			if (checkNextCharacter) {
+
+				// Next character after "namespace" text should be space.
+				// Because we have skipped spaces, current index should be
+				// bigger than nameSpaceKeywordEnd + 1. If it is not space then
+				// we are not inside namespace
+				if (itr.currentIndex() - nameSpaceKeywordEnd < 2) { // CodForChk_Dis_Magic
+					inNamespace--;
+				}
+				checkNextCharacter = false;
+			}
+
+			// Check is character part of "using" text
+			if (value == USINGNAMESPACE.charAt(usingIndex)) {
+				usingIndex++;
+			} else {
+
+				// Character not part of "using" text -> reset usingIndex
+				usingIndex = START_INDEX_OF_USING_SUBSTRING;
+			}
+
+			// Check that did we found "using" text
+			if (usingIndex == END_INDEX_OF_USING_SUBSTRING) {
+				usingKeywordEnd = itr.currentIndex();
+				usingIndex = START_INDEX_OF_USING_SUBSTRING;
+			}
+
+			// Check is character part of "namespace" text
+			if (value == USINGNAMESPACE.charAt(namespaceIndex)) {
+				if (previousIndexBeforeNamespace == 0) {
+					previousIndexBeforeNamespace = itr.previousIndex();
+				}
+				namespaceIndex++;
+			} else {
+
+				// Character not part of "namespace" text -> reset
+				// previousIndexBeforeNamespace and namespaceIndex
+				previousIndexBeforeNamespace = 0;
+				namespaceIndex = START_INDEX_OF_NAMESPACE_SUBSTRING;
+			}
+
+			// Check that did we found "namespace" text
+			if (namespaceIndex == END_INDEX_OF_NAMESPACE_SUBSTRING) {
+				nameSpaceKeywordEnd = itr.currentIndex();
+
+				// If there was "using" text just before "namespace" text, then
+				// namespace is defined like: "using namespace foo;" and we are
+				// not going inside namespace brackets
+				if (usingKeywordEnd != previousIndexBeforeNamespace) {
+					inNamespace++;
+					checkNextCharacter = true;
+				}
+				namespaceIndex = START_INDEX_OF_NAMESPACE_SUBSTRING;
+			}
+
+			if (value == '{') {
+				inBrackets++;
+
+				// Check that are we inside namespace or context
+				if (inBrackets > inNamespace) {
+					inContext++;
+					if (inContext == 1) {
+						int start = itr.currentIndex() + 1;
+						context = new SourceContext(parser, start);
+
+						// Includes the '{' character into the context
+						if (!createContext(context, start - 2)) { // CodForChk_Dis_Magic
+							context = null;
+						}
+					}
+				}
+			} else if (value == '}') {
+				// Check that are we exiting from context or namespace
+				if (inBrackets == inNamespace) {
+					inNamespace--;
+				} else {
+					inContext--;
+					if (inContext == 0 && context != null) {
+						context.setLength(itr.currentIndex() + 1
+								- context.getOffset());
+						contextAreas.add(context);
+					}
+				}
+
+				inBrackets--;
+			}
+		}
+	}
+
+	/**
+	 * Sets the data to the source context
+	 * 
+	 * @param context
+	 *            the source context to be updated
+	 * @param offset
+	 *            the index preceeding the '{' character
+	 * @return true if valid, false otherwise
+	 * @throws SourceParserException
+	 *             if processing fails
+	 */
+	private boolean createContext(SourceContext context, int offset)
+			throws SourceParserException {
+		ContextSearchData data = new ContextSearchData();
+		data.itr = parser.createIterator(offset, SourceParser.BACKWARD_SEARCH
+				| SourceParser.SKIP_ALL);
+		data.context = context;
+		while (data.itr.hasNext() && !data.finished) {
+			char c = data.itr.next();
+			// Function start or stop character or statement separator breaks
+			// the search in normal case. In case of nested class separator
+			// character breaks the search.
+			if (c == ';' || c == '}' || c == '{'
+					|| (c == ':' && data.itr.peek() == ':')
+					&& data.classStartIndex != -1) {
+				processContextTerminator(context, data, false);
+			} else if (!data.parametersFound) {
+				processParametersNotFoundCharacter(data, c);
+			} else if (c == ')' || c == '(' || c == ','
+					|| (c == ':' && data.itr.peek() != ':')) {
+				// Constructor member initializer list may contain brackets, ','
+				// and ':'. When one of the characters from member initializer
+				// list is encountered, this assumes that the previous
+				// one was not the actual function parameter list yet. All
+				// variables are reset in that case
+				data.parametersFound = false;
+				data.functionEndIndex = -1;
+				data.functionStartIndex = -1;
+				data.classEndIndex = -1;
+				processParametersNotFoundCharacter(data, c);
+			} else if (data.functionEndIndex == -1) {
+				processFunctionNameNotFoundCharacter(data, c);
+			} else if (data.functionStartIndex == -1) {
+				processFunctionNameCharacter(context, data, c);
+			} else if (data.classEndIndex == -1) {
+				processClassNameNotFoundCharacter(data);
+			} else if (data.classStartIndex == -1) {
+				processClassNameCharacter(context, data, c);
+			} else {
+				processReturnTypeCharacter(context, data);
+			}
+		}
+		if (!data.finished) {
+			processContextTerminator(context, data, true);
+		}
+		return data.valid;
+	}
+
+	/**
+	 * Processes a character after class and function names have been found
+	 * 
+	 * @param context
+	 *            the context
+	 * @param data
+	 *            the search data
+	 * @throws SourceParserException
+	 *             if processing fails
+	 */
+	private void processReturnTypeCharacter(SourceContext context,
+			ContextSearchData data) throws SourceParserException {
+		if (data.itr.hasSkipped()) {
+			// Collects all return type candidates to the context
+			addReturnType(context, data.itr.previousIndex(),
+					data.returnEndIndex);
+			data.returnEndIndex = data.itr.currentIndex();
+		}
+	}
+
+	/**
+	 * Processes a character after function name has been found, but class name
+	 * has not yet been found
+	 * 
+	 * @param data
+	 *            the search flags
+	 */
+	private void processClassNameNotFoundCharacter(ContextSearchData data) {
+		// After start of function and the separator has been found, the
+		// next character marks the end of class name
+		data.classEndIndex = data.itr.currentIndex() + 1;
+	}
+
+	/**
+	 * Parses a character which belongs to the class name
+	 * 
+	 * @param context
+	 *            the source context to be parsed
+	 * @param data
+	 *            the context search parameters
+	 * @param c
+	 *            the character
+	 * @throws SourceParserException
+	 *             if processing fails
+	 */
+	private void processClassNameCharacter(SourceContext context,
+			ContextSearchData data, char c) throws SourceParserException {
+		if (data.itr.hasSkipped() || (c == ':' && data.itr.peek() == ':')) {
+			// Start of class name is found when iterator skips over
+			// white space or comment characters or in case of nested class
+			// separator character has been found
+			context.setFunctionName(parser.getSource().get(
+					data.functionStartIndex,
+					data.functionEndIndex - data.functionStartIndex));
+			data.classStartIndex = data.itr.previousIndex();
+			data.returnEndIndex = data.itr.currentIndex();
+			context.setClassName(parser.getSource().get(data.classStartIndex,
+					data.classEndIndex - data.classStartIndex));
+
+			// In case of nested class skips over the second ':'
+			if (c == ':' && data.itr.peek() == ':') {
+				data.itr.next();
+			}
+		}
+	}
+
+	/**
+	 * Processes a character while within function name
+	 * 
+	 * @param context
+	 *            the source context under processing
+	 * @param data
+	 *            the context search flags
+	 * @param c
+	 *            the character
+	 * @throws SourceParserException
+	 *             if processing fails
+	 */
+	private void processFunctionNameCharacter(SourceContext context,
+			ContextSearchData data, char c) throws SourceParserException {
+		// After end of function has been found the separator character
+		// marks the start of function
+		if (c == ':') {
+			if (data.itr.hasNext() && data.itr.peek() == ':') {
+				data.functionStartIndex = data.itr.previousIndex();
+				context.setFunctionName(parser.getSource().get(
+						data.functionStartIndex,
+						data.functionEndIndex - data.functionStartIndex));
+				// Skips over the second ':'
+				data.itr.next();
+			} else {
+				// Only one ':' character -> Invalid
+				data.finished = true;
+			}
+		} else if (data.itr.hasSkipped()) {
+			// If the iterator skipped over some characters and the next
+			// character is not ':' the function is a non-member
+			data.functionStartIndex = data.itr.previousIndex();
+			context.setFunctionName(parser.getSource().get(
+					data.functionStartIndex,
+					data.functionEndIndex - data.functionStartIndex));
+			// Class name indices are set so parser does not search for them
+			data.classStartIndex = data.itr.previousIndex();
+			data.classEndIndex = data.itr.previousIndex();
+			data.returnEndIndex = data.itr.currentIndex();
+		}
+	}
+
+	/**
+	 * Processes a character when function name has not yet been found
+	 * 
+	 * @param data
+	 *            the search flags
+	 * @param c
+	 *            the character to be processed
+	 */
+	private void processFunctionNameNotFoundCharacter(ContextSearchData data,
+			char c) {
+		// The next character after parameters is the end of function
+		if (c == ':') {
+			data.finished = true;
+		}
+		data.functionEndIndex = data.itr.currentIndex() + 1;
+	}
+
+	/**
+	 * Checks if the character is '(' or ')' and updates the parametersFound
+	 * flag accordingly
+	 * 
+	 * @param data
+	 *            the search data
+	 * @param c
+	 *            the current character
+	 */
+	private void processParametersNotFoundCharacter(ContextSearchData data,
+			char c) {
+		if (c == ')') {
+			data.inParameters++;
+		} else if (c == '(') {
+			data.inParameters--;
+			if (data.inParameters == 0) {
+				data.context.setParametersStartIndex(data.itr.currentIndex());
+				data.parametersFound = true;
+			}
+		}
+	}
+
+	/**
+	 * Processes a context terminating character
+	 * 
+	 * @param context
+	 *            the context under processing
+	 * @param data
+	 *            the search data
+	 * @param startOfFile
+	 *            context was terminated due to start of file
+	 * @throws SourceParserException
+	 *             if processing fails
+	 */
+	private void processContextTerminator(SourceContext context,
+			ContextSearchData data, boolean startOfFile)
+			throws SourceParserException {
+		int offset = startOfFile ? data.itr.currentIndex() : data.itr
+				.previousIndex();
+		if (data.classStartIndex != -1) {
+			addReturnType(context, offset, data.returnEndIndex);
+			data.valid = true;
+		} else if (data.classEndIndex != -1) {
+			context.setClassName(parser.getSource().get(offset,
+					data.classEndIndex - offset));
+			data.valid = true;
+		} else if (data.functionEndIndex != -1) {
+			context.setFunctionName(parser.getSource().get(offset,
+					data.functionEndIndex - offset));
+			data.valid = true;
+		}
+		// Finished flag is set. If function name was not found, the valid flag
+		// remains false
+		data.finished = true;
+	}
+
+	/**
+	 * Adds a return type to the context
+	 * 
+	 * @param context
+	 *            the context to be searched
+	 * @param start
+	 *            the start index
+	 * @param end
+	 *            the end index
+	 * @throws SourceParserException
+	 *             if return type cannot be added
+	 */
+	private void addReturnType(SourceContext context, int start, int end)
+			throws SourceParserException {
+		context.addReturnType(parser.getSource().get(start, end - start + 1));
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/ContextSearchData.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 search variables during SourceParser.createContext call
+*
+*/
+package com.nokia.tracebuilder.source;
+
+/**
+ * Contains search variables during SourceParser.createContext call
+ * 
+ */
+final class ContextSearchData {
+
+	/**
+	 * Index is currently in parameters
+	 */
+	int inParameters;
+
+	/**
+	 * Parameters have been found
+	 */
+	boolean parametersFound;
+
+	/**
+	 * Start of function name
+	 */
+	int functionStartIndex = -1;
+
+	/**
+	 * End of function name
+	 */
+	int functionEndIndex = -1;
+
+	/**
+	 * Start of class name
+	 */
+	int classStartIndex = -1;
+
+	/**
+	 * End of class name
+	 */
+	int classEndIndex = -1;
+
+	/**
+	 * End of return statement
+	 */
+	int returnEndIndex = -1;
+
+	/**
+	 * Context is valid
+	 */
+	boolean valid;
+
+	/**
+	 * Processing is finished
+	 */
+	boolean finished;
+
+	/**
+	 * The iterator
+	 */
+	SourceIterator itr;
+
+	/**
+	 * The context
+	 */
+	SourceContext context;
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/EnumSearchData.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 data for enum parser
+*
+*/
+package com.nokia.tracebuilder.source;
+
+import java.util.List;
+
+/**
+ * Search data for enum parser
+ * 
+ */
+final class EnumSearchData {
+
+	/**
+	 * Data iterator
+	 */
+	SourceIterator itr;
+
+	/**
+	 * Number of opening brackets
+	 */
+	int openBrackets;
+
+	/**
+	 * Validity flag
+	 */
+	boolean isValid;
+
+	/**
+	 * Current enum value
+	 */
+	StringValuePair currentEntry;
+
+	/**
+	 * Index to start of enum value name
+	 */
+	int nameStartIndex = -1;
+
+	/**
+	 * Index to the '=' separator
+	 */
+	int separatorIndex = -1;
+
+	/**
+	 * Index to start of enum value
+	 */
+	int valueStartIndex = -1;
+
+	/**
+	 * Previous enum value
+	 */
+	int previousValue = -1;
+
+	/**
+	 * Parser finished flag
+	 */
+	boolean finished;
+
+	/**
+	 * The list where enum values are stored
+	 */
+	List<StringValuePair> list;
+
+	/**
+	 * Latest character returned by the iterator
+	 */
+	char value;
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/ExcludedAreaParser.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,352 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Parser for comments and strings
+*
+*/
+package com.nokia.tracebuilder.source;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * Parser for comments and strings
+ * 
+ */
+final class ExcludedAreaParser {
+
+	/**
+	 * The check range is used to limit the effect of unterminated ' in code
+	 */
+	private static final int CHAR_CHECK_RANGE = 3; // CodForChk_Dis_Magic
+
+	/**
+	 * Source parser
+	 */
+	private SourceParser parser;
+
+	/**
+	 * List of source file areas that are not used in search
+	 */
+	private ArrayList<SourceExcludedArea> excludedAreas = new ArrayList<SourceExcludedArea>();
+
+	/**
+	 * Comparator for array sorting and searching
+	 */
+	private PositionArrayComparator arrayComparator = new PositionArrayComparator();
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parser
+	 *            the source parser
+	 */
+	ExcludedAreaParser(SourceParser parser) {
+		this.parser = parser;
+	}
+
+	/**
+	 * Resets the excluded areas
+	 */
+	void reset() {
+		excludedAreas.clear();
+	}
+
+	/**
+	 * Finds the array index of the excluded area which contains the offset. If
+	 * none of the areas contain the offset, returns negative integer indicating
+	 * the index of the excluded area following the offset
+	 * 
+	 * @param offset
+	 *            the offset to the data
+	 * @return the excluded area index
+	 */
+	int find(int offset) {
+		return Collections.binarySearch(excludedAreas, new SourceLocationBase(
+				parser, offset), arrayComparator);
+	}
+
+	/**
+	 * Finds the excluded source file areas. Excluded areas include comments and
+	 * quoted strings. Overwrites possible old areas.
+	 * 
+	 * @throws SourceParserException
+	 *             if processing fails
+	 */
+	void parseAll() throws SourceParserException {
+		excludedAreas.clear();
+		ExcludedAreaSearchData data = new ExcludedAreaSearchData();
+		int length = parser.getSource().getLength();
+		SourceExcludedArea lastarea = parse(data, length);
+		if (data.inString || data.inChar || data.inComment
+				|| data.inLineComment || data.inPreprocessor) {
+			lastarea.setLength(parser.getSource().getLength()
+					- lastarea.getOffset());
+			excludedAreas.add(lastarea);
+		}
+	}
+
+	/**
+	 * Parses the excluded areas of source
+	 * 
+	 * @param data
+	 *            the search data
+	 * @param length
+	 *            the length of data to be parsed
+	 * @return the last area
+	 * @throws SourceParserException
+	 *             if parser fails
+	 */
+	private SourceExcludedArea parse(ExcludedAreaSearchData data, int length)
+			throws SourceParserException {
+		SourceExcludedArea area = null;
+		while (data.index < length) {
+			data.value = parser.getSource().getChar(data.index++);
+			// Line comments end at end-of-line
+			if (data.inLineComment) {
+				processInLineComment(data, area);
+			} else if (data.inComment) {
+				processInComment(data, area);
+			} else if (data.inPreprocessor) {
+				processInPreprocessor(data, area);
+			} else if (data.inString) {
+				processInString(data, area);
+			} else if (data.inChar) {
+				processInChar(data, area);
+			} else if (data.value == '/' && data.index < length) {
+				area = createCommentArea(data);
+			} else if (data.value == '\"') {
+				area = createStringArea(data);
+			} else if (data.value == '\'') {
+				area = createCharArea(data);
+			} else if (data.value == '#'
+					&& (data.index == 1 || parser.getSource().getChar(
+							data.index - 2) == '\n')) { // CodForChk_Dis_Magic
+				area = createPreprocessorArea(data);
+			}
+		}
+		return area;
+	}
+
+	/**
+	 * Gets the excluded area that contains given offset
+	 * 
+	 * @param offset
+	 *            the offset to the area
+	 * @return the area or null if offset does not hit any area
+	 */
+	SourceExcludedArea getArea(int offset) {
+		SourceExcludedArea retval;
+		int index = find(offset);
+		if (index >= 0) {
+			retval = excludedAreas.get(index);
+		} else {
+			retval = null;
+		}
+		return retval;
+	}
+
+	/**
+	 * Gets the list of excluded areas
+	 * 
+	 * @return the list of areas
+	 */
+	List<SourceExcludedArea> getAreas() {
+		return excludedAreas;
+	}
+
+	/**
+	 * Processes a quote (') character marking start of character area
+	 * 
+	 * @param data
+	 *            the search flags
+	 * @return the new area
+	 */
+	private SourceExcludedArea createCharArea(ExcludedAreaSearchData data) {
+		SourceExcludedArea area;
+		data.inChar = true;
+		area = new SourceExcludedArea(parser, data.index - 1,
+				SourceExcludedArea.CHARACTER);
+		return area;
+	}
+
+	/**
+	 * Processes a double quote (") character marking start of string area
+	 * 
+	 * @param data
+	 *            the search flags
+	 * @return the new area
+	 */
+	private SourceExcludedArea createStringArea(ExcludedAreaSearchData data) {
+		SourceExcludedArea area;
+		data.inString = true;
+		area = new SourceExcludedArea(parser, data.index - 1,
+				SourceExcludedArea.STRING);
+		return area;
+	}
+
+	/**
+	 * Processes a forward slash (/) character marking start of comment
+	 * 
+	 * @param data
+	 *            the search flags
+	 * @return the comment object
+	 * @throws SourceParserException
+	 *             if processing fails
+	 */
+	private SourceExcludedArea createCommentArea(ExcludedAreaSearchData data)
+			throws SourceParserException {
+		SourceExcludedArea area;
+		char next = parser.getSource().getChar(data.index);
+		if (next == '/') {
+			data.inLineComment = true;
+			area = new SourceExcludedArea(parser, data.index - 1,
+					SourceExcludedArea.LINE_COMMENT);
+			data.index++;
+		} else if (next == '*') {
+			data.inComment = true;
+			area = new SourceExcludedArea(parser, data.index - 1,
+					SourceExcludedArea.MULTILINE_COMMENT);
+			data.index++;
+		} else {
+			area = null;
+		}
+		return area;
+	}
+
+	/**
+	 * Processes a preprocessor definition
+	 * 
+	 * @param data
+	 *            the search flags
+	 * @return the preprocessor area representation
+	 */
+	private SourceExcludedArea createPreprocessorArea(
+			ExcludedAreaSearchData data) {
+		SourceExcludedArea area = new SourceExcludedArea(parser,
+				data.index - 1, SourceExcludedArea.PREPROCESSOR_DEFINITION);
+		data.inPreprocessor = true;
+		return area;
+	}
+
+	/**
+	 * Processes a character that belongs to '' area
+	 * 
+	 * @param data
+	 *            the search flags
+	 * @param area
+	 *            the area under processing
+	 * @throws SourceParserException
+	 *             if processing fails
+	 */
+	private void processInChar(ExcludedAreaSearchData data,
+			SourceExcludedArea area) throws SourceParserException {
+		// The check range is used to limit the effect of unterminated '
+		if ((data.value == '\'' && parser.getSource().getChar(data.index - 2) != '\\') // CodForChk_Dis_Magic
+				|| data.index - area.getOffset() > CHAR_CHECK_RANGE) {
+			data.inChar = false;
+			area.setLength(data.index - area.getOffset());
+			excludedAreas.add(area);
+		}
+	}
+
+	/**
+	 * Processes a character that belongs to "" area
+	 * 
+	 * @param data
+	 *            the search flags
+	 * @param area
+	 *            the area under processing
+	 * @throws SourceParserException
+	 *             if processing fails
+	 */
+	private void processInString(ExcludedAreaSearchData data,
+			SourceExcludedArea area) throws SourceParserException {
+		// Strings end with " unless escaped with \" (except \\")
+		if (data.value == '\"') {
+			if (parser.getSource().getChar(data.index - 2) != '\\' // CodForChk_Dis_Magic
+					|| parser.getSource().getChar(data.index - 3) == '\\') { // CodForChk_Dis_Magic
+				data.inString = false;
+				area.setLength(data.index - area.getOffset());
+				excludedAreas.add(area);
+			}
+		}
+	}
+
+	/**
+	 * Processes a character that belongs to multi-line comment
+	 * 
+	 * @param data
+	 *            the search flags
+	 * @param area
+	 *            the area under processing
+	 * @throws SourceParserException
+	 *             if processing fails
+	 */
+	private void processInComment(ExcludedAreaSearchData data,
+			SourceExcludedArea area) throws SourceParserException {
+		// Comments end with */
+		if (data.value == '*') {
+			if (data.index < parser.getSource().getLength()
+					&& parser.getSource().getChar(data.index) == '/') {
+				data.index++;
+				data.inComment = false;
+				area.setLength(data.index - area.getOffset());
+				excludedAreas.add(area);
+			}
+		}
+	}
+
+	/**
+	 * Processes a character that belongs to line comment
+	 * 
+	 * @param data
+	 *            the search flags
+	 * @param area
+	 *            the area under processing
+	 */
+	private void processInLineComment(ExcludedAreaSearchData data,
+			SourceExcludedArea area) {
+		if (data.value == '\n') {
+			data.inLineComment = false;
+			area.setLength(data.index - area.getOffset());
+			excludedAreas.add(area);
+		}
+	}
+
+	/**
+	 * Processes a character that belongs to preprocessor definition
+	 * 
+	 * @param data
+	 *            the search flags
+	 * @param area
+	 *            the area under processing
+	 * @throws SourceParserException
+	 *             if processing fails
+	 */
+	private void processInPreprocessor(ExcludedAreaSearchData data,
+			SourceExcludedArea area) throws SourceParserException {
+		if (data.value == '\n') {
+			char prev = parser.getSource().getChar(data.index - 2); // CodForChk_Dis_Magic
+			char prev2 = parser.getSource().getChar(data.index - 3); // CodForChk_Dis_Magic
+			if (!((prev == '\\') || (prev == '\r' && prev2 == '\\'))) {
+				data.inPreprocessor = false;
+				area.setLength(data.index - area.getOffset());
+				excludedAreas.add(area);
+			}
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/ExcludedAreaSearchData.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 search variables during SourceParser.findExcludedAreas call
+*
+*/
+package com.nokia.tracebuilder.source;
+
+/**
+ * Contains search variables during SourceParser.findExcludedAreas call
+ * 
+ */
+final class ExcludedAreaSearchData {
+
+	/**
+	 * Data index
+	 */
+	int index;
+
+	/**
+	 * Current character
+	 */
+	char value;
+
+	/**
+	 * Within line comment flag
+	 */
+	boolean inLineComment;
+
+	/**
+	 * Within comment flag
+	 */
+	boolean inComment;
+
+	/**
+	 * Within string flag
+	 */
+	boolean inString;
+
+	/**
+	 * Within character flag
+	 */
+	boolean inChar;
+
+	/**
+	 * Within preprocessor definition flag
+	 */
+	boolean inPreprocessor;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/FormatMapping.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Format to parameter type mapping
+*
+*/
+package com.nokia.tracebuilder.source;
+
+/**
+ * Type returned by {@link SourceUtils#mapFormatToParameterType(String)}
+ * 
+ */
+public final class FormatMapping {
+
+	/**
+	 * The type
+	 */
+	public String type;
+
+	/**
+	 * Array type flag
+	 */
+	public boolean isArray;
+
+	/**
+	 * Simple 32-bit type flag
+	 */
+	public boolean isSimple;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param type
+	 *            the type
+	 */
+	public FormatMapping(String type) {
+		this.type = type;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/FunctionReturnValueParser.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,317 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Parser for function return values
+*
+*/
+package com.nokia.tracebuilder.source;
+
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * Parser for function return values
+ * 
+ */
+class FunctionReturnValueParser {
+
+	/**
+	 * Source parser
+	 */
+	private SourceParser parser;
+
+	/**
+	 * Comparator for source return values
+	 */
+	private PositionArrayComparator comparator = new PositionArrayComparator();
+
+	/**
+	 * Macros representing return statement
+	 */
+	private List<String> returnExtensions;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parser
+	 *            the source parser
+	 */
+	FunctionReturnValueParser(SourceParser parser) {
+		this.parser = parser;
+	}
+
+	/**
+	 * Parses the return values of given source context
+	 * 
+	 * @param context
+	 *            the context to be parsed
+	 * @param list
+	 *            the list of return values
+	 */
+	void parseReturnValues(SourceContext context, List<SourceReturn> list) {
+		String statement = SourceConstants.RETURN;
+		try {
+			parseReturnValues(context, list, statement);
+		} catch (SourceParserException e) {
+		}
+		if (returnExtensions != null && returnExtensions.size() > 0) {
+			for (int i = 0; i < returnExtensions.size(); i++) {
+				try {
+					parseReturnValues(context, list, returnExtensions.get(i));
+				} catch (SourceParserException e) {
+				}
+			}
+			Collections.sort(list, comparator);
+		}
+		if (context.isVoid()) {
+			boolean addToEnd = true;
+			// If there were no return statements, the trace is added to end
+			// Otherwise the last return statement needs to be checked. If it is
+			// at the end of the function, the return trace is not added to
+			// the end
+			if (!list.isEmpty()) {
+				SourceReturn ret = list.get(list.size() - 1);
+				SourceIterator itr = parser.createIterator(ret.getOffset()
+						+ ret.getLength() + 1, SourceParser.SKIP_ALL);
+				try {
+					itr.next();
+					// If the next character after return statement is the end
+					// of function, the return is not added
+					if (itr.currentIndex() == context.getOffset()
+							+ context.getLength() - 1) {
+						addToEnd = false;
+					}
+				} catch (SourceParserException e) {
+					addToEnd = false;
+				}
+			}
+			if (addToEnd) {
+				list.add(new SourceReturn(parser, context.getOffset()
+						+ context.getLength() - 1, 0));
+			}
+		}
+	}
+
+	/**
+	 * Parses the return values of given source context that use the given
+	 * return statement
+	 * 
+	 * @param context
+	 *            the context to be parsed
+	 * @param list
+	 *            the list of return values
+	 * @param statement
+	 *            the return statement
+	 * @throws SourceParserException
+	 *             if processing fails
+	 */
+	private void parseReturnValues(SourceContext context,
+			List<SourceReturn> list, String statement)
+			throws SourceParserException {
+		FunctionReturnValueSearchData data = new FunctionReturnValueSearchData();
+		int offset = context.getOffset();
+		int end = offset + context.getLength();
+		SourceSearch search = parser.startStringSearch(statement, offset, end,
+				SourceParser.MATCH_WHOLE_WORD | SourceParser.SKIP_ALL);
+		boolean looping = true;
+		do {
+			data.index = search.findNext();
+			if (data.index != -1) {
+				data.itr = parser.createIterator(data.index
+						+ statement.length(), SourceParser.SKIP_ALL);
+				locateReturnStatement(data);
+				if (data.endOffset != -1 && data.startOffset != -1) {
+					SourceReturn ret = createReturnStatement(data);
+					list.add(ret);
+				} else {
+					// End of return statement missing
+					looping = false;
+				}
+			} else {
+				looping = false;
+			}
+		} while (looping);
+	}
+
+	/**
+	 * Locates the start and end offsets for the return statement
+	 * 
+	 * @param data
+	 *            the search data
+	 * @throws SourceParserException
+	 *             if parser fails
+	 */
+	private void locateReturnStatement(FunctionReturnValueSearchData data)
+			throws SourceParserException {
+		data.startOffset = -1;
+		data.endOffset = -1;
+		boolean found = false;
+		boolean colonAllowed = false;
+		while (data.itr.hasNext() && !found) {
+			char c = data.itr.next();
+			if (c == ';') {
+				data.endOffset = data.itr.previousIndex() + 1;
+				found = true;
+			} else if (c == '}') {
+				found = true;
+			} else if (c == '?') {
+				colonAllowed = true;
+			} else if (c == ':') {
+				if (data.itr.hasNext() && data.itr.peek() == ':') {
+					// Skips over ::
+					c = data.itr.next();
+				} else {
+					if (colonAllowed) {
+						colonAllowed = false;
+					} else {
+						data.endOffset = data.itr.previousIndex() + 1;
+						found = true;
+					}
+				}
+			}
+			if (data.startOffset == -1) {
+				data.startOffset = data.itr.currentIndex();
+			}
+		}
+	}
+
+	/**
+	 * Creates a return statement
+	 * 
+	 * @param data
+	 *            the parser data
+	 * @return the new statement
+	 * @throws SourceParserException
+	 *             if parser fails
+	 */
+	private SourceReturn createReturnStatement(
+			FunctionReturnValueSearchData data) throws SourceParserException {
+		SourceReturn ret = new SourceReturn(parser, data.startOffset,
+				data.endOffset - data.startOffset);
+		if (checkTag(data.startOffset, data.endOffset - data.startOffset)) {
+			ret.setTagHazard();
+		}
+		if (checkPreviousChar(data.index - 1)) {
+			ret.setPreviousCharHazard();
+		}
+		return ret;
+	}
+
+	/**
+	 * Checks if the tag is hazardous
+	 * 
+	 * @param start
+	 *            start offset
+	 * @param length
+	 *            tag length
+	 * @return true if there is a problem
+	 */
+	private boolean checkTag(int start, int length) {
+		boolean hazard = false;
+		boolean previous = false;
+		// Function calls and increment / decrement operators are not safe
+		for (int i = start; i < start + length && !hazard; i++) {
+			char c = parser.getData(i);
+			if (c == '(') {
+				// If return statement is within brackets, it is not hazardous
+				if (i != start || parser.getData(start + length - 1) != ')') {
+					hazard = true;
+				}
+			} else if (c == '?') {
+				hazard = true;
+			} else if (c == '-' || c == '+') {
+				if (previous) {
+					hazard = true;
+				} else {
+					previous = true;
+				}
+			} else {
+				previous = false;
+			}
+		}
+		return hazard;
+	}
+
+	/**
+	 * Checks if previous character is hazardous
+	 * 
+	 * @param index
+	 *            the index
+	 * @return true if hazard, false if not
+	 * @throws SourceParserException
+	 *             if processing fails
+	 */
+	private boolean checkPreviousChar(int index) throws SourceParserException {
+		boolean hazard = false;
+		SourceIterator previtr = parser.createIterator(index,
+				SourceParser.SKIP_ALL | SourceParser.BACKWARD_SEARCH);
+		char prevchar = previtr.next();
+		if (prevchar != ';' && prevchar != '{' && prevchar != '}') {
+			hazard = true;
+		}
+		return hazard;
+	}
+
+	/**
+	 * Finds the last return statement from the given context
+	 * 
+	 * @param context
+	 *            the context
+	 * @return the index to beginning of the return statement
+	 */
+	int findLast(SourceContext context) {
+		String statement = SourceConstants.RETURN;
+		int retval = findLast(context, statement);
+		if (returnExtensions != null && returnExtensions.size() > 0) {
+			int res;
+			for (int i = 0; i < returnExtensions.size(); i++) {
+				res = findLast(context, returnExtensions.get(i));
+				if (res > retval) {
+					retval = res;
+				}
+			}
+		}
+		if (retval == -1) {
+			retval = context.getOffset() + context.getLength();
+		}
+		return retval;
+	}
+
+	/**
+	 * Finds the last return statement from the given context
+	 * 
+	 * @param context
+	 *            the context
+	 * @param statement
+	 *            the statement to be searched
+	 * @return the index to beginning of the return statement
+	 */
+	private int findLast(SourceContext context, String statement) {
+		// TODO: Backwards string search
+		int start = context.getOffset();
+		int end = start + context.getLength();
+		SourceSearch search = parser.startStringSearch(statement, start, end,
+				SourceParser.MATCH_WHOLE_WORD | SourceParser.SKIP_ALL);
+		int index = 0;
+		int retval = -1;
+		do {
+			index = search.findNext();
+			if (index != -1) {
+				retval = index;
+			}
+		} while (index != -1);
+		return retval;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/FunctionReturnValueSearchData.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Parser for function return values
+*
+*/
+package com.nokia.tracebuilder.source;
+
+/**
+ * Parse data for function return value parser
+ * 
+ */
+final class FunctionReturnValueSearchData {
+
+	/**
+	 * Data index
+	 */
+	int index;
+
+	/**
+	 * Iterator
+	 */
+	SourceIterator itr;
+
+	/**
+	 * Return statement start offset
+	 */
+	int startOffset;
+
+	/**
+	 * Return statement end offset
+	 */
+	int endOffset;
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/OffsetLength.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Wrapper for offset and length
+*
+*/
+package com.nokia.tracebuilder.source;
+
+/**
+ * Wrapper for offset and length
+ * 
+ */
+public final class OffsetLength {
+
+	/**
+	 * Offset
+	 */
+	public int offset;
+
+	/**
+	 * Length
+	 */
+	public int length;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/ParsedType.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 types parsed from source files
+*
+*/
+package com.nokia.tracebuilder.source;
+
+/**
+ * Interface for types parsed from source files
+ * 
+ */
+public interface ParsedType {
+
+	/**
+	 * Checks if parameter is pointer (*) or pointer reference (*&)
+	 * 
+	 * @return true if pointer, false if not
+	 */
+	public boolean isPointer();
+
+	/**
+	 * Checks if parameter type equals given type
+	 * 
+	 * @param type
+	 *            the type to be checked
+	 * @return true if types match
+	 */
+	public boolean typeEquals(String type);
+
+	/**
+	 * Checks if the type has the given qualifier
+	 * 
+	 * @param qualifier
+	 *            the qualifier to be checked
+	 * @return true if qualifier exists, false if not
+	 */
+	public boolean hasQualifier(String qualifier);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/PositionArrayComparator.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Comparator for position arrays
+*
+*/
+package com.nokia.tracebuilder.source;
+
+import java.util.Comparator;
+
+/**
+ * Comparator for position arrays
+ * 
+ */
+public final class PositionArrayComparator implements
+		Comparator<SourceLocationBase> {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+	 */
+	public int compare(SourceLocationBase arrayElement, SourceLocationBase key) {
+		int retval;
+		if (key.getOffset() < arrayElement.getOffset()) {
+			// Start is inclusive
+			retval = 1;
+		} else if (key.getOffset() >= arrayElement.getOffset()
+				+ arrayElement.getLength()) {
+			// End is exclusive
+			retval = -1;
+		} else {
+			retval = 0;
+		}
+		return retval;
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/PreprocessorDefinitionParser.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,278 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Parser for preprocessor definitions and include statements
+*
+*/
+package com.nokia.tracebuilder.source;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+/**
+ * Parser for preprocessor definitions and include statements
+ * 
+ */
+class PreprocessorDefinitionParser {
+
+	/**
+	 * Source parser
+	 */
+	private SourceParser parser;
+
+	/**
+	 * List of #define's found from source
+	 */
+	protected ArrayList<SourcePreprocessorDefinition> preprocessorDefinitions;
+
+	/**
+	 * List of #include's found from source
+	 */
+	protected ArrayList<SourceInclude> includes;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parser
+	 *            the source parser
+	 */
+	PreprocessorDefinitionParser(SourceParser parser) {
+		this.parser = parser;
+	}
+
+	/**
+	 * Resets all definitions parsed from the source
+	 */
+	void reset() {
+		if (preprocessorDefinitions != null) {
+			preprocessorDefinitions.clear();
+		}
+		if (includes != null) {
+			includes.clear();
+		}
+	}
+
+	/**
+	 * Locates the value of a preprocessor definition for given name.
+	 * 
+	 * @param name
+	 *            the name of the definition
+	 * @return the value or null if not found
+	 * @throws SourceParserException
+	 *             if parser fails
+	 */
+	String findDefine(String name) throws SourceParserException {
+		if (preprocessorDefinitions == null
+				|| preprocessorDefinitions.isEmpty()) {
+			createDefines();
+		}
+		Iterator<SourcePreprocessorDefinition> itr = preprocessorDefinitions
+				.iterator();
+		String retval = null;
+		while (itr.hasNext() && retval == null) {
+			SourcePreprocessorDefinition def = itr.next();
+			if (def.getName().equals(name)) {
+				retval = def.getValue();
+			}
+		}
+		return retval;
+	}
+
+	/**
+	 * Finds an include definition with given name
+	 * 
+	 * @param name
+	 *            the include file name
+	 * @return
+	 *            <ul>
+	 *            <li>if found, index to start of #include
+	 *            <li>if not, -1 - index to end of last #include
+	 *            </ul>
+	 * @throws SourceParserException
+	 *             if parser fails
+	 */
+	int findInclude(String name) throws SourceParserException {
+
+		createIncludes();
+
+		Iterator<SourceInclude> itr = includes.iterator();
+		int ret = -1;
+		while (itr.hasNext()) {
+			SourceInclude inc = itr.next();
+			if (inc.getHeaderName().equalsIgnoreCase(name)) {
+				ret = inc.getOffset();
+			}
+		}
+		if (ret == -1 && includes.size() > 0) {
+			SourceInclude inc = includes.get(includes.size() - 1);
+			ret = -1 - (inc.getOffset() + inc.getLength());
+		}
+		return ret;
+	}
+
+	/**
+	 * Creates the list of preprocessor definitions. This only works with simple
+	 * values
+	 * 
+	 * @throws SourceParserException
+	 *             if parser fails
+	 */
+	private void createDefines() throws SourceParserException {
+		if (preprocessorDefinitions == null) {
+			preprocessorDefinitions = new ArrayList<SourcePreprocessorDefinition>();
+		} else {
+			preprocessorDefinitions.clear();
+		}
+		Iterator<SourceExcludedArea> excludedAreas = parser.getExcludedAreas()
+				.iterator();
+		while (excludedAreas.hasNext()) {
+			createDefineFromExcludedArea(excludedAreas.next());
+		}
+	}
+
+	/**
+	 * Creates the list of include definitions
+	 * 
+	 * @throws SourceParserException
+	 *             if parser fails
+	 */
+	private void createIncludes() throws SourceParserException {
+		if (includes == null) {
+			includes = new ArrayList<SourceInclude>();
+		} else {
+			includes.clear();
+		}
+		Iterator<SourceExcludedArea> excludedAreas = parser.getExcludedAreas()
+				.iterator();
+		while (excludedAreas.hasNext()) {
+			createIncludeFromExcludedArea(excludedAreas.next());
+		}
+	}
+
+	/**
+	 * Creates an #define definition from given excluded area
+	 * 
+	 * @param area
+	 *            the area
+	 * @throws SourceParserException
+	 */
+	private void createDefineFromExcludedArea(SourceExcludedArea area)
+			throws SourceParserException {
+		if (area.getType() == SourceExcludedArea.PREPROCESSOR_DEFINITION
+				&& area.getLength() > SourceConstants.DEFINE.length()) {
+			String tag = parser.getSource().get(area.getOffset(),
+					SourceConstants.DEFINE.length());
+			if (tag.equals(SourceConstants.DEFINE)) {
+				// Cannot use SKIP_ALL here, since it contains SKIP_PREPROCESSOR
+				SourceIterator itr = parser.createIterator(area.getOffset()
+						+ SourceConstants.DEFINE.length(),
+						SourceParser.SKIP_WHITE_SPACES
+								| SourceParser.SKIP_COMMENTS);
+				if (itr.hasNext()) {
+					parsePreprocessorDefinition(itr);
+				}
+			}
+		}
+	}
+
+	/**
+	 * Creates an #include definition from given excluded area
+	 * 
+	 * @param area
+	 *            the area
+	 * @throws SourceParserException
+	 *             if parser fails
+	 */
+	private void createIncludeFromExcludedArea(SourceExcludedArea area)
+			throws SourceParserException {
+		if (area.getType() == SourceExcludedArea.PREPROCESSOR_DEFINITION
+				&& area.getLength() > SourceConstants.INCLUDE.length()) {
+			String tag = parser.getSource().get(area.getOffset(),
+					SourceConstants.INCLUDE.length());
+			if (tag.equals(SourceConstants.INCLUDE)) {
+				// Cannot use SKIP_ALL here, since it contains SKIP_PREPROCESSOR
+				SourceIterator itr = parser.createIterator(area.getOffset()
+						+ SourceConstants.INCLUDE.length(),
+						SourceParser.SKIP_WHITE_SPACES
+								| SourceParser.SKIP_COMMENTS);
+				if (itr.hasNext()) {
+					parseInclude(itr);
+				}
+			}
+		}
+	}
+
+	/**
+	 * Parses a preprocessor definition. This only finds simple values
+	 * 
+	 * @param itr
+	 *            source iterator, positioned so that next will return the first
+	 *            character of the name of the definition
+	 * @throws SourceParserException
+	 *             if parser fails
+	 */
+	private void parsePreprocessorDefinition(SourceIterator itr)
+			throws SourceParserException {
+		int start = itr.nextIndex();
+		int defstart = -1;
+		SourcePreprocessorDefinition def = new SourcePreprocessorDefinition(
+				parser, start);
+		while (itr.hasNext() && def != null) {
+			itr.next();
+			if (itr.hasSkipped()) {
+				if (defstart == -1) {
+					if ((itr.previousIndex() + 1) > start) {
+						def.setName(parser.getSource().get(start,
+								itr.previousIndex() + 1 - start));
+						defstart = itr.currentIndex();
+					} else {
+						def = null;
+					}
+				} else {
+					def.setValue(parser.getSource().get(defstart,
+							itr.previousIndex() + 1 - defstart));
+					def.setLength(itr.previousIndex() + 1 - def.getOffset());
+					preprocessorDefinitions.add(def);
+					def = null;
+				}
+			}
+		}
+	}
+
+	/**
+	 * Parses an include line
+	 * 
+	 * @param itr
+	 *            source iterator, positioned so that next will return the first
+	 *            character of the name of the definition
+	 * @throws SourceParserException
+	 *             if parser fails
+	 */
+	private void parseInclude(SourceIterator itr) throws SourceParserException {
+		int start = itr.nextIndex();
+		SourceInclude inc = new SourceInclude(parser, start);
+		while (itr.hasNext() && inc != null) {
+			itr.next();
+			if (itr.hasSkipped() && (itr.previousIndex()) > (start + 1)) {
+				inc.setHeaderName(parser.getSource().get(start + 1,
+						itr.previousIndex() - (start + 1)));
+				inc.setLength(itr.previousIndex() - inc.getOffset() + 1);
+				includes.add(inc);
+				inc = null;
+			}
+		}
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceConstants.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,435 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 related to source files
+*
+*/
+package com.nokia.tracebuilder.source;
+
+/**
+ * Constants related to source files
+ * 
+ */
+public interface SourceConstants {
+
+	/**
+	 * Space character as string
+	 */
+	final String SPACE = " "; //$NON-NLS-1$
+
+	/**
+	 * Quote character as string
+	 */
+	final String QUOTE = "\""; //$NON-NLS-1$
+
+	/**
+	 * '\' character as string
+	 */
+	final String BACKSLASH = "\\"; //$NON-NLS-1$
+
+	/**
+	 * '_' character as string
+	 */
+	final String UNDERSCORE = "_"; //$NON-NLS-1$
+
+	/**
+	 * Double underscore for header guards
+	 */
+	final String DOUBLE_UNDERSCORE = "__"; //$NON-NLS-1$
+
+	/**
+	 * Semicolon character as string
+	 */
+	final String SEMICOLON = ";"; //$NON-NLS-1$
+
+	/**
+	 * Colon character as string
+	 */
+	final String COLON = ":"; //$NON-NLS-1$
+
+	/**
+	 * Period character as string
+	 */
+	final String PERIOD = "."; //$NON-NLS-1$
+
+	/**
+	 * Tilde character as string
+	 */
+	final String TILDE = "~"; //$NON-NLS-1$
+
+	/**
+	 * Opening brace as string
+	 */
+	final String OPENING_BRACE = "{"; //$NON-NLS-1$
+
+	/**
+	 * Closing brace as string
+	 */
+	final String CLOSING_BRACE = "}"; //$NON-NLS-1$
+
+	/**
+	 * Asterisk character
+	 */
+	final String ASTERISK = "*"; //$NON-NLS-1$
+
+	/**
+	 * Space character
+	 */
+	final char SPACE_CHAR = ' ';
+
+	/**
+	 * Quote character
+	 */
+	final char QUOTE_CHAR = '\"';
+
+	/**
+	 * '\' character
+	 */
+	final char BACKSLASH_CHAR = '\\';
+
+	/**
+	 * '/' character
+	 */
+	final char FORWARD_SLASH_CHAR = '/';
+
+	/**
+	 * '_' character
+	 */
+	final char UNDERSCORE_CHAR = '_';
+
+	/**
+	 * '.' character
+	 */
+	final char PERIOD_CHAR = '.';
+
+	/**
+	 * Line feed (\r\n)
+	 */
+	final String LINE_FEED = "\r\n"; //$NON-NLS-1$
+
+	/**
+	 * Header extension (.h)
+	 */
+	final String HEADER_EXTENSION = ".h"; //$NON-NLS-1$
+
+	/**
+	 * #define
+	 */
+	final String DEFINE = "#define"; //$NON-NLS-1$
+
+	/**
+	 * #undef
+	 */
+	final String UNDEF = "#undef"; //$NON-NLS-1$
+
+	/**
+	 * #include
+	 */
+	final String INCLUDE = "#include"; //$NON-NLS-1$
+
+	/**
+	 * #ifdef
+	 */
+	final String IFDEF = "#ifdef"; //$NON-NLS-1$
+
+	/**
+	 * #ifndef
+	 */
+	final String IFNDEF = "#ifndef"; //$NON-NLS-1$
+
+	/**
+	 * #if
+	 */
+	final String IF = "#if"; //$NON-NLS-1$
+
+	/**
+	 * defined
+	 */
+	final String DEFINED = "defined"; //$NON-NLS-1$
+
+	/**
+	 * #else
+	 */
+	final String ELSE = "#else"; //$NON-NLS-1$
+
+	/**
+	 * #endif
+	 */
+	final String ENDIF = "#endif"; //$NON-NLS-1$
+
+	/**
+	 * Or
+	 */
+	final String OR = "||"; //$NON-NLS-1$
+
+	/**
+	 * Return statement
+	 */
+	final String RETURN = "return"; //$NON-NLS-1$
+
+	/**
+	 * One step up in path ("../")
+	 */
+	final String PATH_UP = "../"; //$NON-NLS-1$
+
+	/**
+	 * This path ("./")
+	 */
+	final String THIS_PATH = "./"; //$NON-NLS-1$
+
+	/**
+	 * inline
+	 */
+	final String INLINE = "inline"; //$NON-NLS-1$
+
+	/**
+	 * void
+	 */
+	final String VOID = "void"; //$NON-NLS-1$
+
+	/**
+	 * char
+	 */
+	final String CHAR = "char"; //$NON-NLS-1$
+
+	/**
+	 * short
+	 */
+	final String SHORT = "short"; //$NON-NLS-1$
+
+	/**
+	 * int
+	 */
+	final String INT = "int"; //$NON-NLS-1$
+
+	/**
+	 * long
+	 */
+	final String LONG = "long"; //$NON-NLS-1$
+
+	/**
+	 * unsigned
+	 */
+	final String UNSIGNED = "unsigned"; //$NON-NLS-1$
+
+	/**
+	 * Parameter type qualifier list
+	 */
+	final String[] PARAMETER_QUALIFIERS = { "const", //$NON-NLS-1$
+			"volatile", UNSIGNED }; //$NON-NLS-1$
+
+	/**
+	 * No parameters
+	 */
+	final String NO_PARAMETERS = "()"; //$NON-NLS-1$
+
+	/**
+	 * Start of parameters
+	 */
+	final String START_PARAMETERS = "( "; //$NON-NLS-1$
+
+	/**
+	 * Start of parameters with quote
+	 */
+	final String START_PARAMETERS_QUOTE = "( \""; //$NON-NLS-1$
+
+	/**
+	 * Closing parenthesis with non-quoted last parameter
+	 */
+	final String END_PARAMETERS = " )"; //$NON-NLS-1$
+
+	/**
+	 * Closing parenthesis with quoted last parameter
+	 */
+	final String END_PARAMETERS_QUOTE = "\" )"; //$NON-NLS-1$
+
+	/**
+	 * Separator between end of quoted parameter and start of non-quoted
+	 * parameter
+	 */
+	final String QUOTE_PARAMETER_SEPARATOR = "\", "; //$NON-NLS-1$
+
+	/**
+	 * Separator between two parameters without quotes
+	 */
+	final String PARAMETER_SEPARATOR = ", "; //$NON-NLS-1$
+
+	/**
+	 * Separator within for
+	 */
+	final String FOR_SEPARATOR = "; "; //$NON-NLS-1$
+
+	/**
+	 * Separator between end of non-quoted parameter and start of quoted
+	 * parameter
+	 */
+	final String PARAMETER_SEPARATOR_QUOTE = ", \""; //$NON-NLS-1$
+
+	/**
+	 * if and the opening parenthesis
+	 */
+	final String START_IF = "if ( "; //$NON-NLS-1$
+
+	/**
+	 * Sizeof and the opening parenthesis
+	 */
+	final String START_SIZEOF = "sizeof ( "; //$NON-NLS-1$
+
+	/**
+	 * for and the opening parenthesis
+	 */
+	final String START_FOR = "for ( "; //$NON-NLS-1$
+
+	/**
+	 * Assignment operation with spaces
+	 */
+	final String ASSIGN = " = "; //$NON-NLS-1$
+
+	/**
+	 * Less of equals for if-statements
+	 */
+	final String LESS_OR_EQUAL_THAN = " <= "; //$NON-NLS-1$
+
+	/**
+	 * Less for if statements
+	 */
+	final String LESS_THAN = " < "; //$NON-NLS-1$
+
+	/**
+	 * Starting bracket for array
+	 */
+	final String START_ARRAY = "[ "; //$NON-NLS-1$
+
+	/**
+	 * Ending bracket for array
+	 */
+	final String END_ARRAY = " ]"; //$NON-NLS-1$
+
+	/**
+	 * Pointer and space
+	 */
+	final String POINTER = "* "; //$NON-NLS-1$
+
+	/**
+	 * Add operation with spaces
+	 */
+	final String ADD = " + "; //$NON-NLS-1$
+
+	/**
+	 * Modulo operation with spaces
+	 */
+	final String MOD = " % "; //$NON-NLS-1$
+
+	/**
+	 * Subtract with assignment
+	 */
+	final String SUBTRACT_ASSIGN = " -= "; //$NON-NLS-1$
+
+	/**
+	 * Add with assignment
+	 */
+	final String ADD_ASSIGN = " += "; //$NON-NLS-1$
+
+	/**
+	 * Not equal check
+	 */
+	final String NOT_EQUALS = " != "; //$NON-NLS-1$
+
+	/**
+	 * Equal check
+	 */
+	final String EQUALS = " == "; //$NON-NLS-1$
+
+	/**
+	 * Increment operation
+	 */
+	final String INCREMENT = "++"; //$NON-NLS-1$
+
+	/**
+	 * Subtract operation with spaces
+	 */
+	final String SUBTRACT = " - "; //$NON-NLS-1$
+
+	/**
+	 * class
+	 */
+	final String CLASS = "class"; //$NON-NLS-1$
+
+	/**
+	 * public
+	 */
+	final String PUBLIC = "public"; //$NON-NLS-1$
+
+	/**
+	 * private
+	 */
+	final String PRIVATE = "private"; //$NON-NLS-1$
+
+	/**
+	 * Prefix for hex numbers
+	 */
+	final String HEX_PREFIX = "0x"; //$NON-NLS-1$
+
+	/**
+	 * Prefix for hex numbers, upper case
+	 */
+	final String HEX_PREFIX_U = "0X"; //$NON-NLS-1$
+
+	/**
+	 * Prefix for octal numbers
+	 */
+	final String OCTAL_PREFIX = "0"; //$NON-NLS-1$
+
+	/**
+	 * 64-bit integer postfix
+	 */
+	final String I64_POSTFIX = "i64"; //$NON-NLS-1$
+
+	/**
+	 * Size of long integer
+	 */
+	final int LONG_SIZE = 64; // CodForChk_Dis_Magic
+
+	/**
+	 * Size of integer
+	 */
+	final int INT_SIZE = 32; // CodForChk_Dis_Magic
+
+	/**
+	 * Size of short
+	 */
+	final int SHORT_SIZE = 16; // CodForChk_Dis_Magic
+
+	/**
+	 * Size of byte
+	 */
+	final int BYTE_SIZE = 8; // CodForChk_Dis_Magic
+
+	/**
+	 * Array type prefix
+	 */
+	final String OST_ARRAY_TYPE_PREFIX = "const TOstArray< "; //$NON-NLS-1$
+
+	/**
+	 * Array type postfix
+	 */
+	final String OST_ARRAY_TYPE_POSTFIX = " >&"; //$NON-NLS-1$
+	
+	/**
+	 * Variable argument list indicator
+	 */
+	final String VARIABLE_ARG_LIST_INDICATOR = "..."; //$NON-NLS-1$
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceContext.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,320 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Source context is a representation of a range of source code
+*
+*/
+package com.nokia.tracebuilder.source;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * Source context is a representation of a range of source code. For example a
+ * function in source code could be represented with a context that has the name
+ * of the function
+ * 
+ */
+public class SourceContext extends SourceLocationBase implements ParsedType {
+
+	/**
+	 * No proposal
+	 */
+	public static final int NONE = 0; // CodForChk_Dis_Magic
+
+	/**
+	 * Start of function proposal type
+	 */
+	public static final int START_OF_FUNCTION = 1; // CodForChk_Dis_Magic
+
+	/**
+	 * End of function proposal type
+	 */
+	public static final int END_OF_FUNCTION = 2; // CodForChk_Dis_Magic
+
+	/**
+	 * Full selection proposal type
+	 */
+	public static final int FULL_SELECTION = 3; // CodForChk_Dis_Magic
+
+	/**
+	 * Class name
+	 */
+	private String className;
+
+	/**
+	 * Function name
+	 */
+	private String functionName;
+
+	/**
+	 * Index to start of parameters
+	 */
+	private int parameterStart;
+
+	/**
+	 * List of return types
+	 */
+	private ArrayList<String> returnTypes;
+
+	/**
+	 * Creates a new SourceContext starting from given offset
+	 * 
+	 * @param parser
+	 *            the parser owning this context
+	 * @param offset
+	 *            the offset
+	 */
+	SourceContext(SourceParser parser, int offset) {
+		super(parser, offset);
+	}
+
+	/**
+	 * Gets the class name of this context
+	 * 
+	 * @return the class name
+	 */
+	public String getClassName() {
+		return className;
+	}
+
+	/**
+	 * Gets the function name of this context
+	 * 
+	 * @return the function name
+	 */
+	public String getFunctionName() {
+		return functionName;
+	}
+
+	/**
+	 * Sets the class name. If the class name contains pointer or reference
+	 * characters, they are added to the return statements list
+	 * 
+	 * @param name
+	 *            the new class name
+	 */
+	void setClassName(String name) {
+		className = removePtrAndRef(name);
+	}
+
+	/**
+	 * Sets the function name. If the function name contains pointer or
+	 * reference characters, they are added to the return statements list
+	 * 
+	 * @param name
+	 *            the new function name
+	 */
+	void setFunctionName(String name) {
+		functionName = removePtrAndRef(name);
+	}
+
+	/**
+	 * Removes the * and & characters from the given tag and adds them as return
+	 * modifiers
+	 * 
+	 * @param name
+	 *            the name
+	 * @return the name with * and & removed
+	 */
+	private String removePtrAndRef(String name) {
+		String retval = name;
+		if (name != null) {
+			int start = 0;
+			int end = name.length();
+			boolean found = true;
+			while (start < end && found) {
+				char c = name.charAt(start);
+				if (c == '*' || c == '&') {
+					addReturnModifier(c);
+					start++;
+				} else {
+					found = false;
+				}
+			}
+			found = true;
+			while (end > start && found) {
+				char c = name.charAt(end - 1);
+				if (c == '*' || c == '&') {
+					addReturnModifier(c);
+					end--;
+				} else {
+					found = false;
+				}
+			}
+			retval = name.substring(start, end);
+		}
+		return retval;
+	}
+
+	/**
+	 * Sets the index for start of parameters
+	 * 
+	 * @param index
+	 *            the index
+	 */
+	void setParametersStartIndex(int index) {
+		parameterStart = index;
+	}
+
+	/**
+	 * Adds a return type string to the context
+	 * 
+	 * @param type
+	 *            the return type
+	 */
+	void addReturnType(String type) {
+		// Constructors and destructor do not have return types
+		if (className != null && functionName!= null && !className.equals(functionName)
+				&& !functionName.equals(SourceConstants.TILDE + className)) {
+			type = removePtrAndRef(type);
+			if (type.length() > 0) {
+				if (returnTypes == null) {
+					returnTypes = new ArrayList<String>();
+				}
+				returnTypes.add(type);
+			}
+		}
+	}
+
+	/**
+	 * Adds a return type modifier to the list of return types
+	 * 
+	 * @param c
+	 *            the modifier
+	 */
+	private void addReturnModifier(char c) {
+		if (returnTypes == null) {
+			returnTypes = new ArrayList<String>();
+		}
+		returnTypes.add(String.valueOf(c));
+	}
+
+	/**
+	 * Gets the return types of this context
+	 * 
+	 * @return the return types
+	 */
+	Iterator<String> getReturnTypes() {
+		List<String> list;
+		if (returnTypes != null) {
+			list = returnTypes;
+		} else {
+			list = Collections.emptyList();
+		}
+		return list.iterator();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.ParsedType#hasQualifier(java.lang.String)
+	 */
+	public boolean hasQualifier(String type) {
+		// All types and qualifiers are in the returnTypes list
+		return typeEquals(type);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.ParsedType#typeEquals(java.lang.String)
+	 */
+	public boolean typeEquals(String type) {
+		return (returnTypes != null && returnTypes.contains(type));
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.ParsedType#isPointer()
+	 */
+	public boolean isPointer() {
+		boolean retval = false;
+		if (returnTypes != null) {
+			for (int i = 0; i < returnTypes.size() && !retval; i++) {
+				if (returnTypes.get(i).equals(SourceConstants.ASTERISK)) {
+					retval = true;
+				}
+			}
+		}
+		return retval;
+	}
+
+	/**
+	 * Checks if return types list contains "void"
+	 * 
+	 * @return true if void, false if not
+	 */
+	public boolean isVoid() {
+		return (returnTypes == null || returnTypes
+				.contains(SourceConstants.VOID));
+	}
+
+	/**
+	 * Parses the parameters of this source context
+	 * 
+	 * @param parameterList
+	 *            the list where the parameters are stored
+	 * @throws SourceParserException
+	 *             if parsing fails
+	 */
+	public void parseParameters(List<SourceParameter> parameterList)
+			throws SourceParserException {
+		if (getParser() != null) {
+			getParser().parseFunctionParameters(parameterStart, parameterList);
+		} else {
+			throw new SourceParserException(
+					SourceErrorCodes.CONTEXT_MISSING_OWNER);
+		}
+	}
+
+	/**
+	 * Parses the return statements of this source context
+	 * 
+	 * @param returnList
+	 *            the list where the return values are stored
+	 * @throws SourceParserException
+	 *             if parsing fails
+	 */
+	public void parseReturnValues(List<SourceReturn> returnList)
+			throws SourceParserException {
+		if (getParser() != null) {
+			getParser().parseReturnValues(this, returnList);
+		} else {
+			throw new SourceParserException(
+					SourceErrorCodes.CONTEXT_MISSING_OWNER);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString() {
+		StringBuffer sb = new StringBuffer();
+		if (className != null) {
+			sb.append(getClassName());
+		}
+		sb.append("::"); //$NON-NLS-1$
+		sb.append(getFunctionName());
+		return sb.toString();
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceDocumentFactory.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 be implemented by document framework
+*
+*/
+package com.nokia.tracebuilder.source;
+
+/**
+ * Interface to be implemented by document framework
+ * 
+ */
+public interface SourceDocumentFactory {
+
+	/**
+	 * Creates a new location
+	 * 
+	 * @param base
+	 *            the location which owns the position
+	 * @param offset
+	 *            the position offset
+	 * @param length
+	 *            the position length
+	 * @return the location
+	 */
+	public SourceLocationInterface createLocation(SourceLocationBase base,
+			int offset, int length);
+
+	/**
+	 * Creates a new document
+	 * 
+	 * @param sourceData
+	 *            the document data
+	 * @return the document
+	 */
+	public SourceDocumentInterface createDocument(String sourceData);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceDocumentInterface.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,131 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Source document abstraction
+*
+*/
+package com.nokia.tracebuilder.source;
+
+/**
+ * Source document abstraction
+ * 
+ */
+public interface SourceDocumentInterface {
+
+	/**
+	 * Gets the source selector interface. This can return null if the document
+	 * framework does not support selections
+	 * 
+	 * @return the source selector
+	 */
+	public SourceSelector getSourceSelector();
+
+	/**
+	 * Gets the property provider interface. This can return null if the
+	 * document framework does not support source properties
+	 * 
+	 * @return the property provider
+	 */
+	public SourcePropertyProvider getPropertyProvider();
+
+	/**
+	 * Gets a subset of document data
+	 * 
+	 * @param start
+	 *            the start offset
+	 * @param length
+	 *            the data length
+	 * @return the data
+	 * @throws SourceParserException
+	 *             if parameters are not valid
+	 */
+	public String get(int start, int length) throws SourceParserException;
+
+	/**
+	 * Gets a character
+	 * 
+	 * @param offset
+	 *            the offset
+	 * @return the character
+	 * @throws SourceParserException
+	 *             if offset is not valid
+	 */
+	public char getChar(int offset) throws SourceParserException;
+
+	/**
+	 * Gets the data length
+	 * 
+	 * @return the length
+	 */
+	public int getLength();
+
+	/**
+	 * Maps an offset to line number
+	 * 
+	 * @param offset
+	 *            the offset
+	 * @return the line number
+	 * @throws SourceParserException
+	 *             if offset is not valid
+	 */
+	public int getLineOfOffset(int offset) throws SourceParserException;
+
+	/**
+	 * Replaces data from the document
+	 * 
+	 * @param offset
+	 *            offset to removed data
+	 * @param length
+	 *            length of removed data
+	 * @param newText
+	 *            new data
+	 * @throws SourceParserException
+	 *             if parameters are not valid
+	 */
+	public void replace(int offset, int length, String newText)
+			throws SourceParserException;
+
+	/**
+	 * Adds a location to this source.
+	 * 
+	 * @param location
+	 *            the location to be added
+	 */
+	public void addLocation(SourceLocationInterface location);
+
+	/**
+	 * Removes a location from this source.
+	 * 
+	 * @param location
+	 *            the location to be removed
+	 */
+	public void removeLocation(SourceLocationInterface location);
+
+	/**
+	 * Gets the owner of this source
+	 * 
+	 * @return the owner
+	 */
+	public Object getOwner();
+
+	/**
+	 * Sets the owner of this source
+	 * 
+	 * @param owner
+	 *            the owner
+	 */
+	public void setOwner(Object owner);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceDocumentMonitor.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Monitor for source files
+*
+*/
+package com.nokia.tracebuilder.source;
+
+/**
+ * Monitor for source files
+ * 
+ */
+public interface SourceDocumentMonitor extends
+		Iterable<SourceDocumentInterface> {
+
+	/**
+	 * Gets a document factory, which is shared between all documents created
+	 * into this monitor
+	 * 
+	 * @return the factory
+	 */
+	public SourceDocumentFactory getFactory();
+
+	/**
+	 * Starts the monitor
+	 * 
+	 * @param processor
+	 *            document processor callback
+	 */
+	public void startMonitor(SourceDocumentProcessor processor);
+
+	/**
+	 * Stops the monitor
+	 */
+	public void stopMonitor();
+
+	/**
+	 * Gets the currently active source
+	 * 
+	 * @return the source
+	 */
+	public SourceDocumentInterface getSelectedSource();
+
+	/**
+	 * Gets the current selection from given source
+	 * 
+	 * @param props
+	 *            the source
+	 * @return the selection
+	 */
+	public OffsetLength getSelection(SourceDocumentInterface props);
+
+	/**
+	 * Sets focus to currently selected source
+	 */
+	public void setFocus();
+
+	/**
+	 * Checks if source can be edited
+	 * 
+	 * @param selectedSource
+	 *            the source
+	 * @return true if can be edited, false if read-only
+	 */
+	public boolean isSourceEditable(SourceDocumentInterface selectedSource);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceDocumentProcessor.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Document processor interface
+*
+*/
+package com.nokia.tracebuilder.source;
+
+/**
+ * Document processor interface
+ * 
+ */
+public interface SourceDocumentProcessor {
+
+	/**
+	 * Notification about source opened
+	 * 
+	 * @param document
+	 *            the document
+	 */
+	public void sourceOpened(SourceDocumentInterface document);
+
+	/**
+	 * Notification before source change
+	 * 
+	 * @param source
+	 *            the source
+	 * @param offset
+	 *            removed text offset
+	 * @param length
+	 *            removed text length
+	 * @param newText
+	 *            new text
+	 */
+	public void sourceAboutToBeChanged(SourceDocumentInterface source,
+			int offset, int length, String newText);
+
+	/**
+	 * Notification about source change
+	 * 
+	 * @param document
+	 *            the document
+	 * @param offset
+	 *            removed text offset
+	 * @param length
+	 *            removed text length
+	 * @param newText
+	 *            new text
+	 */
+	public void sourceChanged(SourceDocumentInterface document, int offset,
+			int length, String newText);
+
+	/**
+	 * Notification about source closed
+	 * 
+	 * @param document
+	 *            the document
+	 */
+	public void sourceClosed(SourceDocumentInterface document);
+
+	/**
+	 * Notification about change in selection
+	 * 
+	 * @param source
+	 *            the source
+	 * @param offset
+	 *            the offset of selection
+	 * @param length
+	 *            the length of selection
+	 */
+	public void selectionChanged(SourceDocumentInterface source, int offset,
+			int length);
+
+	/**
+	 * Source save notification
+	 * 
+	 * @param source
+	 *            the source
+	 */
+	public void sourceSaved(SourceDocumentInterface source);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceEditor.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,206 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Extends the SourceParser with support for data changes
+*
+*/
+package com.nokia.tracebuilder.source;
+
+import java.util.Iterator;
+
+/**
+ * Extends the SourceParser with support for data changes
+ * 
+ */
+public class SourceEditor extends SourceParser {
+
+	/**
+	 * Full sync needed flag
+	 */
+	private boolean fullSync;
+
+	/**
+	 * End of the area affected by the change
+	 */
+	private int affectedAreaEnd;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param framework
+	 *            the document framework
+	 * @param sourceData
+	 *            the source document data
+	 */
+	public SourceEditor(SourceDocumentFactory framework, String sourceData) {
+		super(framework, sourceData);
+	}
+
+	/**
+	 * Constructor
+	 * 
+	 * @param documentFramework
+	 *            the document framework
+	 * @param source
+	 *            the source
+	 */
+	public SourceEditor(SourceDocumentFactory documentFramework,
+			SourceDocumentInterface source) {
+		super(documentFramework, source);
+	}
+
+	/**
+	 * Updates the source file.
+	 * 
+	 * @param offset
+	 *            the offset to removed data
+	 * @param length
+	 *            the length of removed data
+	 * @param newText
+	 *            the data inserted at offset
+	 * @throws SourceParserException
+	 *             if update fails
+	 */
+	public void updateSource(int offset, int length, String newText)
+			throws SourceParserException {
+		getSource().replace(offset, length, newText);
+	}
+
+	/**
+	 * Prepares document update
+	 * 
+	 * @param offset
+	 *            the offset to removed data
+	 * @param length
+	 *            the length of removed data
+	 * @param newText
+	 *            the data inserted at offset
+	 * @throws SourceParserException
+	 *             if update fails
+	 */
+	public void prepareUpdateSource(int offset, int length, String newText)
+			throws SourceParserException {
+		// If the modified data contains characters used in building the
+		// excluded areas, the results might propagate to
+		// other parts of the source code. For example, removing the '*'
+		// from end-of-comment causes the comment to continue past the
+		// modified area to the next */. In that case a full re-sync needs
+		// to be done. One extra character is examined from both sides of the
+		// removed area. For example, introducing ' ' between '/' and '*' would
+		// remove the comment and affect rest of the code. Also if
+		// the new text introduces characters used in excluded areas, a full
+		// sync is done. For example, if '*' is inserted into a code, it might
+		// terminate an existing comment and thus affect the rest of the source.
+		// \n also needs to be processed, since it affects the line comments
+		// -> That should be the first one to be optimized away
+		fullSync = false;
+		SourceDocumentInterface source = getSource();
+		int start = offset == 0 ? offset : offset - 1;
+		int end = (offset + length) >= source.getLength() - 1 ? (offset + length)
+				: offset + length + 1;
+		for (int i = start; i < end && !fullSync; i++) {
+			char c = source.getChar(i);
+			if (c == '/' || c == '*' || c == '"' || c == '\n' || c == '\'') {
+				fullSync = true;
+			}
+		}
+		if (!fullSync && newText != null) {
+			int len = newText.length();
+			for (int i = 0; i < len && !fullSync; i++) {
+				char c = newText.charAt(i);
+				if (c == '/' || c == '*' || c == '"' || c == '\n' || c == '\'') {
+					fullSync = true;
+				}
+			}
+		}
+	}
+
+	/**
+	 * Sets the full sync flag. This needs to be called if there have been
+	 * multiple changes without prepareUpdateSource / sourceUpdated calls
+	 */
+	public void prepareFullSync() {
+		fullSync = true;
+	}
+
+	/**
+	 * Updates all excluded areas that follow the change offset
+	 * 
+	 * @param offset
+	 *            the offset to removed data
+	 * @param length
+	 *            the length of removed data
+	 * @param newText
+	 *            the data inserted at offset
+	 * @return end of the area where the change might affect
+	 * @throws SourceParserException
+	 *             if offset is not valid
+	 */
+	public int sourceUpdated(int offset, int length, String newText)
+			throws SourceParserException {
+		if (newText == null) {
+			newText = ""; //$NON-NLS-1$
+		}
+		// Full sync flag was calculated in prepareUpdateSource
+		if (fullSync) {
+			findExcludedAreas();
+			affectedAreaEnd = getSource().getLength();
+		} else {
+			// If the change was within an excluded area, the length of the
+			// area is updated. The offset of the areas following the change
+			// are updated.
+			int diff = newText.length() - length;
+			if (diff != 0) {
+				int index = findExcludedAreaIndex(offset);
+				if (index >= 0) {
+					SourceLocationBase p = getExcludedAreas().get(index);
+					p.setLength(p.getLength() + diff);
+					index++;
+				} else {
+					index = -1 - index;
+				}
+				for (; index < getExcludedAreas().size(); index++) {
+					SourceLocationBase p = getExcludedAreas().get(index);
+					p.setOffset(p.getOffset() + diff);
+				}
+			}
+			affectedAreaEnd = getSource().getLength();
+		}
+		// Contexts and preprocessor definitions are updated when needed for
+		// the next time
+		resetContexts();
+		resetPreprocessor();
+		return affectedAreaEnd;
+	}
+
+	/**
+	 * Sends update notifications to location listeners of modified and deleted
+	 * locations
+	 */
+	public void notifyLocationUpdates() {
+		// Posts delete notifications to location listeners
+		Iterator<SourceLocation> itr = getLocations();
+		while (itr.hasNext()) {
+			SourceLocation location = itr.next();
+			if (location.isDeleted()) {
+				location.notifyLocationDeleted();
+				itr.remove();
+			} else {
+				location.notifyLocationChanged();
+			}
+		}
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceErrorCodes.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Error codes for source parser
+*
+*/
+package com.nokia.tracebuilder.source;
+
+/**
+ * Error codes for source parser
+ * 
+ */
+public interface SourceErrorCodes {
+
+	/**
+	 * Something unexpected happened while parsing source. This should be
+	 * asserted
+	 */
+	int UNEXPECTED_EXCEPTION = 0; // CodForChk_Dis_Magic
+
+	/**
+	 * Missing owner from source context. This should be asserted
+	 */
+	int CONTEXT_MISSING_OWNER = 1; // CodForChk_Dis_Magic
+
+	/**
+	 * Unexpected separator while parsing parameters
+	 */
+	int UNEXPECTED_PARAMETER_SEPARATOR = 2; // CodForChk_Dis_Magic
+
+	/**
+	 * Unexpected end of file while parsing
+	 */
+	int UNEXPECTED_END_OF_FILE = 3; // CodForChk_Dis_Magic
+
+	/**
+	 * Unexpected quote character was encountered
+	 */
+	int UNEXPECTED_QUOTE_CHARACTER = 4; // CodForChk_Dis_Magic
+
+	/**
+	 * Bracket mismatch
+	 */
+	int BRACKET_MISMATCH = 5; // CodForChk_Dis_Magic
+
+	/**
+	 * Offset / length was not valid
+	 */
+	int BAD_LOCATION = 6; // CodForChk_Dis_Magic
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceExcludedArea.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,81 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Comment or string ares are added to the excluded list
+*
+*/
+package com.nokia.tracebuilder.source;
+
+/**
+ * Comment or string ares are added to the excluded list
+ * 
+ */
+public class SourceExcludedArea extends SourceLocationBase {
+
+	/**
+	 * Line comment type
+	 */
+	public static final int LINE_COMMENT = 1; // CodForChk_Dis_Magic
+
+	/**
+	 * Multiline comment type
+	 */
+	public static final int MULTILINE_COMMENT = 2; // CodForChk_Dis_Magic
+
+	/**
+	 * String type
+	 */
+	public static final int STRING = 3; // CodForChk_Dis_Magic
+
+	/**
+	 * Character type
+	 */
+	public static final int CHARACTER = 4; // CodForChk_Dis_Magic
+
+	/**
+	 * Preprocessor definition area
+	 */
+	public static final int PREPROCESSOR_DEFINITION = 5; // CodForChk_Dis_Magic
+
+	/**
+	 * Type of area
+	 */
+	private int type;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parser
+	 *            the parser where this area belongs
+	 * @param offset
+	 *            offset to the area
+	 * @param type
+	 *            type of area
+	 */
+	SourceExcludedArea(SourceParser parser, int offset, int type) {
+		super(parser, offset);
+		this.type = type;
+	}
+
+	/**
+	 * Gets the type of this area
+	 * 
+	 * @return the type
+	 */
+	public int getType() {
+		return type;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceInclude.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* #include found from source
+*
+*/
+package com.nokia.tracebuilder.source;
+
+/**
+ * #include found from source
+ * 
+ */
+public class SourceInclude extends SourceLocationBase {
+
+	/**
+	 * Header name
+	 */
+	private String name;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parser
+	 *            the source parser
+	 * @param offset
+	 *            the offset to the location within source
+	 */
+	SourceInclude(SourceParser parser, int offset) {
+		super(parser, offset);
+	}
+
+	/**
+	 * Sets the header name
+	 * 
+	 * @param name
+	 *            the name
+	 */
+	void setHeaderName(String name) {
+		this.name = name;
+	}
+
+	/**
+	 * Returns the name of the header
+	 * 
+	 * @return the name
+	 */
+	public String getHeaderName() {
+		return name;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceIterator.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,352 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* SourceIterator can be used to traverse through the source file character at a time
+*
+*/
+package com.nokia.tracebuilder.source;
+
+/**
+ * SourceIterator can be used to traverse through the source file character at a
+ * time.
+ * 
+ */
+public class SourceIterator {
+
+	/**
+	 * The source parser
+	 */
+	private SourceParser parser;
+
+	/**
+	 * Index of next excluded area
+	 */
+	private int nextExcludedIndex;
+
+	/**
+	 * The type of next excluded area
+	 */
+	private int nextExcludedAreaType;
+
+	/**
+	 * Offset to the start of next excluded area
+	 */
+	private int nextExcludedStart;
+
+	/**
+	 * Offset to the end of next excluded area
+	 */
+	private int nextExcludedEnd;
+
+	/**
+	 * Index of next character to be fetched
+	 */
+	private int nextIndex;
+
+	/**
+	 * Index of character returned by latest call to next
+	 */
+	private int currentIndex;
+
+	/**
+	 * Index of character returned by previous call to next
+	 */
+	private int previousIndex;
+
+	/**
+	 * Search flags
+	 */
+	private int flags;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parser
+	 *            source parser
+	 * @param startIndex
+	 *            the index where to start
+	 * @param flags
+	 *            the iterator flags
+	 */
+	SourceIterator(SourceParser parser, int startIndex, int flags) {
+		SourceDocumentInterface source = parser.getSource();
+		if (startIndex >= source.getLength()
+				&& ((flags & SourceParser.BACKWARD_SEARCH) != 0)) {
+			nextIndex = source.getLength() - 1;
+		} else {
+			nextIndex = startIndex;
+		}
+		this.parser = parser;
+		this.flags = flags;
+		if (hasNext()) {
+			boolean forward = (flags & SourceParser.BACKWARD_SEARCH) == 0;
+			nextExcludedIndex = parser.findExcludedAreaIndex(nextIndex);
+			if (nextExcludedIndex < 0) {
+				nextExcludedIndex = -1 - nextExcludedIndex;
+				if (forward) {
+					// Update increments the index, so it must be moved behind
+					// the start of search
+					nextExcludedIndex--;
+				}
+			}
+			// Increments / decrements the next excluded area according to
+			// search direction. If direction is backward, this decrements the
+			// index. In that case the above initialization has selected the
+			// index after the start of search index. If direction is forward,
+			// this increments the index.
+			updateExcludedIndex();
+			// After the excluded index has been set, the white spaces and
+			// comments are skipped
+			if (forward) {
+				forwardSeekNext();
+			} else {
+				backwardSeekNext();
+			}
+			previousIndex = startIndex;
+			currentIndex = startIndex;
+		}
+	}
+
+	/**
+	 * Determines if there are more characters to process
+	 * 
+	 * @return true if iterator has more characters
+	 */
+	public boolean hasNext() {
+		return (flags & SourceParser.BACKWARD_SEARCH) == 0 ? nextIndex < parser
+				.getSource().getLength() : nextIndex >= 0;
+	}
+
+	/**
+	 * Gets the next character from this iterator
+	 * 
+	 * @return the next character
+	 * @throws SourceParserException
+	 *             if there are no more characters
+	 */
+	public char next() throws SourceParserException {
+		char ret;
+		previousIndex = currentIndex;
+		currentIndex = nextIndex;
+		if ((flags & SourceParser.BACKWARD_SEARCH) == 0) {
+			ret = forwardNext();
+		} else {
+			ret = backwardNext();
+		}
+		return ret;
+	}
+
+	/**
+	 * Returns next character moving forward
+	 * 
+	 * @return the character
+	 * @throws SourceParserException
+	 *             if there are no more characters
+	 */
+	private char forwardNext() throws SourceParserException {
+		char c = parser.getSource().getChar(nextIndex);
+		nextIndex++;
+		forwardSeekNext();
+		return c;
+	}
+
+	/**
+	 * Skips to next index
+	 */
+	private void forwardSeekNext() {
+		// Skips over the excluded area if the index enters one
+		boolean didSkip;
+		SourceDocumentInterface source = parser.getSource();
+		try {
+			do {
+				didSkip = false;
+				if (nextIndex >= nextExcludedStart && nextExcludedStart != -1) {
+					// Skips if applicable. Otherwise just updates the next
+					// excluded
+					// area variables
+					if (isExcluded()) {
+						nextIndex = nextExcludedEnd;
+					}
+					updateExcludedIndex();
+				}
+				if ((flags & SourceParser.SKIP_WHITE_SPACES) != 0) {
+					// Skips over white spaces
+					boolean wspFound = true;
+					do {
+						// If a white space is skipped, the excluded area check
+						// needs to be done again. didSkip flag controls that
+						if (nextIndex < source.getLength()
+								&& Character.isWhitespace(source
+										.getChar(nextIndex))) {
+							nextIndex++;
+							didSkip = true;
+						} else {
+							wspFound = false;
+						}
+					} while (wspFound);
+				}
+			} while (didSkip);
+		} catch (SourceParserException e) {
+			// The exception must not be thrown out of this function
+		}
+	}
+
+	/**
+	 * Returns next character moving backward
+	 * 
+	 * @return the character
+	 * @throws SourceParserException
+	 *             if there are no more characters
+	 */
+	private char backwardNext() throws SourceParserException {
+		char c = parser.getSource().getChar(nextIndex);
+		nextIndex--;
+		backwardSeekNext();
+		return c;
+	}
+
+	/**
+	 * Skips to previous index
+	 */
+	private void backwardSeekNext() {
+		// Skips over the excluded area if the index enters one
+		boolean didSkip;
+		SourceDocumentInterface source = parser.getSource();
+		try {
+			do {
+				didSkip = false;
+				if (nextIndex <= nextExcludedEnd - 1) {
+					// Skips if applicable. Otherwise just updates the next
+					// excluded
+					// area variables
+					if (isExcluded()) {
+						nextIndex = nextExcludedStart - 1;
+					}
+					updateExcludedIndex();
+				}
+				if ((flags & SourceParser.SKIP_WHITE_SPACES) != 0) {
+					boolean wspFound = true;
+					do {
+						// If a white space is skipped, the excluded area check
+						// needs to be done again. didSkip flag controls that
+						if (nextIndex >= 0
+								&& Character.isWhitespace(source
+										.getChar(nextIndex))) {
+							nextIndex--;
+							didSkip = true;
+						} else {
+							wspFound = false;
+						}
+					} while (wspFound);
+				}
+			} while (didSkip);
+		} catch (SourceParserException e) {
+			// The exception must not be thrown out of this function
+		}
+	}
+
+	/**
+	 * Updates the excluded area index
+	 */
+	private void updateExcludedIndex() {
+		if ((flags & SourceParser.BACKWARD_SEARCH) == 0) {
+			nextExcludedIndex++;
+		} else {
+			nextExcludedIndex--;
+		}
+		// Updates the values using the next excluded area
+		if (nextExcludedIndex >= 0
+				&& nextExcludedIndex < parser.getExcludedAreas().size()) {
+			SourceExcludedArea p = parser.getExcludedAreas().get(
+					nextExcludedIndex);
+			nextExcludedStart = p.getOffset();
+			nextExcludedEnd = p.getOffset() + p.getLength();
+			nextExcludedAreaType = p.getType();
+		} else {
+			nextExcludedStart = -1;
+			nextExcludedEnd = -1;
+		}
+	}
+
+	/**
+	 * Returns the index where the next character will be fetched
+	 * 
+	 * @return the index
+	 */
+	public int nextIndex() {
+		return nextIndex;
+	}
+
+	/**
+	 * Gets the index of the character returned by last call to next
+	 * 
+	 * @return the index
+	 */
+	public int currentIndex() {
+		return currentIndex;
+	}
+
+	/**
+	 * Gets the index that preceeded the latest call to next
+	 * 
+	 * @return the index
+	 */
+	public int previousIndex() {
+		return previousIndex;
+	}
+
+	/**
+	 * Gets the next character but does not move the iterator
+	 * 
+	 * @return the next character
+	 * @throws SourceParserException
+	 *             if there are no more characters
+	 */
+	public char peek() throws SourceParserException {
+		return parser.getSource().getChar(nextIndex);
+	}
+
+	/**
+	 * Determines if the iterator skipped over characters during last call to
+	 * next
+	 * 
+	 * @return true if skipped, false otherwise
+	 */
+	public boolean hasSkipped() {
+		return (flags & SourceParser.BACKWARD_SEARCH) == 0 ? currentIndex > previousIndex + 1
+				: currentIndex < previousIndex - 1;
+	}
+
+	/**
+	 * Checks if the next area is skipped
+	 * 
+	 * @return true is skipped
+	 */
+	private boolean isExcluded() {
+		return isExcluded(nextExcludedAreaType);
+	}
+
+	/**
+	 * Checks if the given type is skipped
+	 * 
+	 * @param type
+	 *            the type
+	 * @return true is skipped
+	 */
+	private boolean isExcluded(int type) {
+		return SourceParser.isExcluded(type, flags);
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceLocation.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,248 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Represents a location in source
+*
+*/
+package com.nokia.tracebuilder.source;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * Represents a location in source
+ * 
+ */
+public class SourceLocation extends SourceLocationBase {
+
+	/**
+	 * Location listeners
+	 */
+	private ArrayList<SourceLocationListener> locationListeners;
+
+	/**
+	 * Temporary array for callback purposes. Prevents concurrent modifications
+	 * if listeners are removed during a callback
+	 */
+	private ArrayList<SourceLocationListener> tempListeners;
+
+	/**
+	 * Offset that was used in last notification
+	 */
+	private int notifiedOffset;
+
+	/**
+	 * Length that was used in last notification
+	 */
+	private int notifiedLength;
+
+	/**
+	 * Reference count
+	 */
+	private int refCount = 0;
+
+	/**
+	 * Listener change flag
+	 */
+	private boolean listenersChanged = true;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parser
+	 *            the parser owning this location
+	 * @param offset
+	 *            offset of location
+	 * @param length
+	 *            length of location
+	 */
+	public SourceLocation(SourceParser parser, int offset, int length) {
+		super(parser, offset, length);
+		this.notifiedOffset = offset;
+		this.notifiedLength = length;
+		parser.addLocation(this);
+		refCount = 1;
+	}
+
+	/**
+	 * Selects the source code represented by this location. This does not work
+	 * if the source has not been associated with a selector.
+	 */
+	public void selectFromSource() {
+		if (getParser() != null && !isDeleted()) {
+			SourceDocumentInterface owner = getParser().getSource();
+			if (owner != null) {
+				SourceSelector selector = owner.getSourceSelector();
+				if (selector != null) {
+					selector.setSelection(getOffset(), getLength());
+				}
+			}
+		}
+	}
+
+	/**
+	 * Gets the name of the class which owns this location
+	 * 
+	 * @return the class name
+	 */
+	public String getClassName() {
+		String retval = null;
+		if (getParser() != null) {
+			SourceContext context = getParser().getContext(getOffset());
+			if (context != null) {
+				retval = context.getClassName();
+			}
+		}
+		return retval;
+	}
+
+	/**
+	 * Gets the name of function which owns this location
+	 * 
+	 * @return the function name
+	 */
+	public String getFunctionName() {
+		String retval = null;
+		if (getParser() != null) {
+			SourceContext context = getParser().getContext(getOffset());
+			if (context != null) {
+				retval = context.getFunctionName();
+			}
+		}
+		return retval;
+	}
+
+	/**
+	 * Adds a location listener to this location
+	 * 
+	 * @param listener
+	 *            the location listener
+	 */
+	public void addLocationListener(SourceLocationListener listener) {
+		if (locationListeners == null) {
+			locationListeners = new ArrayList<SourceLocationListener>();
+		}
+		locationListeners.add(listener);
+		listenersChanged = true;
+	}
+
+	/**
+	 * Removes a location listener from this location
+	 * 
+	 * @param listener
+	 *            the location listener
+	 */
+	public void removeLocationListener(SourceLocationListener listener) {
+		if (locationListeners != null) {
+			if (locationListeners.remove(listener)) {
+				listenersChanged = true;
+			}
+		}
+	}
+
+	/**
+	 * Gets the listener interfaces
+	 * 
+	 * @return the listeners
+	 */
+	protected Iterator<SourceLocationListener> getListeners() {
+		List<SourceLocationListener> list;
+		if (locationListeners != null) {
+			if (listenersChanged) {
+				listenersChanged = false;
+				if (tempListeners == null) {
+					tempListeners = new ArrayList<SourceLocationListener>();
+				}
+				tempListeners.clear();
+				tempListeners.addAll(locationListeners);
+			}
+			list = tempListeners;
+		} else {
+			list = Collections.emptyList();
+		}
+		return list.iterator();
+	}
+
+	/**
+	 * Fires a location deleted event to registered listeners.
+	 * 
+	 * @see SourceLocationListener
+	 */
+	void notifyLocationDeleted() {
+		if (locationListeners != null) {
+			Iterator<SourceLocationListener> listeners = getListeners();
+			locationListeners = null;
+			resetParser();
+			while (listeners.hasNext()) {
+				listeners.next().locationDeleted(this);
+			}
+		}
+	}
+
+	/**
+	 * Sends locationChanged notifications to listeners if this location has
+	 * changed.
+	 */
+	protected void notifyLocationChanged() {
+		if (locationListeners != null) {
+			if (notifiedOffset != getOffset() || notifiedLength != getLength()) {
+				notifiedOffset = getOffset();
+				notifiedLength = getLength();
+				resetLineNumber();
+				Iterator<SourceLocationListener> itr = locationListeners
+						.iterator();
+				while (itr.hasNext()) {
+					itr.next().locationChanged(this);
+				}
+			}
+		}
+	}
+
+	/**
+	 * Increases the reference count of this location.
+	 * 
+	 * @see #dereference()
+	 */
+	public void reference() {
+		refCount++;
+	}
+
+	/**
+	 * Decrements the reference count of this location. When reference count is
+	 * 0, this is removed from source. Note that a location can also be removed
+	 * from source even if it has outstanding references left. In that case it
+	 * can no longer be selected.
+	 */
+	public void dereference() {
+		if (--refCount <= 0) {
+			removeFromSource();
+		}
+	}
+
+	/**
+	 * Removes this location from the source
+	 */
+	private void removeFromSource() {
+		delete();
+		if (getParser() != null) {
+			getParser().removeLocation(this);
+			resetParser();
+		}
+		notifyLocationDeleted();
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceLocationBase.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,215 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 locations
+*
+*/
+package com.nokia.tracebuilder.source;
+
+/**
+ * Base class for locations
+ * 
+ */
+public class SourceLocationBase {
+
+	/**
+	 * Source parser
+	 */
+	private SourceParser parser;
+
+	/**
+	 * Position abstraction
+	 */
+	private SourceLocationInterface position;
+
+	/**
+	 * Line number is cached and updated when changes occur
+	 */
+	private int currentLine = -1;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parser
+	 *            the source parser
+	 * @param offset
+	 *            the offset to the location
+	 */
+	protected SourceLocationBase(SourceParser parser, int offset) {
+		this.parser = parser;
+		position = parser.getDocumentFramework()
+				.createLocation(this, offset, 0);
+	}
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parser
+	 *            the source parser
+	 * @param offset
+	 *            the offset to the location
+	 * @param length
+	 *            the location length
+	 */
+	protected SourceLocationBase(SourceParser parser, int offset, int length) {
+		this.parser = parser;
+		position = parser.getDocumentFramework().createLocation(this, offset,
+				length);
+	}
+
+	/**
+	 * Gets the offset
+	 * 
+	 * @return offset
+	 */
+	public final int getOffset() {
+		return position.getOffset();
+	}
+
+	/**
+	 * Sets the offset
+	 * 
+	 * @param offset
+	 *            new offset
+	 */
+	public final void setOffset(int offset) {
+		position.setOffset(offset);
+	}
+
+	/**
+	 * Gets the length
+	 * 
+	 * @return length
+	 */
+	public final int getLength() {
+		return position.getLength();
+	}
+
+	/**
+	 * Sets the length
+	 * 
+	 * @param length
+	 *            the length
+	 */
+	public final void setLength(int length) {
+		position.setLength(length);
+	}
+
+	/**
+	 * Returns deleted flag
+	 * 
+	 * @return the flag
+	 */
+	public final boolean isDeleted() {
+		return position.isDeleted();
+	}
+
+	/**
+	 * Sets the deleted flag
+	 */
+	public final void delete() {
+		position.delete();
+	}
+
+	/**
+	 * Gets the location interface
+	 * 
+	 * @return the location interface
+	 */
+	final SourceLocationInterface getLocation() {
+		return position;
+	}
+
+	/**
+	 * Gets the source parser
+	 * 
+	 * @return the parser
+	 */
+	public SourceParser getParser() {
+		return parser;
+	}
+
+	/**
+	 * Resets the source parser
+	 */
+	protected void resetParser() {
+		parser = null;
+	}
+
+	/**
+	 * Gets the line number of this location
+	 * 
+	 * @return line number
+	 */
+	public int getLineNumber() {
+		// Line number is set to -1 when notifyUpdate is called
+		if (parser != null) {
+			if (currentLine == -1) {
+				currentLine = parser.getLineNumber(getOffset());
+			}
+		} else {
+			currentLine = -1;
+		}
+		return currentLine;
+	}
+
+	/**
+	 * Resets the line number
+	 */
+	protected void resetLineNumber() {
+		currentLine = -1;
+	}
+
+	/**
+	 * Gets the source file name
+	 * 
+	 * @return the file name
+	 */
+	public String getFileName() {
+		String retval = null;
+		if (parser != null) {
+			SourceDocumentInterface owner = parser.getSource();
+			if (owner != null) {
+				SourcePropertyProvider propertyProvider = owner
+						.getPropertyProvider();
+				if (propertyProvider != null) {
+					retval = propertyProvider.getFileName();
+				}
+			}
+		}
+		return retval;
+	}
+
+	/**
+	 * Gets the source file path
+	 * 
+	 * @return the path
+	 */
+	public String getFilePath() {
+		String retval = null;
+		if (parser != null) {
+			SourceDocumentInterface owner = parser.getSource();
+			if (owner != null) {
+				SourcePropertyProvider propertyProvider = owner
+						.getPropertyProvider();
+				if (propertyProvider != null) {
+					retval = propertyProvider.getFilePath();
+				}
+			}
+		}
+		return retval;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceLocationInterface.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,69 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 which abstracts the underlying position framework
+*
+*/
+package com.nokia.tracebuilder.source;
+
+/**
+ * Interface which abstracts the underlying position framework
+ * 
+ */
+public interface SourceLocationInterface {
+
+	/**
+	 * Gets the offset of the location
+	 * 
+	 * @return the offset
+	 */
+	int getOffset();
+
+	/**
+	 * Sets the offset
+	 * 
+	 * @param offset
+	 *            the new offset
+	 */
+	void setOffset(int offset);
+
+	/**
+	 * Gets the length of the location
+	 * 
+	 * @return the length
+	 */
+	int getLength();
+
+	/**
+	 * Sets the length
+	 * 
+	 * @param length
+	 *            the length
+	 */
+	void setLength(int length);
+
+	/**
+	 * Checks if the location has been deleted
+	 * 
+	 * @return true if deleted
+	 */
+	boolean isDeleted();
+
+	/**
+	 * Marks the location as deleted
+	 */
+	void delete();
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceLocationListener.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Listener for source locations
+*
+*/
+package com.nokia.tracebuilder.source;
+
+/**
+ * Listener for source locations
+ * 
+ */
+public interface SourceLocationListener {
+
+	/**
+	 * Notifies that a location offset or length has changed
+	 * 
+	 * @param location
+	 *            the location that changed
+	 */
+	public void locationChanged(SourceLocation location);
+
+	/**
+	 * Notifies that a location has been deleted
+	 * 
+	 * @param location
+	 *            the location that changed
+	 */
+	public void locationDeleted(SourceLocation location);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceParameter.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,238 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Representation of a parameter parsed from source
+*
+*/
+package com.nokia.tracebuilder.source;
+
+import java.util.ArrayList;
+
+/**
+ * Representation of a parameter parsed from source
+ * 
+ */
+public class SourceParameter implements ParsedType {
+
+	/**
+	 * Parameter qualifiers
+	 */
+	private ArrayList<String> qualifiers;
+
+	/**
+	 * Parameter type
+	 */
+	private String type;
+
+	/**
+	 * Parameter name
+	 */
+	private String name;
+
+	/**
+	 * Flag specifying if parameter is reference
+	 */
+	private boolean isReference;
+
+	/**
+	 * Number of pointers in parameter
+	 */
+	private int pointerCount;
+
+	/**
+	 * The location of this parameter in source
+	 */
+	private SourceLocation location;
+
+	/**
+	 * Gets the parameter type
+	 * 
+	 * @return the type
+	 */
+	public String getType() {
+		return type;
+	}
+
+	/**
+	 * Gets the parameter name or null if parameter does not have a name
+	 * 
+	 * @return the name
+	 */
+	public String getName() {
+		return name;
+	}
+
+	/**
+	 * Checks if parameter is pointer (*) or pointer reference (*&)
+	 * 
+	 * @return true if pointer, false if not
+	 */
+	public boolean isPointer() {
+		return pointerCount > 0;
+	}
+
+	/**
+	 * Gets the number of pointers
+	 * 
+	 * @return the number of pointers
+	 */
+	public int getPointerCount() {
+		return pointerCount;
+	}
+
+	/**
+	 * Checks if a parameter is referece (&) or pointer reference (*&)
+	 * 
+	 * @return true if reference, false if not
+	 */
+	public boolean isReference() {
+		return isReference;
+	}
+
+	/**
+	 * Checks if paraemter is pointer (*), but not pointer reference (*&). Equal
+	 * to isPointer() && !isReference()
+	 * 
+	 * @return true if pointer, but not reference
+	 */
+	public boolean isPlainPointer() {
+		return pointerCount > 0 && !isReference;
+	}
+
+	/**
+	 * Checks if parameter is reference (&), but not pointer reference (*&).
+	 * Equal to !isPointer() && isReference()
+	 * 
+	 * @return true if reference to value
+	 */
+	public boolean isPlainReference() {
+		return pointerCount == 0 && isReference;
+	}
+
+	/**
+	 * Checks if parameter is a reference to a pointer (*&). Equal to
+	 * isPointer() && isReference()
+	 * 
+	 * @return true if reference to a pointer
+	 */
+	public boolean isPointerReference() {
+		return pointerCount > 0 && isReference;
+	}
+
+	/**
+	 * Checks if parameter is pointer (*) or reference (&). Equal to isPointer() ||
+	 * isReference()
+	 * 
+	 * @return true if pointer or reference
+	 */
+	public boolean isPointerOrReference() {
+		return pointerCount > 0 || isReference;
+	}
+
+	/**
+	 * Checks if parameter type equals given type
+	 * 
+	 * @param type
+	 *            the type to be checked
+	 * @return true if types match
+	 */
+	public boolean typeEquals(String type) {
+		return this.type != null && type != null && this.type.equals(type);
+	}
+
+	/**
+	 * Returns the source reference of this parameter
+	 * 
+	 * @return the source reference
+	 */
+	public SourceLocation getSourceLocation() {
+		return location;
+	}
+
+	/**
+	 * Sets the parameter type
+	 * 
+	 * @param type
+	 *            the new type
+	 */
+	void setType(String type) {
+		this.type = type;
+	}
+
+	/**
+	 * Sets the parameter name
+	 * 
+	 * @param name
+	 *            the new name
+	 */
+	void setName(String name) {
+		this.name = name;
+	}
+
+	/**
+	 * Sets the reference flag
+	 */
+	void setReference() {
+		isReference = true;
+	}
+
+	/**
+	 * Increments the pointer count
+	 */
+	void addPointer() {
+		pointerCount++;
+	}
+
+	/**
+	 * Adds a qualifier to this parameter
+	 * 
+	 * @param type
+	 *            the qualifier type
+	 */
+	void addQualifier(String type) {
+		if (qualifiers == null) {
+			qualifiers = new ArrayList<String>();
+		}
+		qualifiers.add(type);
+	}
+
+	/**
+	 * Sets the source location of this parameter
+	 * 
+	 * @param location
+	 *            the location
+	 */
+	void setSourceLocation(SourceLocation location) {
+		this.location = location;
+	}
+
+	/**
+	 * Checks if a qualifier exists
+	 * 
+	 * @param qualifier
+	 *            the qualifier to be checked
+	 * @return true if it exists
+	 */
+	public boolean hasQualifier(String qualifier) {
+		boolean retval;
+		if (qualifiers != null) {
+			retval = qualifiers.contains(qualifier);
+		} else {
+			retval = false;
+		}
+		return retval;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceParameterTokenizer.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,419 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Parameter tokenizer is used to parse function parameters lists
+*
+*/
+package com.nokia.tracebuilder.source;
+
+import java.util.List;
+
+/**
+ * Parameter tokenizer is used to parse function parameters lists
+ * 
+ */
+public class SourceParameterTokenizer {
+
+	/**
+	 * The source parser
+	 */
+	private SourceParser parser;
+
+	/**
+	 * The offset where to start the tokenizer
+	 */
+	private int offset;
+
+	/**
+	 * Slip next whitespace
+	 */
+	private boolean skipNextWhiteSpace;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parser
+	 *            the source parser
+	 * @param offset
+	 *            offset to the start of parameter
+	 */
+	public SourceParameterTokenizer(SourceParser parser, int offset) {
+		this.parser = parser;
+		this.offset = offset;
+	}
+
+	/**
+	 * Parses a list of parameters (a, b, c) and stores the values into the
+	 * given list.
+	 * 
+	 * @param list
+	 *            the list of parameters
+	 * @param findSeparator
+	 *            if true, the processing stops after ';' or '{' character. If
+	 *            false, processing stops after ')' at end of parameters
+	 * @return index at end of parameters
+	 * @throws SourceParserException
+	 *             if processing fails
+	 */
+	public int tokenize(List<String> list, boolean findSeparator)
+			throws SourceParserException {
+		TokenizerSearchData data = new TokenizerSearchData();
+		data.itr = parser.createIterator(offset, SourceParser.SKIP_WHITE_SPACES
+				| SourceParser.SKIP_COMMENTS);
+		boolean finished = false;
+		while (data.itr.hasNext() && !finished) {
+			data.value = data.itr.next();
+			if (!data.inQuotes && data.value == '\"') {
+				data.inQuotes = true;
+				data.hasData = true;
+			} else if (data.inQuotes) {
+				processInQuotesChar(data);
+			} else if (data.complete) {
+				processEndOfParametersChar(data);
+			} else if (data.value == '(') {
+				processOpeningBracket(data);
+			} else if (data.value == ',' || data.value == ')') {
+				processCommaOrClosingBracket(list, data);
+			} else if (data.value == ';' || data.value == '{'
+					|| data.value == '}') {
+				throw new SourceParserException(
+						SourceErrorCodes.UNEXPECTED_PARAMETER_SEPARATOR);
+			} else {
+				// Raises a flag that there is some data. processOpeningBracket
+				// no longer interprets the next bracket as opening bracket
+				if (data.openBracketCount > 0) {
+					data.hasData = true;
+				}
+			}
+			finished = ((data.complete && !findSeparator) || (data.endFound && findSeparator));
+		}
+		if (!data.complete) {
+			throw new SourceParserException(
+					SourceErrorCodes.UNEXPECTED_END_OF_FILE);
+		}
+		if (data.openBracketCount != 0) {
+			throw new SourceParserException(SourceErrorCodes.BRACKET_MISMATCH);
+		}
+		return data.itr.currentIndex() + 1;
+	}
+
+	/**
+	 * Parses list of parameters with types (int a, int b, int c) and stores the
+	 * values into the given list.
+	 * 
+	 * @param list
+	 *            the list of parameters
+	 * @return index at end of parameters
+	 * @throws SourceParserException
+	 *             if processing fails
+	 */
+	public int tokenizeTyped(List<SourceParameter> list)
+			throws SourceParserException {
+		TokenizerSearchData data = new TokenizerSearchData();
+
+		try {
+			data.itr = parser
+					.createIterator(offset, SourceParser.SKIP_WHITE_SPACES
+							| SourceParser.SKIP_COMMENTS);
+			data.sourceParameter = new SourceParameter();
+			while (data.itr.hasNext() && !data.complete) {
+				data.value = data.itr.next();
+
+				// Check if there was array start or end character and then
+				// space. It would mean that the parameter continues and more
+				// should be parsed.
+				if (skipNextWhiteSpace) {
+					skipNextWhiteSpace = false;
+					if (data.itr.hasSkipped()) {
+						data.value = data.itr.next();
+					}
+				}
+
+				if (data.value == '\"') {
+					throw new SourceParserException(
+							SourceErrorCodes.UNEXPECTED_QUOTE_CHARACTER);
+				} else if (data.value == '(') {
+					processOpeningBracket(data);
+				} else if (data.value == ',' || data.value == ')') {
+					processCommaOrClosingBracket(list, data);
+				} else if (data.value == ';' || data.value == '{'
+						|| data.value == '}') {
+					throw new SourceParserException(
+							SourceErrorCodes.UNEXPECTED_PARAMETER_SEPARATOR);
+
+					// Array start or end character.
+				} else if (data.value == '<' || data.value == '>') {
+					skipNextWhiteSpace = true;
+				} else if (data.itr.hasSkipped()) {
+					processNameValueSeparator(data);
+				}
+			}
+			if (!data.complete) {
+				throw new SourceParserException(
+						SourceErrorCodes.UNEXPECTED_END_OF_FILE);
+			}
+		} catch (SourceParserException e) {
+			// Resets all source locations if parser fails
+			for (int i = 0; i < list.size(); i++) {
+				list.get(i).getSourceLocation().dereference();
+			}
+			throw e;
+		}
+		return data.itr.currentIndex() + 1;
+	}
+
+	/**
+	 * Processes a separator character and updates the current SourceParameter
+	 * object in the search data
+	 * 
+	 * @param data
+	 *            the search data
+	 * @throws SourceParserException
+	 *             if processing fails
+	 */
+	private void processNameValueSeparator(TokenizerSearchData data)
+			throws SourceParserException {
+		// If the parameter is empty, the previous index will point
+		// to index preceeding tagStartIndex
+		int previous = data.itr.previousIndex();
+		if (previous >= data.tagStartIndex) {
+			int endIndex = previous + 1;
+			if (data.sourceParameter.getType() == null) {
+				processNameValueSeparatorNoType(data, endIndex);
+			} else if (data.sourceParameter.getName() == null) {
+				processNameValueSeparatorNoName(data, endIndex);
+			}
+			data.tagStartIndex = data.itr.currentIndex();
+		}
+	}
+
+	/**
+	 * Processes a name-value separator when there is no name
+	 * 
+	 * @param data
+	 *            the search data
+	 * @param endIndex
+	 *            the end index of the parameters
+	 * @throws SourceParserException
+	 *             if processing fails
+	 */
+	private void processNameValueSeparatorNoName(TokenizerSearchData data,
+			int endIndex) throws SourceParserException {
+		String name = parser.getSource().get(data.tagStartIndex,
+				endIndex - data.tagStartIndex);
+		boolean startFound = false;
+		int start = 0;
+		int end = name.length();
+		for (int i = 0; i < name.length(); i++) {
+			char c = name.charAt(i);
+			if (c == '&' || c == '*') {
+				if (c == '&') {
+					data.sourceParameter.setReference();
+				} else {
+					data.sourceParameter.addPointer();
+				}
+				if (!startFound) {
+					start++;
+				} else {
+					end--;
+				}
+			} else {
+				startFound = true;
+			}
+		}
+		name = name.substring(start, end);
+		if (name.length() > 0) {
+			if (isParameterTypeQualifier(name)) {
+				// Qualifiers between type and name are ignored
+				// For example TInt const* aValue
+			} else {
+				data.sourceParameter.setName(name);
+			}
+		}
+	}
+
+	/**
+	 * Processes a name-value separator when there is no value
+	 * 
+	 * @param data
+	 *            the search data
+	 * @param endIndex
+	 *            the end index of the parameters
+	 * @throws SourceParserException
+	 *             if processing fails
+	 */
+	private void processNameValueSeparatorNoType(TokenizerSearchData data,
+			int endIndex) throws SourceParserException {
+		String type = parser.getSource().get(data.tagStartIndex,
+				endIndex - data.tagStartIndex);
+		if (isParameterTypeQualifier(type)) {
+			data.sourceParameter.addQualifier(type);
+		} else {
+			for (int i = type.length() - 1; i >= 0; i--) {
+				if (type.charAt(i) == '&') {
+					data.sourceParameter.setReference();
+					if (i == 0) {
+						type = ""; //$NON-NLS-1$
+					}
+				} else if (type.charAt(i) == '*') {
+					data.sourceParameter.addPointer();
+					if (i == 0) {
+						type = ""; //$NON-NLS-1$
+					}
+				} else {
+					if (i != type.length() - 1) {
+						type = type.substring(0, i + 1);
+					}
+					i = -1;
+				}
+			}
+			if (type.length() > 0) {
+				// Remove spaces
+				type = type.replace(" ", ""); //$NON-NLS-1$ //$NON-NLS-2$
+				data.sourceParameter.setType(type);
+			}
+		}
+	}
+
+	/**
+	 * Checks if parameter type if a qualifier or not
+	 * 
+	 * @param type
+	 *            the type to be checked
+	 * @return true if qualifier, false if not
+	 */
+	private boolean isParameterTypeQualifier(String type) {
+		boolean retval = false;
+		for (String element : SourceConstants.PARAMETER_QUALIFIERS) {
+			if (type.equals(element)) {
+				retval = true;
+			}
+		}
+		return retval;
+	}
+
+	/**
+	 * Processes a parameter separator or closing bracket
+	 * 
+	 * @param list
+	 *            the list of existing parameters
+	 * @param data
+	 *            the search data
+	 * @throws SourceParserException
+	 *             if invalid character is encountered
+	 */
+	@SuppressWarnings("unchecked")
+	private void processCommaOrClosingBracket(List list,
+			TokenizerSearchData data) throws SourceParserException {
+		// This method is called from both tokenize functions. One uses
+		// List<String> and other List<SourceParameter>
+		// Thus this uses List and @SuppressWarnings
+		if (data.openBracketCount == data.initialBracketCount) {
+			if (data.sourceParameter != null) {
+				// If processing typed parameter list, the name and type are
+				// stored into a SourceParameter object, which is then added
+				// to list
+				processNameValueSeparator(data);
+				if (data.sourceParameter.getType() != null) {
+					SourceLocation location = new SourceLocation(parser,
+							data.paramStartIndex, data.itr.currentIndex()
+									- data.paramStartIndex);
+					data.sourceParameter.setSourceLocation(location);
+					list.add(data.sourceParameter);
+					data.sourceParameter = new SourceParameter();
+				}
+			} else {
+				// In this case the list contains strings.
+				int previous = data.itr.previousIndex();
+				if (previous >= data.tagStartIndex) {
+					int endIndex = data.itr.previousIndex() + 1;
+					list.add(parser.getSource().get(data.tagStartIndex,
+							endIndex - data.tagStartIndex));
+				} else {
+					list.add(""); //$NON-NLS-1$
+				}
+			}
+			if (data.value == ')') {
+				data.complete = true;
+				data.openBracketCount--;
+			} else {
+				data.tagStartIndex = data.itr.nextIndex();
+				data.paramStartIndex = data.tagStartIndex;
+			}
+		} else if (data.openBracketCount > data.initialBracketCount) {
+			if (data.value == ')') {
+				data.openBracketCount--;
+			}
+		} else {
+			if (data.value == ')') {
+				throw new SourceParserException(
+						SourceErrorCodes.BRACKET_MISMATCH);
+			}
+			throw new SourceParserException(
+					SourceErrorCodes.UNEXPECTED_PARAMETER_SEPARATOR);
+		}
+	}
+
+	/**
+	 * Processes an opening bracket
+	 * 
+	 * @param data
+	 *            the search data
+	 */
+	private void processOpeningBracket(TokenizerSearchData data) {
+		data.openBracketCount++;
+		if (!data.hasData) {
+			// The number of initial '(' characters is stored. The
+			// parameters are assumed to end when the corresponding ')'
+			// character is encountered
+			data.tagStartIndex = data.itr.nextIndex();
+			data.paramStartIndex = data.tagStartIndex;
+			data.initialBracketCount = data.openBracketCount;
+		}
+	}
+
+	/**
+	 * Process a character when in quotes
+	 * 
+	 * @param data
+	 *            the search data
+	 */
+	private void processInQuotesChar(TokenizerSearchData data) {
+		if (data.value == '\"' && data.previousValue != '\\') {
+			data.inQuotes = false;
+		}
+		data.previousValue = data.value;
+	}
+
+	/**
+	 * Processes a character found after the closing bracket
+	 * 
+	 * @param data
+	 *            the data
+	 * @throws SourceParserException
+	 *             if invalid characters are found
+	 */
+	private void processEndOfParametersChar(TokenizerSearchData data)
+			throws SourceParserException {
+		if (data.value == ';' || data.value == '{') {
+			data.endFound = true;
+		} else if (data.value == ')') {
+			data.openBracketCount--;
+		} else if (!Character.isWhitespace(data.value)) {
+			throw new SourceParserException(SourceErrorCodes.BRACKET_MISMATCH);
+		}
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceParser.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,767 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Parser for C++ source files
+*
+*/
+package com.nokia.tracebuilder.source;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * Parser for C++ source files. Commented and quoted areas are located during
+ * the construction of this object and those areas are excluded from the
+ * searches.
+ * 
+ */
+public class SourceParser {
+
+	/**
+	 * Skip white spaces. Does not apply to string searches
+	 */
+	public final static int SKIP_WHITE_SPACES = 0x01; // CodForChk_Dis_Magic
+
+	/**
+	 * Skip string areas
+	 */
+	public final static int SKIP_STRINGS = 0x02; // CodForChk_Dis_Magic
+
+	/**
+	 * Search / iterate backwards
+	 */
+	public final static int BACKWARD_SEARCH = 0x04; // CodForChk_Dis_Magic
+
+	/**
+	 * Ignore character case in string searches
+	 */
+	public final static int IGNORE_CASE = 0x08; // CodForChk_Dis_Magic
+
+	/**
+	 * Skip commented areas
+	 */
+	public final static int SKIP_COMMENTS = 0x10; // CodForChk_Dis_Magic
+
+	/**
+	 * Skip preprocessor definitions
+	 */
+	public final static int SKIP_PREPROCESSOR = 0x80; // CodForChk_Dis_Magic
+
+	/**
+	 * Match beginning of word flag
+	 */
+	public final static int MATCH_WORD_BEGINNING = 0x20; // CodForChk_Dis_Magic
+
+	/**
+	 * Match end of word flag
+	 */
+	public final static int MATCH_WORD_END = 0x40; // CodForChk_Dis_Magic
+
+	/**
+	 * Match whole word flag
+	 */
+	public final static int MATCH_WHOLE_WORD = MATCH_WORD_BEGINNING
+			| MATCH_WORD_END;
+
+	/**
+	 * Ignore all special areas during search
+	 */
+	public final static int SKIP_ALL = SKIP_WHITE_SPACES | SKIP_STRINGS
+			| SKIP_COMMENTS | SKIP_PREPROCESSOR;
+
+	/**
+	 * Data to be searched.
+	 */
+	private SourceDocumentInterface source;
+
+	/**
+	 * List of source locations
+	 */
+	private ArrayList<SourceLocation> locations;
+
+	/**
+	 * Document factory for creating locations
+	 */
+	private SourceDocumentFactory documentFactory;
+
+	/**
+	 * Excluded area parser
+	 */
+	private ExcludedAreaParser excludedAreaParser;
+
+	/**
+	 * Context area parser
+	 */
+	private ContextAreaParser contextAreaParser;
+
+	/**
+	 * Function return value parser
+	 */
+	private FunctionReturnValueParser returnValueParser;
+
+	/**
+	 * Pre-processor definition parser
+	 */
+	private PreprocessorDefinitionParser preprocessorParser;
+
+	/**
+	 * Parser for type definitions
+	 */
+	private TypedefParser typedefParser;
+
+	/**
+	 * Creates a new parser for given data
+	 * 
+	 * @param factory
+	 *            the document factory
+	 * @param sourceData
+	 *            the source data
+	 */
+	public SourceParser(SourceDocumentFactory factory, String sourceData) {
+		this(factory, factory.createDocument(sourceData));
+	}
+
+	/**
+	 * Creates a source parser from source document
+	 * 
+	 * @param factory
+	 *            the document factory
+	 * @param source
+	 *            the source document
+	 */
+	public SourceParser(SourceDocumentFactory factory,
+			SourceDocumentInterface source) {
+		this.documentFactory = factory;
+		this.source = source;
+		excludedAreaParser = new ExcludedAreaParser(this);
+		contextAreaParser = new ContextAreaParser(this);
+		returnValueParser = new FunctionReturnValueParser(this);
+		try {
+			findExcludedAreas();
+		} catch (SourceParserException e) {
+		}
+	}
+
+	/**
+	 * Gets the source document
+	 * 
+	 * @return the source
+	 */
+	public SourceDocumentInterface getSource() {
+		return source;
+	}
+
+	/**
+	 * Gets part of the source document data
+	 * 
+	 * @param start
+	 *            the start offset
+	 * @param length
+	 *            the data length
+	 * @return the data or null if offsets are not valid
+	 */
+	public String getData(int start, int length) {
+		String retval;
+		try {
+			retval = source.get(start, length);
+		} catch (SourceParserException e) {
+			retval = null;
+		}
+		return retval;
+	}
+
+	/**
+	 * Gets a character at given offset
+	 * 
+	 * @param offset
+	 *            the offset
+	 * @return the character
+	 */
+	public char getData(int offset) {
+		char retval;
+		try {
+			retval = source.getChar(offset);
+		} catch (SourceParserException e) {
+			retval = '\0';
+		}
+		return retval;
+	}
+
+	/**
+	 * Gets the source document length
+	 * 
+	 * @return the source length
+	 */
+	public int getDataLength() {
+		return source.getLength();
+	}
+
+	/**
+	 * Gets the line number of given offset
+	 * 
+	 * @param offset
+	 *            the offset
+	 * @return the line number or -1 if offset is not valid
+	 */
+	public int getLineNumber(int offset) {
+		int retval;
+		try {
+			retval = source.getLineOfOffset(offset) + 1;
+		} catch (SourceParserException e) {
+			retval = -1;
+		}
+		return retval;
+	}
+
+	/**
+	 * Starts a new string search from given offset
+	 * 
+	 * @param searchString
+	 *            the string to be searched
+	 * @param startOffset
+	 *            the offset to start of search
+	 * @param endOffset
+	 *            the end of search or -1 to search the whole document
+	 * @param searchFlags
+	 *            the search flags
+	 * @return the search object
+	 */
+	public SourceStringSearch startStringSearch(String searchString,
+			int startOffset, int endOffset, int searchFlags) {
+		return new SourceStringSearch(this, searchString, startOffset,
+				endOffset, searchFlags);
+	}
+
+	/**
+	 * Tokenizes the parameter list starting from next bracket. White spaces are
+	 * discarded. For example (a, b , c ) returns { "a", "b", "c" }. This method
+	 * is independent of the current string search and thus can be used during
+	 * one.
+	 * 
+	 * @param startIndex
+	 *            the index where to start
+	 * @param list
+	 *            the list where the parameters are added
+	 * @param findSeparator
+	 *            if true, the processing stops after ';' or '{' character. If
+	 *            false, processing stops after ')' at end of parameters
+	 * @return the offset at end of the parameters
+	 * @throws SourceParserException
+	 *             if parameters are not valid
+	 */
+	public int tokenizeParameters(int startIndex, List<String> list,
+			boolean findSeparator) throws SourceParserException {
+		SourceParameterTokenizer tokenizer = new SourceParameterTokenizer(this,
+				startIndex);
+		return tokenizer.tokenize(list, findSeparator);
+	}
+
+	/**
+	 * Parses the parameter list of given source context. Each entry added into
+	 * the list will be an instance of SourceParameter class. This method is
+	 * independent of the current string search and thus can be used during one.
+	 * 
+	 * @param parameterIndex
+	 *            the index where to start
+	 * @param list
+	 *            the list where the parameters are added
+	 * @return the offset at end of the parameters
+	 * @throws SourceParserException
+	 *             if context is not valid
+	 */
+	int parseFunctionParameters(int parameterIndex, List<SourceParameter> list)
+			throws SourceParserException {
+		SourceParameterTokenizer tokenizer = new SourceParameterTokenizer(this,
+				parameterIndex);
+		return tokenizer.tokenizeTyped(list);
+	}
+
+	/**
+	 * Parses the return values of given source context
+	 * 
+	 * @param context
+	 *            the context to be parsed
+	 * @param list
+	 *            the list of return values
+	 */
+	void parseReturnValues(SourceContext context, List<SourceReturn> list) {
+		returnValueParser.parseReturnValues(context, list);
+	}
+
+	/**
+	 * Parses an enum statement from the source
+	 * 
+	 * @param offset
+	 *            the offset to the start of the enum type
+	 * @param list
+	 *            the list for the name-value pairs are parsed from source
+	 * @return the name of the enum
+	 * @throws SourceParserException
+	 *             if parser fails
+	 */
+	public String parseEnum(int offset, List<StringValuePair> list)
+			throws SourceParserException {
+		if (typedefParser == null) {
+			typedefParser = new TypedefParser(this);
+		}
+		typedefParser.parseEnum(offset, list);
+		String retval;
+		SourceIterator back = createIterator(offset,
+				SourceParser.BACKWARD_SEARCH | SourceParser.SKIP_ALL);
+		SourceIterator forw = createIterator(offset, SourceParser.SKIP_ALL);
+		int start = -1;
+		int end = -1;
+		while (back.hasNext() && start == -1) {
+			back.next();
+			if (back.hasSkipped()) {
+				start = back.previousIndex();
+			}
+		}
+		while (forw.hasNext() && end == -1) {
+			forw.next();
+			if (forw.hasSkipped()) {
+				end = forw.previousIndex();
+			}
+		}
+		if (start != -1 && end != -1) {
+			retval = source.get(start, end - start + 1);
+		} else {
+			retval = null;
+		}
+		return retval;
+	}
+
+	/**
+	 * Locates the value of a preprocessor definition for given name.
+	 * 
+	 * @param name
+	 *            the name of the definition
+	 * @return the value or null if not found
+	 * @throws SourceParserException
+	 *             if parser fails
+	 */
+	public String findPreprocessorDefinition(String name)
+			throws SourceParserException {
+		if (preprocessorParser == null) {
+			preprocessorParser = new PreprocessorDefinitionParser(this);
+		}
+		return preprocessorParser.findDefine(name);
+	}
+
+	/**
+	 * Finds an include definition with given name
+	 * 
+	 * @param name
+	 *            the include file name
+	 * @return
+	 *            <ul>
+	 *            <li>if found, index to start of #include
+	 *            <li>if not, -1 - index to end of last #include
+	 *            </ul>
+	 * @throws SourceParserException
+	 *             if parser fails
+	 */
+	public int findInclude(String name) throws SourceParserException {
+		if (preprocessorParser == null) {
+			preprocessorParser = new PreprocessorDefinitionParser(this);
+		}
+		return preprocessorParser.findInclude(name);
+	}
+
+	/**
+	 * Checks if the offset if within an excluded area
+	 * 
+	 * @param offset
+	 *            the offset
+	 * @return true if in excluded area
+	 */
+	public boolean isInExcludedArea(int offset) {
+		return findExcludedAreaIndex(offset) >= 0;
+	}
+
+	/**
+	 * Gets an excluded area
+	 * 
+	 * @param offset
+	 *            the data offset
+	 * @return the area or null
+	 */
+	public SourceExcludedArea getExcludedArea(int offset) {
+		return excludedAreaParser.getArea(offset);
+	}
+
+	/**
+	 * Creates a new source iterator
+	 * 
+	 * @param offset
+	 *            the offset where to start
+	 * @param iteratorFlags
+	 *            the flags for the iterator
+	 * @return the new iterator
+	 */
+	public SourceIterator createIterator(int offset, int iteratorFlags) {
+		return new SourceIterator(this, offset, iteratorFlags);
+	}
+
+	/**
+	 * Resets the parser
+	 */
+	public void reset() {
+		if (locations != null) {
+			// Sends delete notifications for all locations
+			while (!locations.isEmpty()) {
+				SourceLocation loc = locations.get(0);
+				removeLocation(loc);
+				loc.notifyLocationDeleted();
+			}
+		}
+		source = null;
+		resetExcludedAreas();
+		resetContexts();
+		resetPreprocessor();
+	}
+
+	/**
+	 * Resets the context parser
+	 */
+	void resetContexts() {
+		contextAreaParser.reset();
+	}
+
+	/**
+	 * Resets the context parser
+	 */
+	void resetExcludedAreas() {
+		excludedAreaParser.reset();
+	}
+
+	/**
+	 * Resets the preprocessor parser
+	 */
+	void resetPreprocessor() {
+		if (preprocessorParser != null) {
+			preprocessorParser.reset();
+		}
+	}
+
+	/**
+	 * Returns the context at given offset. This parses the source if it has not
+	 * been parsed before.
+	 * 
+	 * @param offset
+	 *            the offset to the source data
+	 * @return the context at the offset or null if no context exists
+	 */
+	public SourceContext getContext(int offset) {
+		SourceContext retval;
+		try {
+			retval = contextAreaParser.parseAndGet(offset);
+		} catch (SourceParserException e) {
+			retval = null;
+		}
+		return retval;
+	}
+
+	/**
+	 * Gets the context areas. This parses the source if it has not been parsed
+	 * before.
+	 * 
+	 * @return the areas
+	 */
+	public Iterator<SourceContext> getContexts() {
+		Iterator<SourceContext> retval;
+		try {
+			retval = contextAreaParser.parseAndGetAll();
+		} catch (SourceParserException e) {
+			List<SourceContext> list = Collections.emptyList();
+			retval = list.iterator();
+		}
+		return retval;
+	}
+
+	/**
+	 * Locates the start-of-line starting from given offset
+	 * 
+	 * @param offset
+	 *            the offset
+	 * @param cancelIfNotWhitespace
+	 *            flag that tells to stop processing and return the original
+	 *            value if a non-whitespace is found before start of line
+	 * @param stayInContext
+	 *            flag that tells to stay within the context offset currently
+	 *            resides. If this would come out of the context, this locates
+	 *            the start of the next line following offset
+	 * @return the start-of-line
+	 * @throws SourceParserException
+	 *             if the offset is not valid
+	 */
+	public int findStartOfLine(int offset, boolean cancelIfNotWhitespace,
+			boolean stayInContext) throws SourceParserException {
+		int retval = offset == 0 ? offset : offset - 1;
+		for (int i = retval; i >= 0; i--) {
+			char c = source.getChar(i);
+			if (source.getChar(i) == '\n') {
+				retval = i + 1;
+				i = -1;
+			} else if (cancelIfNotWhitespace && !Character.isWhitespace(c)) {
+				retval = offset;
+				i = -1;
+			}
+		}
+		if (stayInContext) {
+			SourceContext context = getContext(offset);
+			if (context != null && retval < context.getOffset()) {
+				retval = context.getOffset();
+				int end = context.getOffset() + context.getLength();
+				for (int i = retval; i < end; i++) {
+					if (source.getChar(i) == '\n') {
+						retval = i + 1;
+						i = end;
+					}
+				}
+			}
+		}
+		return retval;
+	}
+
+	/**
+	 * Gets the indentation from the given line
+	 * 
+	 * @param offset
+	 *            offset to a start-of-line
+	 * @return the intendation
+	 * @throws SourceParserException
+	 *             if offset is not valid
+	 */
+	public String getIndent(int offset) throws SourceParserException {
+		String retval = ""; //$NON-NLS-1$
+		for (int i = offset; i < source.getLength(); i++) {
+			char c = source.getChar(i);
+			if (c != '\t' && c != ' ') {
+				retval = source.get(offset, i - offset);
+				i = source.getLength();
+			}
+		}
+		return retval;
+	}
+
+	/**
+	 * Locates the last return statement from the given context
+	 * 
+	 * @param context
+	 *            the context
+	 * @return the offset to the beginning of the return statement
+	 */
+	public int findReturn(SourceContext context) {
+		return returnValueParser.findLast(context);
+	}
+
+	/**
+	 * Creates a location to this parser. The reference count of the location is
+	 * set to 1
+	 * 
+	 * @param index
+	 *            the location index
+	 * @param length
+	 *            the length of the location
+	 * @return the location
+	 */
+	public SourceLocation createLocation(int index, int length) {
+		SourceLocation loc = new SourceLocation(this, index, length);
+		return loc;
+	}
+
+	/**
+	 * Finds the array index of the excluded area which contains the offset. If
+	 * none of the areas contain the offset, returns negative integer indicating
+	 * the index of the excluded area following the offset
+	 * 
+	 * @param offset
+	 *            the offset to the data
+	 * @return the excluded area index
+	 */
+	int findExcludedAreaIndex(int offset) {
+		return excludedAreaParser.find(offset);
+	}
+
+	/**
+	 * Finds the excluded source file areas. Excluded areas include comments and
+	 * quoted strings. Overwrites possible old areas.
+	 * 
+	 * @throws SourceParserException
+	 *             if parser fails
+	 */
+	public void findExcludedAreas() throws SourceParserException {
+		excludedAreaParser.parseAll();
+	}
+
+	/**
+	 * Gets the list of excluded areas
+	 * 
+	 * @return the list
+	 */
+	List<SourceExcludedArea> getExcludedAreas() {
+		return excludedAreaParser.getAreas();
+	}
+
+	/**
+	 * Checks if the given range contains excluded areas
+	 * 
+	 * @param offset
+	 *            the start of range
+	 * @param end
+	 *            the end of rance
+	 * @return true if it contains excluded areas
+	 */
+	boolean containsExcludedArea(int offset, int end) {
+		return findExcludedAreaIndex(offset) != findExcludedAreaIndex(end);
+	}
+
+	/**
+	 * Finds the array index of the context area which contains the offset. If
+	 * none of the areas contain the offset, returns negative integer indicating
+	 * the index of the excluded area following the offset
+	 * 
+	 * @param offset
+	 *            the offset to the data
+	 * @return the context area index
+	 */
+	int findContextAreaIndex(int offset) {
+		return contextAreaParser.find(offset);
+	}
+
+	/**
+	 * Builds the SourceContext array. findExcludedAreas needs to be called
+	 * first
+	 * 
+	 * @throws SourceParserException
+	 *             if parser fails
+	 */
+	void findContextAreas() throws SourceParserException {
+		contextAreaParser.parseAll();
+	}
+
+	/**
+	 * Checks if the area is excluded with given flags
+	 * 
+	 * @param type
+	 *            the area type
+	 * @param flags
+	 *            the flags
+	 * @return true if skipped
+	 */
+	static boolean isExcluded(int type, int flags) {
+		boolean string = ((flags & SKIP_STRINGS) != 0)
+				&& (type == SourceExcludedArea.STRING);
+		boolean comment = ((flags & SKIP_COMMENTS) != 0)
+				&& (type == SourceExcludedArea.MULTILINE_COMMENT);
+		boolean linecomment = ((flags & SKIP_COMMENTS) != 0)
+				&& (type == SourceExcludedArea.LINE_COMMENT);
+		boolean preProcessor = ((flags & SKIP_PREPROCESSOR) != 0)
+				&& (type == SourceExcludedArea.PREPROCESSOR_DEFINITION);
+		return string || comment || linecomment || preProcessor;
+	}
+
+	/**
+	 * Adds a hidden location to this source. The location offset, length and
+	 * deleted flag will be updated as the source is updated, but the location
+	 * will not be returned by getLocations. The location is not automatically
+	 * removed from the source even if it is deleted.
+	 * 
+	 * @param offset
+	 *            the location offset
+	 * @param length
+	 *            the location length
+	 * @return the location or null if the document does not exist
+	 */
+	public SourceLocationBase createHiddenLocation(int offset, int length) {
+		SourceLocationBase location = null;
+		if (source != null && documentFactory != null) {
+			location = new SourceLocationBase(this, offset, length);
+			source.addLocation(location.getLocation());
+		}
+		return location;
+	}
+
+	/**
+	 * Removes a hidden location from this source.
+	 * 
+	 * @param location
+	 *            the location to be removed
+	 */
+	public void removeHiddenLocation(SourceLocationBase location) {
+		if (source != null) {
+			source.removeLocation(location.getLocation());
+		}
+	}
+
+	/**
+	 * Adds a location to this parser
+	 * 
+	 * @param location
+	 *            the location
+	 */
+	void addLocation(SourceLocation location) {
+		if (locations == null) {
+			locations = new ArrayList<SourceLocation>();
+		}
+		locations.add(location);
+		if (source != null) {
+			source.addLocation(location.getLocation());
+		}
+	}
+
+	/**
+	 * Removes a location from this parser
+	 * 
+	 * @param location
+	 *            the location to be removed
+	 */
+	void removeLocation(SourceLocation location) {
+		if (locations != null) {
+			locations.remove(location);
+		}
+		if (source != null) {
+			source.removeLocation(location.getLocation());
+		}
+	}
+
+	/**
+	 * Gets the source locations
+	 * 
+	 * @return the list of locations
+	 */
+	Iterator<SourceLocation> getLocations() {
+		List<SourceLocation> list;
+		if (locations != null) {
+			list = locations;
+		} else {
+			list = Collections.emptyList();
+		}
+		return list.iterator();
+	}
+
+	/**
+	 * Gets the document framework
+	 * 
+	 * @return the document framework
+	 */
+	public SourceDocumentFactory getDocumentFramework() {
+		return documentFactory;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceParserException.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Exceptions thrown by source parser
+*
+*/
+package com.nokia.tracebuilder.source;
+
+/**
+ * Exceptions thrown by source parser
+ * 
+ * @see SourceParser
+ */
+public class SourceParserException extends Exception {
+
+	/**
+	 * UID
+	 */
+	private static final long serialVersionUID = -2332983004093789880L; // CodForChk_Dis_Magic
+
+	/**
+	 * Error type
+	 */
+	private int errorType;
+
+	/**
+	 * Constructor with message and source object
+	 * 
+	 * @param errorType
+	 *            the error type
+	 */
+	public SourceParserException(int errorType) {
+		this.errorType = errorType;
+	}
+
+	/**
+	 * Gets the error type
+	 * 
+	 * @return the type
+	 */
+	public int getErrorType() {
+		return errorType;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourcePreprocessorDefinition.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,87 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Preprocessor definitions found from source
+*
+*/
+package com.nokia.tracebuilder.source;
+
+/**
+ * Preprocessor definitions found from source
+ * 
+ */
+public class SourcePreprocessorDefinition extends SourceLocationBase {
+
+	/**
+	 * Definition name
+	 */
+	private String name;
+
+	/**
+	 * Definition value
+	 */
+	private String value;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parser
+	 *            the document parser
+	 * @param offset
+	 *            the offset to the location within source
+	 */
+	SourcePreprocessorDefinition(SourceParser parser, int offset) {
+		super(parser, offset);
+	}
+
+	/**
+	 * Sets the definition name
+	 * 
+	 * @param name
+	 *            the name
+	 */
+	void setName(String name) {
+		this.name = name;
+	}
+
+	/**
+	 * Sets the definition value
+	 * 
+	 * @param value
+	 *            the value
+	 */
+	void setValue(String value) {
+		this.value = value;
+	}
+
+	/**
+	 * Returns the name of the definition
+	 * 
+	 * @return the name
+	 */
+	public String getName() {
+		return name;
+	}
+
+	/**
+	 * Returns the value of the definition
+	 * 
+	 * @return the value
+	 */
+	public String getValue() {
+		return value;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourcePropertyProvider.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 provider for SourceLocation objects
+*
+*/
+package com.nokia.tracebuilder.source;
+
+/**
+ * Property provider for SourceLocation objects
+ * 
+ */
+public interface SourcePropertyProvider {
+
+	/**
+	 * Gets a file name that can be shown in the UI when viewing a
+	 * SourceLocation
+	 * 
+	 * @return the source file name
+	 */
+	public String getFileName();
+
+	/**
+	 * Gets the path to the source file including the ending separator.
+	 * 
+	 * @return the path
+	 */
+	public String getFilePath();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceReturn.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,102 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Properties of function return statement
+*
+*/
+package com.nokia.tracebuilder.source;
+
+/**
+ * Properties of function return statement
+ * 
+ */
+public class SourceReturn extends SourceLocationBase {
+
+	/**
+	 * Previous character might cause a problem
+	 */
+	private boolean charHazard;
+
+	/**
+	 * The return statement itself might cause a problem
+	 */
+	private boolean tagHazard;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parser
+	 *            the parser owning this location
+	 * @param offset
+	 *            the offset to the beginning of return statement
+	 * @param length
+	 *            the return statement length
+	 */
+	SourceReturn(SourceParser parser, int offset, int length) {
+		super(parser, offset, length);
+	}
+
+	/**
+	 * Gets the return statement
+	 * 
+	 * @return the statement
+	 */
+	public String getReturnStatement() {
+		String retval = ""; //$NON-NLS-1$
+		if (getParser() != null) {
+			retval = getParser().getData(getOffset(), getLength());
+		}
+		return retval;
+	}
+
+	/**
+	 * Sets a flag which indicates that the character preceeding the return
+	 * statement might cause problems when a trace is added prior to the return
+	 * statement
+	 */
+	void setPreviousCharHazard() {
+		this.charHazard = true;
+	}
+
+	/**
+	 * Gets the flag which indicates if the character preceeding the return
+	 * statement might cause problems when a trace is added prior to the return
+	 * statement
+	 * 
+	 * @return the flag
+	 */
+	public boolean hasPreviousCharHazard() {
+		return charHazard;
+	}
+
+	/**
+	 * Sets a flag which indicates that the return statement might cause
+	 * problems when duplicated to a trace
+	 */
+	void setTagHazard() {
+		tagHazard = true;
+	}
+
+	/**
+	 * Gets the flag which indicates if the return statement might cause
+	 * problems when duplicated to a trace
+	 * 
+	 * @return the flag
+	 */
+	public boolean hasTagHazard() {
+		return tagHazard;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceSearch.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,178 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 source search classes
+*
+*/
+package com.nokia.tracebuilder.source;
+
+import java.util.List;
+
+/**
+ * Base class for source search classes.
+ * 
+ */
+public abstract class SourceSearch {
+
+	/**
+	 * Source parser
+	 */
+	protected final SourceParser parser;
+
+	/**
+	 * Current index within data during search
+	 */
+	protected int searchIndex;
+
+	/**
+	 * End index for search
+	 */
+	protected int searchEnd;
+
+	/**
+	 * Index of the next excluded area during search.
+	 */
+	protected int searchExcludedIndex;
+
+	/**
+	 * Search flags
+	 */
+	protected int flags;
+
+	/**
+	 * Creates a new search
+	 * 
+	 * @param parser
+	 *            the parser containing the source
+	 * @param startOffset
+	 *            offset to the start of search
+	 * @param endOffset
+	 *            offset to end of search or -1 for rest of the document
+	 * @param flags
+	 *            search flags
+	 */
+	protected SourceSearch(SourceParser parser, int startOffset, int endOffset,
+			int flags) {
+		this.parser = parser;
+		this.flags = flags;
+		resetSearch(startOffset, endOffset);
+	}
+
+	/**
+	 * Resets the current search with a new offset
+	 * 
+	 * @param startOffset
+	 *            the offset to the start of search
+	 * @param endOffset
+	 *            offset to end of search or -1 for rest of the document
+	 */
+	public void resetSearch(int startOffset, int endOffset) {
+		searchIndex = startOffset;
+		searchEnd = endOffset == -1 ? parser.getDataLength() : endOffset;
+		// Calculates the starting position for the search based on the
+		// offset and excluded areas
+		int excluded = parser.findExcludedAreaIndex(startOffset);
+		if (excluded >= 0) {
+			SourceExcludedArea area = parser.getExcludedAreas().get(excluded);
+			searchIndex = area.getOffset() + area.getLength();
+			if (excluded < parser.getExcludedAreas().size() - 1) {
+				searchExcludedIndex = excluded + 1;
+			} else {
+				searchExcludedIndex = -1;
+			}
+		} else {
+			// If binarySearch returns < 0, startIndex was between some
+			// excluded areas.
+			searchExcludedIndex = -1 - excluded;
+			if (searchExcludedIndex > parser.getExcludedAreas().size()) {
+				searchExcludedIndex = -1;
+			}
+		}
+		skipNonExcludedAreas();
+	}
+
+	/**
+	 * Changes the index to point behind an excluded area if current index is
+	 * within one.
+	 */
+	protected void skipExcludedArea() {
+		// If data index is within an excluded area, it is moved to end of
+		// it and the next excluded area is selected
+		boolean changedExcludedArea;
+		do {
+			// If the excluded area changes, the flag is set and the next
+			// excluded area is also checked. Otherwise the excluded area index
+			// gets left behind if the search index jumps past multiple excluded
+			// areas
+			changedExcludedArea = false;
+			if (searchExcludedIndex >= 0
+					&& searchExcludedIndex < parser.getExcludedAreas().size()) {
+				SourceExcludedArea area = parser.getExcludedAreas().get(
+						searchExcludedIndex);
+				if (area.getOffset() <= searchIndex) {
+					// If the search offset has skipped past an excluded area,
+					// the index is not changed
+					if (area.getOffset() + area.getLength() > searchIndex) {
+						searchIndex = area.getOffset() + area.getLength();
+					}
+					searchExcludedIndex++;
+					skipNonExcludedAreas();
+					changedExcludedArea = true;
+				}
+			}
+		} while (changedExcludedArea);
+	}
+
+	/**
+	 * Skips past excluded areas which are not actually excluded due to flags
+	 */
+	private void skipNonExcludedAreas() {
+		if (searchExcludedIndex >= 0
+				&& searchExcludedIndex < parser.getExcludedAreas().size()) {
+			boolean notExcluded = true;
+			do {
+				// If an excluded area is not excluded due to flags,
+				// the excluded area index is moved past that area
+				SourceExcludedArea area = parser.getExcludedAreas().get(
+						searchExcludedIndex);
+				if (!SourceParser.isExcluded(area.getType(), flags)) {
+					searchExcludedIndex++;
+				} else {
+					notExcluded = false;
+				}
+			} while (notExcluded
+					&& searchExcludedIndex < parser.getExcludedAreas().size());
+		}
+	}
+
+	/**
+	 * Returns the next occurence
+	 * 
+	 * @return the index or -1
+	 */
+	public abstract int findNext();
+
+	/**
+	 * Finds all occurences
+	 * 
+	 * @param list
+	 *            the list where the data is stored
+	 * @throws SourceParserException
+	 *             if search fails
+	 */
+	public abstract void findAll(List<Integer> list)
+			throws SourceParserException;
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceSelector.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Selects an area from a source
+*
+*/
+package com.nokia.tracebuilder.source;
+
+/**
+ * Selects an area from a source
+ * 
+ */
+public interface SourceSelector {
+
+	/**
+	 * Selects an area defined by given offset and length
+	 * 
+	 * @param offset
+	 *            the offset
+	 * @param length
+	 *            the length
+	 */
+	public void setSelection(int offset, int length);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceStringSearch.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,267 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 search algorithm
+*
+*/
+package com.nokia.tracebuilder.source;
+
+import java.util.List;
+
+/**
+ * String search algorithm
+ * 
+ */
+public class SourceStringSearch extends SourceSearch {
+
+	/**
+	 * String to be searched from the source.
+	 */
+	private String searchString;
+
+	/**
+	 * Number of different characters in source file alphabet. Assumes that
+	 * 8-bit encoding is used
+	 */
+	private final static int CHARACTER_COUNT = 256; // CodForChk_Dis_Magic
+
+	/**
+	 * Mask for bad character shifts (0xFF)
+	 */
+	private static final int BAD_CHARACTER_MASK = 0xFF; // CodForChk_Dis_Magic
+
+	/**
+	 * String search shifts.
+	 */
+	private int[] badCharacterShifts = new int[CHARACTER_COUNT];
+
+	/**
+	 * User data associated with search
+	 */
+	private Object searchData;
+
+	/**
+	 * Creates a new string search
+	 * 
+	 * @param parser
+	 *            the parser containing the source to be searched
+	 * @param searchString
+	 *            the string to be searched
+	 * @param startOffset
+	 *            offset to the start of search
+	 * @param endOffset
+	 *            offset to end of search or -1 for rest of the document
+	 * @param flags
+	 *            the search flags
+	 */
+	public SourceStringSearch(SourceParser parser, String searchString,
+			int startOffset, int endOffset, int flags) {
+		super(parser, startOffset, endOffset, flags);
+		setSearchString(searchString);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceSearch#findNext()
+	 */
+	@Override
+	public int findNext() {
+		try {
+			SourceDocumentInterface source = parser.getSource();
+			int stringIndex = searchString.length() - 1;
+			boolean found = false;
+			while (!found && searchIndex + stringIndex < searchEnd) {
+				char dataChar;
+				char searchChar;
+				boolean match = false;
+				do {
+					dataChar = source.getChar(searchIndex + stringIndex);
+					searchChar = searchString.charAt(stringIndex);
+					if ((flags & SourceParser.IGNORE_CASE) != 0) {
+						searchChar = Character.toLowerCase(searchChar);
+						dataChar = Character.toLowerCase(dataChar);
+					}
+					if (searchChar == '?' || searchChar == dataChar) {
+						match = true;
+						stringIndex--;
+					} else {
+						match = false;
+					}
+				} while (match && stringIndex >= 0);
+				// If string was not found, resets index and skips according
+				// to the shift table
+				if (stringIndex < 0) {
+					found = true;
+					// Checks the previous character if match beginning is set
+					if ((flags & SourceParser.MATCH_WORD_BEGINNING) != 0) {
+						if ((searchIndex > 0)
+								&& isPartOfWord(source.getChar(searchIndex - 1))) {
+							found = false;
+						}
+					}
+					// Checks the character after data if match end is set
+					if (found && ((flags & SourceParser.MATCH_WORD_END) != 0)) {
+						if (((searchIndex + searchString.length()) < source
+								.getLength())
+								&& isPartOfWord(source.getChar(searchIndex
+										+ searchString.length()))) {
+							found = false;
+						}
+					}
+				}
+				if (!found) {
+					int diff = searchString.length() - 1 - stringIndex;
+					stringIndex = searchString.length() - 1;
+					int skip;
+
+					if (dataChar > badCharacterShifts.length - 1) {
+						skip = 1;
+					} else {
+						skip = badCharacterShifts[dataChar] - diff;
+						if (skip <= 0) {
+							skip = 1;
+						}
+					}
+
+					searchIndex += skip;
+					skipExcludedArea();
+				}
+			}
+			if (!found) {
+				searchIndex = -1;
+			}
+		} catch (SourceParserException e) {
+			searchIndex = -1;
+		}
+		int ret = searchIndex;
+		if (searchIndex != -1) {
+			searchIndex += searchString.length();
+		}
+		return ret;
+	}
+
+	/**
+	 * Checks if the character is part of a word
+	 * 
+	 * @param c
+	 *            the character to be checked
+	 * @return true if part of word
+	 */
+	private boolean isPartOfWord(char c) {
+		return Character.isLetterOrDigit(c) || c == '_';
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceSearch#findAll(java.util.List)
+	 */
+	@Override
+	public void findAll(List<Integer> list) throws SourceParserException {
+		resetSearch(0, -1);
+		int index;
+		do {
+			index = findNext();
+			if (index > 0) {
+				list.add(new Integer(index));
+			}
+		} while (index > 0);
+	}
+
+	/**
+	 * Changes the search string
+	 * 
+	 * @param searchString
+	 *            the string to be searched
+	 */
+	public void setSearchString(String searchString) {
+		this.searchString = searchString;
+		int length = searchString.length();
+		// Elements not found in the string get the maximum shift distance
+		for (int i = 0; i < badCharacterShifts.length; i++) {
+			badCharacterShifts[i] = searchString.length();
+		}
+		// Characters of the search string are mapped into the
+		// shift distances array. If a character is found multiple
+		// times, the smallest shitft distance is stored
+		for (int i = 0; i < searchString.length() - 1; i++) {
+			if ((flags & SourceParser.IGNORE_CASE) != 0) {
+				badCharacterShifts[Character
+						.toLowerCase(searchString.charAt(i))
+						& BAD_CHARACTER_MASK] = length - i - 1;
+
+			} else {
+				badCharacterShifts[searchString.charAt(i) & BAD_CHARACTER_MASK] = length
+						- i - 1;
+			}
+		}
+	}
+
+	/**
+	 * Returns the search string
+	 * 
+	 * @return the string
+	 */
+	public String getSearchString() {
+		return searchString;
+	}
+
+	/**
+	 * Checks if the given string matches the search string
+	 * 
+	 * @param string
+	 *            the string
+	 * @return true if they match
+	 */
+	public boolean isSearchStringMatch(String string) {
+		int index = 0;
+		boolean match = true;
+		while (index < string.length() && match) {
+			char dataChar = string.charAt(index);
+			char searchChar = searchString.charAt(index);
+			if ((flags & SourceParser.IGNORE_CASE) != 0) {
+				searchChar = Character.toLowerCase(searchChar);
+				dataChar = Character.toLowerCase(dataChar);
+			}
+			if (searchChar == '?' || searchChar == dataChar) {
+				index++;
+			} else {
+				match = false;
+			}
+		}
+		return match;
+	}
+
+	/**
+	 * Sets the user variable associated with this searcher
+	 * 
+	 * @param data
+	 *            the variable
+	 */
+	public void setSearchData(Object data) {
+		searchData = data;
+	}
+
+	/**
+	 * Gets the user variable associated with this searcher
+	 * 
+	 * @return the variable
+	 */
+	public Object getSearchData() {
+		return searchData;
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SourceUtils.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,1146 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Static utility functions related to source files
+*
+*/
+package com.nokia.tracebuilder.source;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.StringErrorParameters;
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.TraceBuilderErrorCode;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.model.TraceConstantTable;
+import com.nokia.tracebuilder.model.TraceParameter;
+import com.nokia.tracebuilder.rules.ArrayParameterRule;
+
+/**
+ * Static utility functions related to source files
+ * 
+ */
+public class SourceUtils {
+
+	/**
+	 * Tag for array types
+	 */
+	private static final String ARRAY_TAG = "[]"; //$NON-NLS-1$
+
+	/**
+	 * Start tag for printf format specifier
+	 */
+	private static final String START_TAG = "%"; //$NON-NLS-1$
+
+	/**
+	 * Regular expression optional element tag
+	 */
+	private static final String OPTIONAL_TAG = "?"; //$NON-NLS-1$
+
+	/**
+	 * Optional parameter pattern. Quoted from Wikipedia:
+	 * 
+	 * <strong> Parameter can be omitted or can be: 'n$' Where n is the number
+	 * of the parameter to display using this format specifier, allowing the
+	 * parameters provided to be output multiple times, using varying format
+	 * specifiers or in different orders. This is a POSIX extension and not in
+	 * C99.</strong>
+	 * 
+	 * This has not been implemented -> Currently format specifier count must
+	 * match parameter count
+	 */
+	private final static String PARAMETER_PATTERN = "(\\d+\\$)"; //$NON-NLS-1$
+
+	/**
+	 * Optional flags pattern. Quoted from Wikipedia:
+	 * 
+	 * <strong> Flags can be zero or more (in any order) of:
+	 * <ul>
+	 * <li>'+' : Causes printf to always denote the sign '+' or '-' of a number
+	 * (the default is to omit the sign for positive numbers). Only applicable
+	 * to numeric types.
+	 * <li>'-' : Causes printf to left-align the output of this placeholder (the
+	 * default is to right-align the output).
+	 * <li>'#' : Alternate form. For 'g' and 'G', trailing zeros are not
+	 * removed. For 'f', 'F', 'e', 'E', 'g', 'G', the output always contains a
+	 * decimal point. For 'o', 'x', and 'X', a 0, 0x, and 0X, respectively, is
+	 * prepended to non-zero numbers.
+	 * <li>' ' : Causes printf to left-pad the output with spaces until the
+	 * required length of output is attained. If combined with '0' (see below),
+	 * it will cause the sign to become a space when positive, but the remaining
+	 * characters will be zero-padded
+	 * <li>'0' : Causes printf to use '0' (instead of spaces) to left fill a
+	 * fixed length field. For example (assume i = 3) printf("%2d", i) results
+	 * in " 3", while printf("%02d", i) results in "03"
+	 * </ul>
+	 * </strong>
+	 */
+	private final static String FLAGS_PATTERN = "([-+# 0])"; //$NON-NLS-1$
+
+	/**
+	 * Optional width pattern. Quoted from Wikipedia:
+	 * 
+	 * <strong>Width can be omitted or be any of:
+	 * <ul>
+	 * <li>a number : Causes printf to pad the output of this placeholder with
+	 * spaces until it is at least number characters wide. If number has a
+	 * leading '0', then padding is done with '0' characters.
+	 * <li>'*' : Causes printf to pad the output until it is n characters wide,
+	 * where n is an integer value stored in the a function argument just
+	 * preceding that represented by the modified type. For example
+	 * printf("%*d", 5, 10) will result in "10" being printed with a width of
+	 * 5.</strong>
+	 * </ul>
+	 * </strong>
+	 * 
+	 * '*' has not been implemented -> Currently format specifier count must
+	 * match parameter count
+	 */
+	private final static String WIDTH_PATTERN = "(\\d+|\\*)"; //$NON-NLS-1$
+
+	/**
+	 * Optional precision pattern. Quoted from Wikipedia:
+	 * 
+	 * Precision can be omitted or be any of: <strong>
+	 * <ul>
+	 * <li>a number : For non-integral numeric types, causes the decimal portion
+	 * of the output to be expressed in at least number digits. For the string
+	 * type, causes the output to be truncated at number characters.
+	 * <li>'*' : Same as the above, but uses an integer value in the intaken
+	 * argument to determine the number of decimal places or maximum string
+	 * length. For example, printf("%.*s", 3, "abcdef") will result in "abc"
+	 * being printed.
+	 * </ul>
+	 * </strong> If the precision is zero, nothing is printed for the
+	 * corresponding argument.
+	 * 
+	 * '*' has not been implemented -> Currently format specifier count must
+	 * match parameter count
+	 */
+	private final static String PRECISION_PATTERN = "(\\.(\\d+|\\*))"; //$NON-NLS-1$
+
+	/**
+	 * Optional length pattern. Quoted from Wikipedia:
+	 * 
+	 * Length can be omitted or be any of: <strong>
+	 * <ul>
+	 * <li>'hh' : For integer types, causes printf to expect an int sized
+	 * integer argument which was promoted from a char.
+	 * <li>'h' : For integer types, causes printf to expect a int sized integer
+	 * argument which was promoted from a short.
+	 * <li>'l' : (ell) For integer types, causes printf to expect a long sized
+	 * integer argument.
+	 * <li>'ll' : (ell ell) For integer types, causes printf to expect a long
+	 * long sized integer argument.
+	 * <li>'L' : For floating point types, causes printf to expect a long double
+	 * argument.
+	 * <li>'z' : For integer types, causes printf to expect a size_t sized
+	 * integer argument.
+	 * <li>'j' : For integer types, causes printf to expect a intmax_t sized
+	 * integer argument.
+	 * <li>'t' : For integer types, causes printf to expect a ptrdiff_t sized
+	 * integer argument.
+	 * </ul>
+	 * </strong>
+	 */
+	private final static String LENGTH_PATTERN = "([lh]?[hHlLZjt])"; //$NON-NLS-1$
+
+	/**
+	 * Type pattern. Quoted from Wikipedia:
+	 * 
+	 * <strong> type can be any of:
+	 * <ul>
+	 * <li>'d', 'i' : Print an int as a signed decimal number. '%d' and '%i' are
+	 * synonymous for output, but are different when used with scanf() for
+	 * input.
+	 * <li>'u' : Print decimal unsigned int.
+	 * <li>'f', 'F' : Print a double in normal (fixed-point) notation.
+	 * <li>'e', 'E' : Print a double value in standard form ([-]d.ddd
+	 * e[+/-]ddd).
+	 * <li>'g', 'G' : Print a double in either normal or exponential notation,
+	 * whichever is more appropriate for its magnitude. 'g' uses lower-case
+	 * letters, 'G' uses upper-case letters. This type differs slightly from
+	 * fixed-point notation in that insignificant zeroes to the right of the
+	 * decimal point are not included. Also, the decimal point is not included
+	 * on whole numbers.
+	 * <li>'x', 'X' : Print an unsigned int as a hexadecimal number. 'x' uses
+	 * lower-case letters and 'X' uses upper-case.
+	 * <li>'o' : Print an unsigned int in octal.
+	 * <li>'s' : Print a character string.
+	 * <li>'c' : Print a char (character).
+	 * <li>'p' : Print a void * (pointer to void) in an implementation-defined
+	 * format.
+	 * <li>'n' : Write number of characters successfully written so far into an
+	 * integer pointer parameter.
+	 * <li>'%' : Print a literal '%' character (this type doesn't accept any
+	 * flags, width, precision or length).
+	 * </ul>
+	 * </strong>
+	 * 
+	 * The pattern itself accepts all characters and the validity check is done
+	 * in {@link #mapFormatToParameterType mapFormatToType}
+	 */
+	private final static String TYPE_PATTERN = "([a-zA-Z%])"; //$NON-NLS-1$
+
+	/**
+	 * Regular expression pattern for printf
+	 * 
+	 * %[parameter][flags][width][.precision][length]type
+	 */
+	private static final String STANDARD_PRINTF_PATTERN = PARAMETER_PATTERN
+			+ OPTIONAL_TAG + FLAGS_PATTERN + OPTIONAL_TAG + WIDTH_PATTERN
+			+ OPTIONAL_TAG + PRECISION_PATTERN + OPTIONAL_TAG + LENGTH_PATTERN
+			+ OPTIONAL_TAG + TYPE_PATTERN;
+
+	/**
+	 * Regular expression pattern for Open System Trace printf extensions
+	 * %{Type}, %{Array[]}
+	 */
+	private static final String EXTENSION_PRINTF_PATTERN = "\\{[\\w_]+(\\[\\])?\\}"; //$NON-NLS-1$
+
+	/**
+	 * Regular expression pattern for printf
+	 */
+	public static final String PRINTF_PATTERN = START_TAG + "((" //$NON-NLS-1$
+			+ STANDARD_PRINTF_PATTERN + ")|(" //$NON-NLS-1$
+			+ EXTENSION_PRINTF_PATTERN + "))"; //$NON-NLS-1$
+
+	/**
+	 * The pattern for printf-formatted trace text
+	 */
+	public final static Pattern traceTextPattern = Pattern
+			.compile(PRINTF_PATTERN);
+
+	/**
+	 * The pattern for parameter length in printf specifier
+	 */
+	public final static Pattern lengthPattern = Pattern.compile(LENGTH_PATTERN);
+
+	/**
+	 * Hidden constructor
+	 */
+	private SourceUtils() {
+	}
+
+	/**
+	 * Creates a header guard
+	 * 
+	 * @param fileName
+	 *            the name of the file
+	 * @return the header guard
+	 */
+	public static String createHeaderGuard(String fileName) {
+		StringBuffer sb = new StringBuffer();
+		String uname = fileName.replace(SourceConstants.PERIOD_CHAR,
+				SourceConstants.UNDERSCORE_CHAR).toUpperCase();
+		sb.append(SourceConstants.IFNDEF);
+		sb.append(SourceConstants.SPACE);
+		sb.append(SourceConstants.DOUBLE_UNDERSCORE);
+		sb.append(uname);
+		sb.append(SourceConstants.DOUBLE_UNDERSCORE);
+		sb.append(SourceConstants.LINE_FEED);
+		sb.append(SourceConstants.DEFINE);
+		sb.append(SourceConstants.SPACE);
+		sb.append(SourceConstants.DOUBLE_UNDERSCORE);
+		sb.append(uname);
+		sb.append(SourceConstants.DOUBLE_UNDERSCORE);
+		return sb.toString();
+	}
+
+	/**
+	 * Checks the validity of name
+	 * 
+	 * @param name
+	 *            the name
+	 * @return true if valid
+	 */
+	public static boolean isValidName(String name) {
+		boolean retval;
+		if (name != null && name.length() > 0) {
+			retval = true;
+			if (!isValidNameStartChar(name.charAt(0))) {
+				retval = false;
+			} else {
+				for (int i = 1; i < name.length() && retval; i++) {
+					retval = isValidNameChar(name.charAt(i));
+				}
+			}
+		} else {
+			retval = false;
+		}
+		return retval;
+	}
+
+	/**
+	 * Checks the validity of parameter name
+	 * 
+	 * @param name
+	 *            the name
+	 * @return true if valid
+	 */
+	public static boolean isValidParameterName(String name) {
+		boolean retval;
+		if (name != null && name.length() > 0) {
+			retval = true;
+			if (!isValidNameStartChar(name.charAt(0))) {
+				retval = false;
+			} else {
+				for (int i = 1; i < name.length() && retval; i++) {
+
+					// Check validity of the character
+					char c = name.charAt(i);
+					retval = (isValidNameChar(c) || isValidSpecialChar(c));
+				}
+			}
+		} else {
+			retval = false;
+		}
+		return retval;
+	}
+
+	/**
+	 * Checks special character validity
+	 * 
+	 * @param c
+	 *            character
+	 * @return true if valid
+	 */
+	private static boolean isValidSpecialChar(char c) {
+		boolean retval = false;
+		// Check if the character is allowed
+		if (c == '.' || c == '-' || c == '>' || c == '(' || c == ')'
+				|| c == '[' || c == ']' || c == ' ' || c == '&' || c == '*') {
+			retval = true;
+		}
+		return retval;
+	}
+
+	/**
+	 * Checks start-of-name character validity
+	 * 
+	 * @param c
+	 *            character
+	 * @return true if valid
+	 */
+	private static boolean isValidNameStartChar(char c) {
+		// Ascii characters and underscore are allowed
+		return (c >= 0x41 && c <= 0x5A) || (c >= 0x61 && c <= 0x7A) // CodForChk_Dis_Magic
+				|| c == 0x5F; // CodForChk_Dis_Magic
+	}
+
+	/**
+	 * Checks name character validity
+	 * 
+	 * @param c
+	 *            character
+	 * @return true if valid
+	 */
+	private static boolean isValidNameChar(char c) {
+		// Numbers are allowed in addition to start characters
+		return isValidNameStartChar(c) || (c >= 0x30 && c <= 0x39); // CodForChk_Dis_Magic
+	}
+
+	/**
+	 * Maps a Symbian type to one of the TraceParameter types
+	 * 
+	 * @param parsedType
+	 *            the type parsed from source
+	 * @return the parameter type
+	 */
+	public static TypeMapping mapSymbianTypeToParameterType(
+			ParsedType parsedType) {
+		String type = null;
+		// The type map contains Symbian types
+		for (int i = 0; i < SymbianConstants.PARAMETER_TYPE_MAP.length
+				&& type == null; i++) {
+			if (parsedType
+					.typeEquals(SymbianConstants.PARAMETER_TYPE_MAP[i][0])) {
+				type = SymbianConstants.PARAMETER_TYPE_MAP[i][1];
+			}
+		}
+		if (type != null) {
+			if (parsedType.hasQualifier(SourceConstants.UNSIGNED)) {
+				type = convertToUnsigned(type);
+			}
+		}
+		TypeMapping retval = new TypeMapping(type);
+		if (type != null) {
+			// Value or a reference can be added to source as is
+			// Points needs to be cast to HEX32
+			if (parsedType.isPointer()) {
+				retval.type = TraceParameter.HEX32;
+				retval.needsCasting = true;
+			} else {
+				// TUint32 needs to be cast to TUint and TInt32 to TInt.
+				// Otherwise there will be some problems with extension
+				// headers
+				if (parsedType.typeEquals(SymbianConstants.TUINT32)
+						|| parsedType.typeEquals(SymbianConstants.TINT32)) {
+					retval.needsCasting = true;
+				}
+			}
+		} else if (parsedType.isPointer()) {
+			// Unrecognized pointer types are cast to Hex32
+			retval.type = TraceParameter.HEX32;
+			retval.needsCasting = true;
+		} else {
+			// Unrecognized value types are passed as pointer and cast to Hex32
+			retval.type = TraceParameter.HEX32;
+			retval.valueToPointer = true;
+			retval.needsCasting = true;
+		}
+		return retval;
+	}
+
+	/**
+	 * Maps the type of a parameter to a Symbian type
+	 * 
+	 * @param parameter
+	 *            the parameter
+	 * @return the parameter type as string
+	 */
+	public static String mapParameterTypeToSymbianType(TraceParameter parameter) {
+		String retval;
+		ArrayParameterRule rule = parameter
+				.getExtension(ArrayParameterRule.class);
+		String type = parameter.getType();
+		TraceConstantTable table = parameter.getModel()
+				.findConstantTableByName(type);
+		if (table != null) {
+			type = table.getType();
+		}
+		if (rule != null) {
+			retval = mapArrayTypeToSymbianType(type);
+		} else {
+			retval = mapBasicTypeToSymbianType(type);
+		}
+		return retval;
+	}
+
+	/**
+	 * Maps a basic parameter type to Symbian type
+	 * 
+	 * @param type
+	 *            the parameter type
+	 * @return the Symbian type
+	 */
+	public static String mapBasicTypeToSymbianType(String type) {
+		String retval;
+		// Unsigned and hex both use TUint types
+		// Signed uses TInt types
+		if (type.equals(TraceParameter.POINTER)) {
+			retval = SymbianConstants.CONST_TANY_PTR;
+		} else if (type.equals(TraceParameter.SDEC32)) {
+			retval = SymbianConstants.TINT;
+		} else if (type.equals(TraceParameter.UDEC32)
+				|| type.equals(TraceParameter.OCT32)
+				|| type.equals(TraceParameter.HEX32)) {
+			retval = SymbianConstants.TUINT;
+		} else if (type.equals(TraceParameter.SDEC16)) {
+			retval = SymbianConstants.TINT16;
+		} else if (type.equals(TraceParameter.UDEC16)
+				|| type.equals(TraceParameter.OCT16)
+				|| type.equals(TraceParameter.HEX16)) {
+			retval = SymbianConstants.TUINT16;
+		} else if (type.equals(TraceParameter.SDEC8)) {
+			retval = SymbianConstants.TINT8;
+		} else if (type.equals(TraceParameter.UDEC8)
+				|| type.equals(TraceParameter.OCT8)
+				|| type.equals(TraceParameter.HEX8)) {
+			retval = SymbianConstants.TUINT8;
+		} else if (type.equals(TraceParameter.SDEC64)
+				|| type.equals(TraceParameter.TIME)) {
+			retval = SymbianConstants.TINT64;
+		} else if (type.equals(TraceParameter.UDEC64)
+				|| type.equals(TraceParameter.OCT64)
+				|| type.equals(TraceParameter.HEX64)) {
+			retval = SymbianConstants.TUINT64;
+		} else if (type.equals(TraceParameter.ASCII)) {
+			retval = SymbianConstants.CONST_TDESC8_REF;
+		} else if (type.equals(TraceParameter.UNICODE)) {
+			retval = SymbianConstants.CONST_TDESC16_REF;
+		} else if (type.equals(TraceParameter.FLOAT_EXP)
+				|| type.equals(TraceParameter.FLOAT_FIX)
+				|| type.equals(TraceParameter.FLOAT_OPT)) {
+			retval = SymbianConstants.TREAL;
+		} else {
+			retval = SymbianConstants.TANY_PTR;
+		}
+		return retval;
+	}
+
+	/**
+	 * Maps an array parameter type to Symbian type
+	 * 
+	 * @param type
+	 *            the parameter type
+	 * @return the Symbian type
+	 */
+	public static String mapArrayTypeToSymbianType(String type) {
+		String basic = mapBasicTypeToSymbianType(type);
+		String retval = SourceConstants.OST_ARRAY_TYPE_PREFIX + basic
+				+ SourceConstants.OST_ARRAY_TYPE_POSTFIX;
+		return retval;
+	}
+
+	/**
+	 * Maps a format specifier into parameter type
+	 * 
+	 * @param formatSpecifier
+	 *            the format specifier
+	 * @return the parameter type or null if not recognized. If the type is one
+	 *         of the supported TraceParameter types, the string contains the
+	 *         integer value of the type
+	 * @throws TraceBuilderException
+	 *             if format specifier is not valid
+	 */
+	public static FormatMapping mapFormatToParameterType(String formatSpecifier)
+			throws TraceBuilderException {
+		String type;
+		boolean array = false;
+		boolean basic = false;
+		boolean extended = false;
+		int len = formatSpecifier.length();
+		// Extension format is checked first: %{x}
+		if (len > 3 && formatSpecifier.charAt(1) == '{' // CodForChk_Dis_Magic
+				&& formatSpecifier.charAt(len - 1) == '}') {
+			// Extension format can be an array: %{x[]}
+			// In that case it could also be a basic type
+			if (len > 3 + ARRAY_TAG.length() // CodForChk_Dis_Magic
+					&& formatSpecifier.charAt(len - 3) == '[' // CodForChk_Dis_Magic
+					&& formatSpecifier.charAt(len - 2) == ']') { // CodForChk_Dis_Magic
+				type = formatSpecifier.substring(2, len - 1 // CodForChk_Dis_Magic
+						- ARRAY_TAG.length());
+				array = true;
+				if (isStringType(type)) {
+					StringErrorParameters param = new StringErrorParameters();
+					param.string = type;
+					throw new TraceBuilderException(
+							TraceBuilderErrorCode.PARAMETER_FORMAT_NOT_SUPPORTED_IN_ARRAY,
+							param, null);
+				}
+			} else {
+				type = formatSpecifier.substring(2, len - 1); // CodForChk_Dis_Magic
+			}
+			extended = !isBasicType(type);
+		} else {
+			basic = true;
+			type = formatSpecifier;
+		}
+				
+		if (basic) {
+			type = mapBasicFormatToType(formatSpecifier);
+		}
+		if (type == null) {
+			StringErrorParameters params = new StringErrorParameters();
+			params.string = formatSpecifier;
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.PARAMETER_FORMAT_NOT_SUPPORTED,
+					params, null);
+		}
+		FormatMapping retval = new FormatMapping(type);
+		retval.isArray = array;
+		if (extended) {
+			// In case of extended types, a constant table can still be
+			// represented with normal trace macros.
+			TraceConstantTable table = TraceBuilderGlobals.getTraceModel()
+					.findConstantTableByName(retval.type);
+			if (table != null) {
+				if (!array && isSimpleType(table.getType())) {
+					retval.isSimple = true;
+				}
+			} else {
+				// Extended type must be found from the property file
+				StringErrorParameters params = new StringErrorParameters();
+				params.string = formatSpecifier;
+				throw new TraceBuilderException(
+						TraceBuilderErrorCode.PARAMETER_FORMAT_NOT_SUPPORTED,
+						params, null);
+			}
+		} else if (!retval.isArray) {
+			retval.isSimple = isSimpleType(type);
+		}
+				
+		return retval;
+	}
+
+	/**
+	 * Maps basic format specifies to parameter type
+	 * 
+	 * @param formatSpecifier
+	 *            the format specifies
+	 * @return the type
+	 * @throws TraceBuilderException
+	 *             if mapping cannot be done
+	 */
+	private static String mapBasicFormatToType(String formatSpecifier)
+			throws TraceBuilderException { // CodForChk_Dis_ComplexFunc
+		String type;
+		int paramLength = SourceUtils
+				.mapFormatToParameterLength(formatSpecifier);
+		char formatChar = formatSpecifier.charAt(formatSpecifier.length() - 1);
+		switch (formatChar) {
+		case 'd':
+			type = SourceUtils.mapSignedToParameterType(paramLength);
+			break;
+		case 'x':
+		case 'X':
+			type = SourceUtils.mapHexToParameterType(paramLength);
+			break;
+		case 'u':
+			type = SourceUtils.mapUnsignedToParameterType(paramLength);
+			break;
+		case 'o':
+			type = SourceUtils.mapOctalToParameterType(paramLength);
+			break;
+		case 's':
+			type = TraceParameter.ASCII;
+			break;
+		case 'S': // Symbian extension
+			type = TraceParameter.UNICODE;
+			break;
+		case 'c':
+			type = TraceParameter.SDEC8;
+			break;
+		case 'p':
+			type = TraceParameter.POINTER;
+			break;
+		case 'f':
+		case 'F':
+			type = TraceParameter.FLOAT_FIX;
+			break;
+		case 'e':
+		case 'E':
+			type = TraceParameter.FLOAT_EXP;
+			break;
+		case 'g':
+		case 'G':
+			type = TraceParameter.FLOAT_OPT;
+			break;
+		default:
+			type = null;
+		}
+
+		return type;
+	}
+
+	/**
+	 * Maps a parameter type to format string
+	 * 
+	 * @param parameter
+	 *            the parameter
+	 * @return the format string
+	 */
+	public static String mapParameterTypeToFormat(TraceParameter parameter) {
+		String tag;
+		if (parameter.getExtension(ArrayParameterRule.class) != null) {
+			tag = mapArrayTypeToFormat(parameter.getType());
+		} else {
+			tag = mapNormalTypeToFormat(parameter.getType());
+		}
+		return tag;
+	}
+
+	/**
+	 * Maps an array type to basic type
+	 * 
+	 * @param arrayType
+	 *            the array type
+	 * @return the basic type or null if original type is not array type
+	 */
+	public static String mapArrayTypeToBasicType(String arrayType) {
+		String retval;
+		if (arrayType.endsWith(ARRAY_TAG)) {
+			retval = arrayType.substring(0, arrayType.length()
+					- ARRAY_TAG.length());
+		} else {
+			retval = null;
+		}
+		return retval;
+	}
+
+	/**
+	 * Parses a numeric value from source
+	 * 
+	 * @param number
+	 *            the number as string
+	 * @return the value
+	 */
+	public static int parseNumberFromSource(String number) {
+		int ret;
+		String low = number.toLowerCase();
+		int radix;
+		if (low.startsWith(SourceConstants.HEX_PREFIX)) {
+			radix = 16; // CodForChk_Dis_Magic
+			low = low.substring(SourceConstants.HEX_PREFIX.length());
+		} else if (low.startsWith(SourceConstants.OCTAL_PREFIX)
+				&& low.length() > SourceConstants.OCTAL_PREFIX.length()
+				&& Character.isDigit(low.charAt(SourceConstants.OCTAL_PREFIX
+						.length()))) {
+			radix = 8; // CodForChk_Dis_Magic
+			low = low.substring(SourceConstants.OCTAL_PREFIX.length());
+		} else {
+			radix = 10; // CodForChk_Dis_Magic
+		}
+		if (low.endsWith(SourceConstants.I64_POSTFIX)) {
+			low = low.substring(0, low.length()
+					- SourceConstants.I64_POSTFIX.length());
+		}
+		if (low.length() > 0) {
+			// Removes U / L characters from the end of value
+			int index = low.length() - 1;
+			boolean complete = false;
+			do {
+				char c = low.charAt(index);
+				if (c == 'u' || c == 'l') {
+					index--;
+				} else {
+					complete = true;
+				}
+			} while (!complete && index >= 0);
+			if (index < low.length() - 1 && index > 0) {
+				low = low.substring(0, index + 1);
+			}
+			ret = Integer.parseInt(low, radix);
+		} else {
+			ret = 0;
+		}
+		return ret;
+	}
+
+	/**
+	 * Calculates the size of parameter
+	 * 
+	 * @param parameter
+	 *            the parameter
+	 * @return the parameter size or 0 if the size is not known at compile time
+	 */
+	public static int mapParameterTypeToSize(TraceParameter parameter) {
+		int retval;
+		ArrayParameterRule rule = parameter
+				.getExtension(ArrayParameterRule.class);
+		if (rule != null) {
+			// Array parameters are dynamic
+			retval = 0;
+		} else {
+			String type = parameter.getType();
+			TraceConstantTable table = parameter.getModel()
+					.findConstantTableByName(type);
+			if (table != null) {
+				type = table.getType();
+			}
+			retval = mapParameterTypeToSize(type);
+		}
+		return retval;
+	}
+
+	/**
+	 * Calculates the size of parameter type
+	 * 
+	 * @param type
+	 *            the parameter type
+	 * @return the parameter size or 0 if size is not known at compile time
+	 */
+	public static int mapParameterTypeToSize(String type) {
+		int retval;
+		if (type.equals(TraceParameter.HEX32)
+				|| type.equals(TraceParameter.UDEC32)
+				|| type.equals(TraceParameter.SDEC32)
+				|| type.equals(TraceParameter.OCT32)
+				|| type.equals(TraceParameter.POINTER)) {
+			retval = 4; // CodForChk_Dis_Magic
+		} else if (type.equals(TraceParameter.HEX16)
+				|| type.equals(TraceParameter.UDEC16)
+				|| type.equals(TraceParameter.SDEC16)
+				|| type.equals(TraceParameter.OCT16)) {
+			retval = 2; // CodForChk_Dis_Magic
+		} else if (type.equals(TraceParameter.HEX8)
+				|| type.equals(TraceParameter.UDEC8)
+				|| type.equals(TraceParameter.SDEC8)
+				|| type.equals(TraceParameter.OCT8)) {
+			retval = 1;
+		} else if (type.equals(TraceParameter.HEX64)
+				|| type.equals(TraceParameter.UDEC64)
+				|| type.equals(TraceParameter.SDEC64)
+				|| type.equals(TraceParameter.OCT64)
+				|| type.equals(TraceParameter.FLOAT_EXP)
+				|| type.equals(TraceParameter.FLOAT_FIX)
+				|| type.equals(TraceParameter.FLOAT_OPT)) {
+			retval = 8; // CodForChk_Dis_Magic
+		} else {
+			retval = 0;
+		}
+		return retval;
+	}
+
+	/**
+	 * Removes printf formatting from trace text
+	 * 
+	 * @param text
+	 *            the text to be converted
+	 * @return the new text
+	 */
+	public static String removePrintfFormatting(String text) {
+		Matcher matcher = traceTextPattern.matcher(text);
+		return matcher.replaceAll(""); //$NON-NLS-1$
+	}
+
+	/**
+	 * Converts the given type to unsigned type
+	 * 
+	 * @param type
+	 *            the type
+	 * @return unsigned type
+	 */
+	private static String convertToUnsigned(String type) {
+		if (type.equals(TraceParameter.SDEC32)) {
+			type = TraceParameter.UDEC32;
+		} else if (type.equals(TraceParameter.SDEC16)) {
+			type = TraceParameter.UDEC16;
+		} else if (type.equals(TraceParameter.SDEC8)) {
+			type = TraceParameter.UDEC8;
+		} else if (type.equals(TraceParameter.SDEC64)) {
+			type = TraceParameter.UDEC64;
+		}
+		return type;
+	}
+
+	/**
+	 * Maps a normal parameter type for format character
+	 * 
+	 * @param type
+	 *            the parameter type
+	 * @return the format character
+	 */
+	public static String mapNormalTypeToFormat(String type) { // CodForChk_Dis_ComplexFunc
+		String tag;
+		if (type.equals(TraceParameter.SDEC32)) {
+			tag = "%d"; //$NON-NLS-1$
+		} else if (type.equals(TraceParameter.POINTER)) {
+			tag = "%p"; //$NON-NLS-1$
+		} else if (type.equals(TraceParameter.HEX32)) {
+			tag = "%x"; //$NON-NLS-1$
+		} else if (type.equals(TraceParameter.UDEC32)) {
+			tag = "%u"; //$NON-NLS-1$
+		} else if (type.equals(TraceParameter.OCT32)) {
+			tag = "%o"; //$NON-NLS-1$			
+		} else if (type.equals(TraceParameter.SDEC16)) {
+			tag = "%hd"; //$NON-NLS-1$
+		} else if (type.equals(TraceParameter.HEX16)) {
+			tag = "%hx"; //$NON-NLS-1$
+		} else if (type.equals(TraceParameter.UDEC16)) {
+			tag = "%hu"; //$NON-NLS-1$
+		} else if (type.equals(TraceParameter.OCT16)) {
+			tag = "%ho"; //$NON-NLS-1$			
+		} else if (type.equals(TraceParameter.SDEC8)) {
+			tag = "%hhd"; //$NON-NLS-1$
+		} else if (type.equals(TraceParameter.HEX8)) {
+			tag = "%hhx"; //$NON-NLS-1$
+		} else if (type.equals(TraceParameter.UDEC8)) {
+			tag = "%hhu"; //$NON-NLS-1$
+		} else if (type.equals(TraceParameter.OCT8)) {
+			tag = "%hho"; //$NON-NLS-1$			
+		} else if (type.equals(TraceParameter.SDEC64)) {
+			tag = "%Ld"; //$NON-NLS-1$
+		} else if (type.equals(TraceParameter.HEX64)) {
+			tag = "%Lx"; //$NON-NLS-1$
+		} else if (type.equals(TraceParameter.UDEC64)) {
+			tag = "%Lu"; //$NON-NLS-1$
+		} else if (type.equals(TraceParameter.OCT64)) {
+			tag = "%Lo"; //$NON-NLS-1$			
+		} else if (type.equals(TraceParameter.ASCII)) {
+			tag = "%s"; //$NON-NLS-1$
+		} else if (type.equals(TraceParameter.UNICODE)) {
+			tag = "%S"; //$NON-NLS-1$
+		} else if (type.equals(TraceParameter.FLOAT_FIX)) {
+			tag = "%f"; //$NON-NLS-1$
+		} else if (type.equals(TraceParameter.FLOAT_EXP)) {
+			tag = "%e"; //$NON-NLS-1$
+		} else if (type.equals(TraceParameter.FLOAT_OPT)) {
+			tag = "%g"; //$NON-NLS-1$
+		} else {
+			tag = "%{" //$NON-NLS-1$
+					+ type + "}"; //$NON-NLS-1$
+		}
+		return tag;
+	}
+
+	/**
+	 * Maps an array parameter type to format string
+	 * 
+	 * @param type
+	 *            the parameter type
+	 * @return the format string
+	 */
+	public static String mapArrayTypeToFormat(String type) {
+		String tag = "%{" //$NON-NLS-1$
+				+ type + "[]}"; //$NON-NLS-1$
+		return tag;
+	}
+
+	/**
+	 * Maps format specifier to parameter length
+	 * 
+	 * @param formatSpecifier
+	 *            the specifier
+	 * @return the length
+	 * @throws TraceBuilderException
+	 *             if length is not valid
+	 */
+	public static int mapFormatToParameterLength(String formatSpecifier)
+			throws TraceBuilderException {
+		Matcher matcher = SourceUtils.lengthPattern.matcher(formatSpecifier);
+		int paramLength = 0;
+		if (matcher.find()) {
+			String length = matcher.group();
+
+			if (length.length() == 2) { // CodForChk_Dis_Magic
+				if (length.charAt(0) == 'h' && length.charAt(1) == 'h') {
+					paramLength = SourceConstants.BYTE_SIZE;
+				} else if (length.charAt(0) == 'l' && length.charAt(1) == 'l') {
+					paramLength = SourceConstants.LONG_SIZE;
+				} else {
+					StringErrorParameters params = new StringErrorParameters();
+					params.string = formatSpecifier;
+					throw new TraceBuilderException(
+							TraceBuilderErrorCode.PARAMETER_FORMAT_NOT_SUPPORTED,
+							params, null);
+				}
+			} else if (length.length() == 1) {
+				switch (length.charAt(0)) {
+				case 'h':
+					paramLength = SourceConstants.SHORT_SIZE;
+					break;
+				case 'l':
+					paramLength = SourceConstants.INT_SIZE;
+					break;
+				case 'L':
+					paramLength = SourceConstants.LONG_SIZE;
+					break;
+				default:
+					StringErrorParameters params = new StringErrorParameters();
+					params.string = formatSpecifier;
+					throw new TraceBuilderException(
+							TraceBuilderErrorCode.PARAMETER_FORMAT_NOT_SUPPORTED,
+							params, null);
+				}
+			} else {
+				throw new TraceBuilderException(
+						TraceBuilderErrorCode.INVALID_TRACE_TEXT_FORMAT, null,
+						formatSpecifier);
+			}
+		}
+
+		return paramLength;
+	}
+
+	/**
+	 * Maps signed parameter length to type
+	 * 
+	 * @param paramLength
+	 *            the length
+	 * @return the type
+	 */
+	private static String mapSignedToParameterType(int paramLength) {
+		String retval;
+		if (paramLength == SourceConstants.BYTE_SIZE) {
+			retval = TraceParameter.SDEC8;
+		} else if (paramLength == SourceConstants.SHORT_SIZE) {
+			retval = TraceParameter.SDEC16;
+		} else if (paramLength == SourceConstants.LONG_SIZE) {
+			retval = TraceParameter.SDEC64;
+		} else {
+			retval = TraceParameter.SDEC32;
+		}
+		return retval;
+	}
+
+	/**
+	 * Maps unsigned parameter length to type
+	 * 
+	 * @param paramLength
+	 *            the length
+	 * @return the type
+	 */
+	public static String mapUnsignedToParameterType(int paramLength) {
+		String retval;
+		if (paramLength == SourceConstants.BYTE_SIZE) {
+			retval = TraceParameter.UDEC8;
+		} else if (paramLength == SourceConstants.SHORT_SIZE) {
+			retval = TraceParameter.UDEC16;
+		} else if (paramLength == SourceConstants.LONG_SIZE) {
+			retval = TraceParameter.UDEC64;
+		} else {
+			retval = TraceParameter.UDEC32;
+		}
+		return retval;
+	}
+
+	/**
+	 * Maps hex parameter length to type
+	 * 
+	 * @param paramLength
+	 *            the length
+	 * @return the type
+	 */
+	public static String mapHexToParameterType(int paramLength) {
+		String retval;
+		if (paramLength == SourceConstants.BYTE_SIZE) {
+			retval = TraceParameter.HEX8;
+		} else if (paramLength == SourceConstants.SHORT_SIZE) {
+			retval = TraceParameter.HEX16;
+		} else if (paramLength == SourceConstants.LONG_SIZE) {
+			retval = TraceParameter.HEX64;
+		} else {
+			retval = TraceParameter.HEX32;
+		}
+		return retval;
+	}
+
+	/**
+	 * Maps octal parameter length to type
+	 * 
+	 * @param paramLength
+	 *            the length
+	 * @return the type
+	 */
+	public static String mapOctalToParameterType(int paramLength) {
+		String retval;
+		if (paramLength == SourceConstants.BYTE_SIZE) {
+			retval = TraceParameter.OCT8;
+		} else if (paramLength == SourceConstants.SHORT_SIZE) {
+			retval = TraceParameter.OCT16;
+		} else if (paramLength == SourceConstants.LONG_SIZE) {
+			retval = TraceParameter.OCT64;
+		} else {
+			retval = TraceParameter.OCT32;
+		}
+
+		return retval;
+	}
+
+	/**
+	 * Checks if the parameter can be represented with default trace macros
+	 * 
+	 * @param parameter
+	 *            the parameter
+	 * @return true if parameter can be represented with default trace macros
+	 */
+	public static boolean isSimpleType(TraceParameter parameter) {
+		boolean retval;
+		if (parameter.getExtension(ArrayParameterRule.class) != null) {
+			// Arrays are always complex types
+			retval = false;
+		} else {
+			String type = parameter.getType();
+			TraceConstantTable table = parameter.getModel()
+					.findConstantTableByName(type);
+			if (table != null) {
+				type = table.getType();
+			}
+			retval = isSimpleType(type);
+		}
+		return retval;
+	}
+
+	/**
+	 * Simple type is 32-bit integer
+	 * 
+	 * @param type
+	 *            the type
+	 * @return true if simple, false if not
+	 */
+	private static boolean isSimpleType(String type) {
+		return type.equals(TraceParameter.SDEC32)
+				|| type.equals(TraceParameter.UDEC32)
+				|| type.equals(TraceParameter.OCT32)
+				|| type.equals(TraceParameter.HEX32);
+	}
+
+	/**
+	 * String type is either ascii or unicode
+	 * 
+	 * @param type
+	 *            the type
+	 * @return true if string, false if not
+	 */
+	private static boolean isStringType(String type) {
+		return type.equals(TraceParameter.ASCII)
+				|| type.equals(TraceParameter.UNICODE);
+	}
+
+	/**
+	 * Basic type is any of the built-in TraceParameter types
+	 * 
+	 * @param type
+	 *            the type
+	 * @return true if basic, false if not
+	 */
+	private static boolean isBasicType(String type) {
+		return isSimpleType(type) || type.equals(TraceParameter.SDEC8)
+				|| type.equals(TraceParameter.SDEC16)
+				|| type.equals(TraceParameter.UDEC8)
+				|| type.equals(TraceParameter.UDEC16)
+				|| type.equals(TraceParameter.OCT16)
+				|| type.equals(TraceParameter.HEX8)
+				|| type.equals(TraceParameter.HEX16)
+				|| type.equals(TraceParameter.SDEC64)
+				|| type.equals(TraceParameter.UDEC64)
+				|| type.equals(TraceParameter.OCT64)
+				|| type.equals(TraceParameter.HEX64)
+				|| type.equals(TraceParameter.ASCII)
+				|| type.equals(TraceParameter.UNICODE)
+				|| type.equals(TraceParameter.FLOAT_EXP)
+				|| type.equals(TraceParameter.FLOAT_FIX)
+				|| type.equals(TraceParameter.FLOAT_OPT)
+				|| type.equals(TraceParameter.POINTER);
+	}
+
+	/**
+	 * Checks if parameter size is dynamic
+	 * 
+	 * @param parameter
+	 *            the parameter to be checked
+	 * @return true if dynamic size
+	 */
+	public static boolean isParameterSizeDynamic(TraceParameter parameter) {
+		String type = parameter.getType();
+		ArrayParameterRule rule = parameter
+				.getExtension(ArrayParameterRule.class);
+		return rule != null || type.equals(TraceParameter.ASCII)
+				|| type.equals(TraceParameter.UNICODE);
+	}
+
+	/**
+	 * Checks if alignment is needed
+	 * 
+	 * @param type
+	 *            the parameter type
+	 * @return true if alignment is needed
+	 */
+	public static boolean isParameterAlignementNeeded(String type) {
+		int size = SourceUtils.mapParameterTypeToSize(type);
+		boolean retval = false;
+		if (size == 1 || size == 2) { // CodForChk_Dis_Magic
+			// 8 and 16-bit parameters need alignment
+			retval = true;
+		} else if (isStringType(type)) {
+			retval = true;
+		}
+		return retval;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/StringValuePair.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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-value pair for enum parser
+*
+*/
+package com.nokia.tracebuilder.source;
+
+/**
+ * String-value pair for enum parser
+ * 
+ */
+public final class StringValuePair {
+
+	/**
+	 * String
+	 */
+	public String string;
+
+	/**
+	 * Value
+	 */
+	public int value;
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/SymbianConstants.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,241 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Constants related to Symbian sources
+*
+*/
+package com.nokia.tracebuilder.source;
+
+import com.nokia.tracebuilder.model.TraceParameter;
+
+/**
+ * Constants related to Symbian sources
+ * 
+ */
+public interface SymbianConstants {
+
+	/**
+	 * Include directory
+	 */
+	final String INCLUDE_DIRECTORY = "inc"; //$NON-NLS-1$
+
+	/**
+	 * Source directory
+	 */
+	final String SOURCE_DIRECTORY = "src"; //$NON-NLS-1$
+
+	/**
+	 * Group directory
+	 */
+	final String GROUP_DIRECTORY = "group"; //$NON-NLS-1$
+
+	/**
+	 * Mmpfiles directory
+	 */
+	final String MMPFILES_DIRECTORY = "mmpfiles"; //$NON-NLS-1$
+	
+	/**
+	 * ETrue
+	 */
+	final String ETRUE = "ETrue"; //$NON-NLS-1$
+
+	/**
+	 * EFalse
+	 */
+	final String EFALSE = "EFalse"; //$NON-NLS-1$
+
+	/**
+	 * TBool
+	 */
+	final String TBOOL = "TBool"; //$NON-NLS-1$
+
+	/**
+	 * TInt
+	 */
+	final String TINT = "TInt"; //$NON-NLS-1$
+
+	/**
+	 * TUint
+	 */
+	final String TUINT = "TUint"; //$NON-NLS-1$
+
+	/**
+	 * TInt64
+	 */
+	final String TINT64 = "TInt64"; //$NON-NLS-1$
+
+	/**
+	 * TUint64
+	 */
+	final String TUINT64 = "TUint64"; //$NON-NLS-1$
+
+	/**
+	 * TTime
+	 */
+	final String TTIME = "TTime"; //$NON-NLS-1$
+
+	/**
+	 * TInt32
+	 */
+	final String TINT32 = "TInt32"; //$NON-NLS-1$
+
+	/**
+	 * TUint32
+	 */
+	final String TUINT32 = "TUint32"; //$NON-NLS-1$
+
+	/**
+	 * TInt16
+	 */
+	final String TINT16 = "TInt16"; //$NON-NLS-1$
+
+	/**
+	 * TUint16
+	 */
+	final String TUINT16 = "TUint16"; //$NON-NLS-1$
+
+	/**
+	 * TInt8
+	 */
+	final String TINT8 = "TInt8"; //$NON-NLS-1$
+
+	/**
+	 * TUint8
+	 */
+	final String TUINT8 = "TUint8"; //$NON-NLS-1$
+
+	/**
+	 * TAny
+	 */
+	final String TANY = "TAny"; //$NON-NLS-1$
+
+	/**
+	 * TAny*
+	 */
+	final String TANY_PTR = "TAny*"; //$NON-NLS-1$
+	
+	/**
+	 * const TAny*
+	 */
+	final String CONST_TANY_PTR = "const TAny*"; //$NON-NLS-1$
+
+	/**
+	 * TDes8
+	 */
+	final String TDES8 = "TDes8"; //$NON-NLS-1$
+
+	/**
+	 * TDesC8
+	 */
+	final String TDESC8 = "TDesC8"; //$NON-NLS-1$
+
+	/**
+	 * TDes16
+	 */
+	final String TDES16 = "TDes16"; //$NON-NLS-1$
+
+	/**
+	 * TDesC16
+	 */
+	final String TDESC16 = "TDesC16"; //$NON-NLS-1$
+
+	/**
+	 * TDes
+	 */
+	final String TDES = "TDes"; //$NON-NLS-1$
+
+	/**
+	 * TDesC
+	 */
+	final String TDESC = "TDesC"; //$NON-NLS-1$
+
+	/**
+	 * TPtr8
+	 */
+	final String TPTR8 = "TPtr8"; //$NON-NLS-1$
+
+	/**
+	 * TPtrC8
+	 */
+	final String TPTRC8 = "TPtrC8"; //$NON-NLS-1$
+
+	/**
+	 * TPtr16
+	 */
+	final String TPTR16 = "TPtr16"; //$NON-NLS-1$
+
+	/**
+	 * TPtrC16
+	 */
+	final String TPTRC16 = "TPtrC16"; //$NON-NLS-1$
+
+	/**
+	 * TPtr
+	 */
+	final String TPTR = "TPtr"; //$NON-NLS-1$
+
+	/**
+	 * TPtrC
+	 */
+	final String TPTRC = "TPtrC"; //$NON-NLS-1$
+
+	/**
+	 * TReal
+	 */
+	final String TREAL = "TReal"; //$NON-NLS-1$
+
+	/**
+	 * const TDesC8&
+	 */
+	final String CONST_TDESC8_REF = "const TDesC8&"; //$NON-NLS-1$
+
+	/**
+	 * const TDesC8&
+	 */
+	final String CONST_TDESC16_REF = "const TDesC16&"; //$NON-NLS-1$
+
+	/**
+	 * Prefix for all parameters generated into header files
+	 */
+	final String PARAMETER_DECLARATION_PREFIX = "aParam"; //$NON-NLS-1$
+
+	/**
+	 * __KERNEL_MODE__
+	 */
+	final String KERNEL_MODE = "__KERNEL_MODE__"; //$NON-NLS-1$
+
+	/**
+	 * Symbian parameter types mapped to TraceParameter types
+	 */
+	final String PARAMETER_TYPE_MAP[][] = { { TANY, null },
+			{ SourceConstants.VOID, null }, { TINT, TraceParameter.SDEC32 },
+			{ TINT32, TraceParameter.SDEC32 },
+			{ TBOOL, TraceParameter.SDEC32 },
+			{ SourceConstants.INT, TraceParameter.SDEC32 },
+			{ SourceConstants.LONG, TraceParameter.SDEC32 },
+			{ TUINT, TraceParameter.UDEC32 },
+			{ TUINT32, TraceParameter.UDEC32 },
+			{ TINT16, TraceParameter.SDEC16 },
+			{ SourceConstants.SHORT, TraceParameter.SDEC16 },
+			{ TUINT16, TraceParameter.UDEC16 },
+			{ TINT8, TraceParameter.SDEC8 },
+			{ SourceConstants.CHAR, TraceParameter.SDEC8 },
+			{ TUINT8, TraceParameter.UDEC8 },
+			{ TINT64, TraceParameter.SDEC64 },
+			{ TTIME, TraceParameter.TIME },
+			{ TUINT64, TraceParameter.UDEC64 },
+			{ TREAL, TraceParameter.FLOAT_FIX } };
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/TokenizerSearchData.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,87 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 search variables during SourceParameterTokenizer.tokenizeParameters call
+*
+*/
+package com.nokia.tracebuilder.source;
+
+/**
+ * Contains search variables during SourceParameterTokenizer.tokenizeParameters
+ * call
+ * 
+ */
+final class TokenizerSearchData {
+
+	/**
+	 * Iterator over source characters
+	 */
+	SourceIterator itr;
+
+	/**
+	 * Current character
+	 */
+	char value;
+
+	/**
+	 * Previous character
+	 */
+	char previousValue = ' ';
+
+	/**
+	 * Number of '(' encountered without matching ')' character
+	 */
+	int openBracketCount;
+
+	/**
+	 * Index for start of parameter
+	 */
+	int tagStartIndex;
+
+	/**
+	 * Index for start of parameter
+	 */
+	int paramStartIndex;
+
+	/**
+	 * Initial count of '(' characters at beginning of parameter
+	 */
+	int initialBracketCount;
+
+	/**
+	 * Closing ')' character has been found.
+	 */
+	boolean complete;
+
+	/**
+	 * Ending ';' or '{' character has been found
+	 */
+	boolean endFound;
+
+	/**
+	 * Within quotes flag
+	 */
+	boolean inQuotes;
+
+	/**
+	 * Parameter definition object
+	 */
+	SourceParameter sourceParameter;
+
+	/**
+	 * Data flag
+	 */
+	boolean hasData;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/TypeMapping.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Source to parameter type mapping
+*
+*/
+package com.nokia.tracebuilder.source;
+
+/**
+ * Type returned by
+ * {@link SourceUtils#mapSymbianTypeToParameterType(ParsedType)}
+ * 
+ */
+public final class TypeMapping {
+
+	/**
+	 * Parameter type
+	 */
+	public String type;
+
+	/**
+	 * Explicit casting needs to be used when calling trace function
+	 */
+	public boolean needsCasting;
+
+	/**
+	 * Value is changed to pointer before passing to trace function
+	 */
+	public boolean valueToPointer;
+
+	/**
+	 * Contructor
+	 * 
+	 * @param type
+	 *            the parameter type
+	 */
+	public TypeMapping(String type) {
+		this.type = type;
+	}
+
+	/**
+	 * Checks if type is void
+	 * 
+	 * @return true if type is void
+	 */
+	public boolean isVoid() {
+		return type == null;
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/TypedefParser.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,184 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Parser for type definitions
+*
+*/
+package com.nokia.tracebuilder.source;
+
+import java.util.List;
+
+/**
+ * Parser for type definitions
+ * 
+ */
+final class TypedefParser {
+
+	/**
+	 * Source parser
+	 */
+	private SourceParser parser;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parser
+	 *            the source parser
+	 */
+	TypedefParser(SourceParser parser) {
+		this.parser = parser;
+	}
+
+	/**
+	 * Parses an enum statement from the source
+	 * 
+	 * @param offset
+	 *            the offset to the start of the enum type
+	 * @param list
+	 *            the list for the name-value pairs are parsed from source
+	 * @throws SourceParserException
+	 *             if processing fails
+	 */
+	void parseEnum(int offset, List<StringValuePair> list)
+			throws SourceParserException {
+		EnumSearchData data = new EnumSearchData();
+		data.itr = parser.createIterator(offset, SourceParser.SKIP_ALL);
+		data.list = list;
+		while (data.itr.hasNext() && !data.finished) {
+			data.value = data.itr.next();
+			if (data.value == '{') {
+				processOpeningBracket(data);
+			} else if (data.value == '}') {
+				processClosingBracket(data);
+			} else if (data.value == ';') {
+				processEndOfEnum(data);
+			} else if (data.openBrackets > 0) {
+				processEnumChar(data);
+			}
+		}
+	}
+
+	/**
+	 * Processes the opening bracket of the enum
+	 * 
+	 * @param data
+	 *            the search data
+	 */
+	private void processOpeningBracket(EnumSearchData data) {
+		data.openBrackets++;
+	}
+
+	/**
+	 * Processes the closing bracket of the enum
+	 * 
+	 * @param data
+	 *            the search data
+	 * @throws SourceParserException
+	 *             if processing fails
+	 */
+	private void processClosingBracket(EnumSearchData data)
+			throws SourceParserException {
+		data.openBrackets--;
+		if (data.valueStartIndex != -1) {
+			endValue(data);
+		} else if (data.nameStartIndex != -1) {
+			endName(data);
+		}
+	}
+
+	/**
+	 * Processes the ending ';' of the enum
+	 * 
+	 * @param data
+	 *            the search data
+	 */
+	private void processEndOfEnum(EnumSearchData data) {
+		if (data.openBrackets == 0) {
+			data.isValid = true;
+		}
+		data.finished = true;
+	}
+
+	/**
+	 * Processes an character within the enum
+	 * 
+	 * @param data
+	 *            the search data
+	 * @throws SourceParserException
+	 *             if processing fails
+	 */
+	private void processEnumChar(EnumSearchData data)
+			throws SourceParserException {
+		if (data.nameStartIndex == -1) {
+			data.nameStartIndex = data.itr.currentIndex();
+		} else if (data.separatorIndex == -1) {
+			if (data.itr.hasSkipped() || data.value == ',' || data.value == '=') {
+				endName(data);
+			}
+		} else if (data.valueStartIndex == -1) {
+			data.valueStartIndex = data.itr.currentIndex();
+		} else {
+			if (data.value == ',') {
+				endValue(data);
+			}
+		}
+	}
+
+	/**
+	 * Ends the name of a enum entry
+	 * 
+	 * @param data
+	 *            the search data
+	 * @throws SourceParserException
+	 *             if processing fails
+	 */
+	private void endName(EnumSearchData data) throws SourceParserException {
+		data.currentEntry = new StringValuePair();
+		data.currentEntry.string = parser.getSource().get(data.nameStartIndex,
+				data.itr.previousIndex() - data.nameStartIndex + 1);
+		if (data.value == ',' || data.value == '}') {
+			data.nameStartIndex = -1;
+			data.currentEntry.value = ++data.previousValue;
+			data.list.add(data.currentEntry);
+			data.currentEntry = null;
+		} else if (data.value == '=') {
+			data.separatorIndex = data.itr.currentIndex();
+		} else {
+			// Invalid entry
+			data.finished = true;
+		}
+	}
+
+	/**
+	 * Ends the value of a enum entry
+	 * 
+	 * @param data
+	 *            the search data
+	 * @throws SourceParserException
+	 *             if processing fails
+	 */
+	private void endValue(EnumSearchData data) throws SourceParserException {
+		String val = parser.getSource().get(data.valueStartIndex,
+				data.itr.previousIndex() - data.valueStartIndex + 1);
+		data.currentEntry.value = SourceUtils.parseNumberFromSource(val);
+		data.nameStartIndex = -1;
+		data.valueStartIndex = -1;
+		data.separatorIndex = -1;
+		data.previousValue = data.currentEntry.value;
+		data.list.add(data.currentEntry);
+		data.currentEntry = null;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/source/package.html	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,3 @@
+<html><body>
+Contains parsers for source code
+</body></html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/utils/ConsoleBase.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 message console
+*
+*/
+package com.nokia.tracebuilder.utils;
+
+import java.io.OutputStream;
+
+/**
+ * Base class for message console
+ * 
+ */
+public abstract class ConsoleBase {
+
+	/**
+	 * Console title
+	 */
+	private String title;
+
+	/**
+	 * Constructor
+	 */
+	protected ConsoleBase() {
+	}
+
+	/**
+	 * Creates a stream that writes to the console
+	 * 
+	 * @return the stream
+	 */
+	protected abstract OutputStream createStream();
+
+	/**
+	 * Gets the console title
+	 * 
+	 * @return the title
+	 */
+	public String getTitle() {
+		return title;
+	}
+
+	/**
+	 * Sets the console title
+	 * 
+	 * @param title
+	 *            the title to set
+	 */
+	void setTitle(String title) {
+		this.title = title;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/utils/ConsoleFactory.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,69 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Factory class to create consoles
+*
+*/
+package com.nokia.tracebuilder.utils;
+
+import java.io.OutputStream;
+
+/**
+ * Factory class to create consoles
+ * 
+ */
+public abstract class ConsoleFactory {
+
+	/**
+	 * The console class
+	 */
+	private static Class<? extends ConsoleBase> consoleClass;
+
+	/**
+	 * Registers a console class to be used. If null, System.out will be used as
+	 * console output stream
+	 * 
+	 * @param consoleClass
+	 *            the consoleClass
+	 */
+	public static void registerConsole(Class<? extends ConsoleBase> consoleClass) {
+		ConsoleFactory.consoleClass = consoleClass;
+	}
+
+	/**
+	 * Creates a console with given title. If a console implementation cannot be
+	 * created this returns <code>System.out</code>
+	 * 
+	 * @param title
+	 *            the console title
+	 * @return the console output stream
+	 */
+	public static OutputStream createConsole(String title) {
+		OutputStream retval = null;
+		if (consoleClass != null) {
+			try {
+				ConsoleBase console = consoleClass.newInstance();
+				console.setTitle(title);
+				retval = console.createStream();
+			} catch (Exception e) {
+			}
+		}
+		if (retval == null) {
+			retval = System.out;
+		}
+		return retval;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/utils/DocumentAdapter.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,140 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Adapter for document interface
+*
+*/
+package com.nokia.tracebuilder.utils;
+
+import com.nokia.tracebuilder.source.SourceDocumentInterface;
+import com.nokia.tracebuilder.source.SourceLocationInterface;
+import com.nokia.tracebuilder.source.SourceParserException;
+import com.nokia.tracebuilder.source.SourcePropertyProvider;
+import com.nokia.tracebuilder.source.SourceSelector;
+
+/**
+ * Adapter for document interface
+ * 
+ */
+public class DocumentAdapter implements SourceDocumentInterface {
+
+	/**
+	 * Document owner
+	 */
+	private Object owner;
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceDocumentInterface#
+	 *      addLocation(com.nokia.tracebuilder.source.SourceLocationInterface)
+	 */
+	public void addLocation(SourceLocationInterface location) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceDocumentInterface#get(int, int)
+	 */
+	public String get(int start, int length) throws SourceParserException {
+		return ""; //$NON-NLS-1$
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceDocumentInterface#getChar(int)
+	 */
+	public char getChar(int offset) throws SourceParserException {
+		return '\0';
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceDocumentInterface#getLength()
+	 */
+	public int getLength() {
+		return 0;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceDocumentInterface#
+	 *      getLineOfOffset(int)
+	 */
+	public int getLineOfOffset(int offset) throws SourceParserException {
+		return -1;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceDocumentInterface#getOwner()
+	 */
+	public Object getOwner() {
+		return owner;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceDocumentInterface#
+	 *      removeLocation(com.nokia.tracebuilder.source.SourceLocationInterface)
+	 */
+	public void removeLocation(SourceLocationInterface location) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceDocumentInterface#replace(int,
+	 *      int, java.lang.String)
+	 */
+	public void replace(int offset, int length, String newText)
+			throws SourceParserException {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceDocumentInterface#
+	 *      setOwner(java.lang.Object)
+	 */
+	public void setOwner(Object owner) {
+		this.owner = owner;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceDocumentInterface#getPropertyProvider()
+	 */
+	public SourcePropertyProvider getPropertyProvider() {
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceDocumentInterface#getSourceSelector()
+	 */
+	public SourceSelector getSourceSelector() {
+		return null;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/utils/DocumentFactory.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Factory class to create document interfaces
+*
+*/
+package com.nokia.tracebuilder.utils;
+
+import com.nokia.tracebuilder.engine.TraceBuilderErrorCodes.TraceBuilderErrorCode;
+import com.nokia.tracebuilder.model.TraceBuilderException;
+import com.nokia.tracebuilder.source.SourceDocumentFactory;
+import com.nokia.tracebuilder.source.SourceDocumentMonitor;
+
+/**
+ * Factory class to create document interfaces
+ * 
+ */
+public final class DocumentFactory {
+
+	/**
+	 * Document monitor
+	 */
+	private static SourceDocumentMonitor monitor;
+
+	/**
+	 * Document factory class
+	 */
+	private static Class<? extends SourceDocumentFactory> factoryClass;
+
+	/**
+	 * Registers a document framework to be used by the engine
+	 * 
+	 * @param monitor
+	 *            the document monitor
+	 * @param factoryClass
+	 *            the document factory class
+	 */
+	public static void registerDocumentFramework(SourceDocumentMonitor monitor,
+			Class<? extends SourceDocumentFactory> factoryClass) {
+		DocumentFactory.monitor = monitor;
+		DocumentFactory.factoryClass = factoryClass;
+	}
+
+	/**
+	 * Gets the document monitor
+	 * 
+	 * @return the monitor
+	 */
+	public static final SourceDocumentMonitor getDocumentMonitor() {
+		return monitor;
+	}
+
+	/**
+	 * Creates a document factory, which is not associated to a document monitor
+	 * 
+	 * @return the factory
+	 * @throws TraceBuilderException
+	 *             if factory cannot be created
+	 */
+	public static final SourceDocumentFactory createDocumentFactory()
+			throws TraceBuilderException {
+		SourceDocumentFactory retval = null;
+		try {
+			retval = factoryClass.newInstance();
+		} catch (Exception e) {
+			throw new TraceBuilderException(
+					TraceBuilderErrorCode.UNEXPECTED_EXCEPTION, e);
+		}
+		return retval;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/utils/DocumentFactoryBase.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 document factories
+*
+*/
+package com.nokia.tracebuilder.utils;
+
+import com.nokia.tracebuilder.source.SourceDocumentFactory;
+import com.nokia.tracebuilder.source.SourceDocumentInterface;
+import com.nokia.tracebuilder.source.SourceLocationBase;
+import com.nokia.tracebuilder.source.SourceLocationInterface;
+
+/**
+ * Base class for document factories
+ * 
+ */
+public class DocumentFactoryBase implements SourceDocumentFactory {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceDocumentFactory#
+	 *      createDocument(java.lang.String)
+	 */
+	public SourceDocumentInterface createDocument(String sourceData) {
+		return new DocumentAdapter();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceDocumentFactory#
+	 *      createLocation(com.nokia.tracebuilder.source.SourceLocationBase,
+	 *      int, int)
+	 */
+	public SourceLocationInterface createLocation(SourceLocationBase base,
+			int offset, int length) {
+		return new SimpleLocation(offset, length);
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/utils/DocumentMonitorBase.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,168 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 document monitors
+*
+*/
+package com.nokia.tracebuilder.utils;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import com.nokia.tracebuilder.source.OffsetLength;
+import com.nokia.tracebuilder.source.SourceDocumentFactory;
+import com.nokia.tracebuilder.source.SourceDocumentInterface;
+import com.nokia.tracebuilder.source.SourceDocumentMonitor;
+import com.nokia.tracebuilder.source.SourceDocumentProcessor;
+
+/**
+ * Base class for document monitors.
+ * 
+ */
+public class DocumentMonitorBase implements SourceDocumentMonitor {
+
+	/**
+	 * Zero offset, zero length
+	 */
+	private static final OffsetLength ZERO_OFFSET_LENGTH = new OffsetLength();
+
+	/**
+	 * Document factory adapter
+	 */
+	private DocumentFactoryBase factory;
+
+	/**
+	 * Document processor
+	 */
+	private SourceDocumentProcessor processor;
+
+	/**
+	 * List of sources
+	 */
+	private ArrayList<SourceDocumentInterface> sources = new ArrayList<SourceDocumentInterface>();
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceDocumentMonitor#getFactory()
+	 */
+	public SourceDocumentFactory getFactory() {
+		if (factory == null) {
+			factory = new DocumentFactoryBase();
+		}
+		return factory;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceDocumentMonitor#getSelectedSource()
+	 */
+	public SourceDocumentInterface getSelectedSource() {
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceDocumentMonitor#
+	 *      getSelection(com.nokia.tracebuilder.source.SourceDocumentInterface)
+	 */
+	public OffsetLength getSelection(SourceDocumentInterface props) {
+		return ZERO_OFFSET_LENGTH;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Iterable#iterator()
+	 */
+	public Iterator<SourceDocumentInterface> iterator() {
+		return sources.iterator();
+	}
+
+	/**
+	 * Adds a source to this monitor and notifies the document processor
+	 * 
+	 * @param source
+	 *            the source to be added
+	 */
+	protected void addSource(SourceDocumentInterface source) {
+		sources.add(source);
+		processor.sourceOpened(source);
+	}
+
+	/**
+	 * Removes a source from this monitor and calls the document processor
+	 * 
+	 * @param source
+	 *            the source to be removed
+	 */
+	protected void removeSource(SourceDocumentInterface source) {
+		sources.remove(source);
+		processor.sourceClosed(source);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceDocumentMonitor#
+	 *      isSourceEditable(com.nokia.tracebuilder.source.SourceDocumentInterface)
+	 */
+	public boolean isSourceEditable(SourceDocumentInterface selectedSource) {
+		return false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceDocumentMonitor#setFocus()
+	 */
+	public void setFocus() {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceDocumentMonitor#
+	 *      startMonitor(com.nokia.tracebuilder.source.SourceDocumentProcessor)
+	 */
+	public void startMonitor(SourceDocumentProcessor processor) {
+		this.processor = processor;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceDocumentMonitor#stopMonitor()
+	 */
+	public void stopMonitor() {
+		for (SourceDocumentInterface document : sources) {
+			processor.sourceClosed(document);
+		}
+		sources.clear();
+		processor = null;
+	}
+
+	/**
+	 * Gets the source processor
+	 * 
+	 * @return the processor
+	 */
+	protected SourceDocumentProcessor getProcessor() {
+		return processor;
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/utils/SimpleLocation.java	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,111 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Adapter for location interface
+*
+*/
+package com.nokia.tracebuilder.utils;
+
+import com.nokia.tracebuilder.source.SourceLocationInterface;
+
+/**
+ * Location interface implementation
+ * 
+ */
+class SimpleLocation implements SourceLocationInterface {
+
+	/**
+	 * Location offset
+	 */
+	private int offset;
+
+	/**
+	 * Location length
+	 */
+	private int length;
+
+	/**
+	 * Deleted flag
+	 */
+	private boolean deleted;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param offset
+	 *            location offset
+	 * @param length
+	 *            location length
+	 */
+	SimpleLocation(int offset, int length) {
+		this.offset = offset;
+		this.length = length;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceLocationInterface#delete()
+	 */
+	public void delete() {
+		deleted = true;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceLocationInterface#getLength()
+	 */
+	public int getLength() {
+		return length;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceLocationInterface#getOffset()
+	 */
+	public int getOffset() {
+		return offset;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceLocationInterface#isDeleted()
+	 */
+	public boolean isDeleted() {
+		return deleted;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceLocationInterface#setLength(int)
+	 */
+	public void setLength(int length) {
+		this.length = length;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.source.SourceLocationInterface#setOffset(int)
+	 */
+	public void setOffset(int offset) {
+		this.offset = offset;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/utils/package.html	Wed Jun 23 14:35:40 2010 +0300
@@ -0,0 +1,3 @@
+<html><body>
+Exported utility classes
+</body></html>