trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/TraceViewerPreferencesPage.java
changeset 11 5b9d4d8641ce
equal deleted inserted replaced
10:ed1c9f64298a 11:5b9d4d8641ce
       
     1 /*
       
     2  * Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). 
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description:
       
    15  *
       
    16  * TraceViewer preferences page
       
    17  *
       
    18  */
       
    19 package com.nokia.traceviewer.engine.preferences;
       
    20 
       
    21 import java.util.List;
       
    22 
       
    23 import org.eclipse.jface.preference.IPreferenceStore;
       
    24 import org.eclipse.jface.preference.PreferencePage;
       
    25 import org.eclipse.swt.SWT;
       
    26 import org.eclipse.swt.layout.GridData;
       
    27 import org.eclipse.swt.layout.GridLayout;
       
    28 import org.eclipse.swt.widgets.Button;
       
    29 import org.eclipse.swt.widgets.Composite;
       
    30 import org.eclipse.swt.widgets.Control;
       
    31 import org.eclipse.swt.widgets.Group;
       
    32 import org.eclipse.swt.widgets.Label;
       
    33 import org.eclipse.ui.IWorkbench;
       
    34 import org.eclipse.ui.IWorkbenchPreferencePage;
       
    35 import org.eclipse.ui.PlatformUI;
       
    36 
       
    37 import com.nokia.traceviewer.TraceViewerHelpContextIDs;
       
    38 import com.nokia.traceviewer.TraceViewerPlugin;
       
    39 import com.nokia.traceviewer.engine.TraceProvider;
       
    40 import com.nokia.traceviewer.engine.TraceViewerGlobals;
       
    41 
       
    42 /**
       
    43  * TraceViewer preferences page
       
    44  * 
       
    45  */
       
    46 public final class TraceViewerPreferencesPage extends PreferencePage implements
       
    47 		IWorkbenchPreferencePage {
       
    48 
       
    49 	/**
       
    50 	 * Preference page ID for opening page directly
       
    51 	 */
       
    52 	public static final String PAGE_ID = "com.nokia.traceviewer.preferences.TraceViewerPreferences"; //$NON-NLS-1$
       
    53 
       
    54 	/**
       
    55 	 * PreferenceStore holding all preferences
       
    56 	 */
       
    57 	private final IPreferenceStore store;
       
    58 
       
    59 	/**
       
    60 	 * Radio buttons to implify timestamp accuracy
       
    61 	 */
       
    62 	private Button[] timestampAccuracyButton = new Button[2];
       
    63 
       
    64 	/**
       
    65 	 * Radio buttons to implify how to show undecoded traces
       
    66 	 */
       
    67 	private Button[] showUndecodedTracesAsButton = new Button[3];
       
    68 
       
    69 	/**
       
    70 	 * Time from previous trace checkbox
       
    71 	 */
       
    72 	private Button timeFromPreviousTraceCheckBox;
       
    73 
       
    74 	/**
       
    75 	 * Show trace component and group name in trace checkbox
       
    76 	 */
       
    77 	private Button showComponentGroupNameCheckBox;
       
    78 
       
    79 	/**
       
    80 	 * Show trace class and function name in trace checkbox
       
    81 	 */
       
    82 	private Button showClassFunctionNameCheckBox;
       
    83 
       
    84 	/**
       
    85 	 * Automatically reload changed Dictionaries checkbox
       
    86 	 */
       
    87 	private Button autoReloadDictionariesCheckBox;
       
    88 
       
    89 	/**
       
    90 	 * Show BTrace variables checkbox
       
    91 	 */
       
    92 	private Button showBTraceVariablesCheckBox;
       
    93 
       
    94 	/**
       
    95 	 * Radio buttons to implify data format
       
    96 	 */
       
    97 	private Button[] dataFormatButton;
       
    98 
       
    99 	/**
       
   100 	 * Constructor
       
   101 	 */
       
   102 	public TraceViewerPreferencesPage() {
       
   103 		super();
       
   104 		// Set the preference store for the preference page.
       
   105 		store = TraceViewerPlugin.getDefault().getPreferenceStore();
       
   106 		setPreferenceStore(store);
       
   107 	}
       
   108 
       
   109 	/*
       
   110 	 * (non-Javadoc)
       
   111 	 * 
       
   112 	 * @see
       
   113 	 * org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
       
   114 	 */
       
   115 	public void init(IWorkbench workbench) {
       
   116 	}
       
   117 
       
   118 	/*
       
   119 	 * (non-Javadoc)
       
   120 	 * 
       
   121 	 * @see
       
   122 	 * org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse
       
   123 	 * .swt.widgets.Composite)
       
   124 	 */
       
   125 	@Override
       
   126 	protected Control createContents(Composite parent) {
       
   127 
       
   128 		// Set help
       
   129 		PlatformUI.getWorkbench().getHelpSystem().setHelp(parent,
       
   130 				TraceViewerHelpContextIDs.GENERAL_PREFERENCES);
       
   131 
       
   132 		// Create Top composite in top of the parent composite
       
   133 		Composite top = new Composite(parent, SWT.LEFT);
       
   134 		GridData topCompositeGridData = new GridData(SWT.FILL, SWT.FILL, true,
       
   135 				false);
       
   136 		top.setLayoutData(topCompositeGridData);
       
   137 		GridLayout topCompositeGridLayout = new GridLayout();
       
   138 		topCompositeGridLayout.horizontalSpacing = 5;
       
   139 		topCompositeGridLayout.verticalSpacing = 5;
       
   140 		topCompositeGridLayout.marginWidth = 0;
       
   141 		topCompositeGridLayout.marginHeight = 0;
       
   142 		top.setLayout(topCompositeGridLayout);
       
   143 
       
   144 		Label generalTextLabel = new Label(top, SWT.NONE);
       
   145 		String generalTextLabelText = Messages
       
   146 				.getString("TraceViewerPreferencesPage.GeneralSettingsText"); //$NON-NLS-1$
       
   147 		generalTextLabel.setText(generalTextLabelText);
       
   148 
       
   149 		// General group
       
   150 		Group generalGroup = new Group(top, SWT.NONE);
       
   151 		String generalGroupText = Messages
       
   152 				.getString("TraceViewerPreferencesPage.GeneralGroupText"); //$NON-NLS-1$
       
   153 		generalGroup.setText(generalGroupText);
       
   154 		GridData generalGroupGridData = new GridData(SWT.FILL, SWT.FILL, true,
       
   155 				false);
       
   156 		generalGroup.setLayoutData(generalGroupGridData);
       
   157 		generalGroup.setLayout(new GridLayout());
       
   158 
       
   159 		// Show milliseconds from previous trace checkbox
       
   160 		timeFromPreviousTraceCheckBox = new Button(generalGroup, SWT.CHECK);
       
   161 		timeFromPreviousTraceCheckBox.setText(Messages
       
   162 				.getString("TraceViewerPreferencesPage.ShowPreviousTimeText")); //$NON-NLS-1$
       
   163 		timeFromPreviousTraceCheckBox
       
   164 				.setToolTipText(Messages
       
   165 						.getString("TraceViewerPreferencesPage.TimeFromPreviousToolTip")); //$NON-NLS-1$
       
   166 		timeFromPreviousTraceCheckBox
       
   167 				.setSelection(store
       
   168 						.getBoolean(PreferenceConstants.TIME_FROM_PREVIOUS_TRACE_CHECKBOX));
       
   169 
       
   170 		// Show trace component and group before trace text checkbox
       
   171 		showComponentGroupNameCheckBox = new Button(generalGroup, SWT.CHECK);
       
   172 		showComponentGroupNameCheckBox
       
   173 				.setText(Messages
       
   174 						.getString("TraceViewerPreferencesPage.ShowComponentGroupName")); //$NON-NLS-1$
       
   175 		String showComponentGroupToolTip = Messages
       
   176 				.getString("TraceViewerPreferencesPage.ShowComponentAndGroupToolTip"); //$NON-NLS-1$
       
   177 		showComponentGroupNameCheckBox
       
   178 				.setToolTipText(showComponentGroupToolTip);
       
   179 		showComponentGroupNameCheckBox
       
   180 				.setSelection(store
       
   181 						.getBoolean(PreferenceConstants.SHOW_COMPONENT_GROUP_NAME_CHECKBOX));
       
   182 
       
   183 		// Show trace class and function before trace text checkbox
       
   184 		showClassFunctionNameCheckBox = new Button(generalGroup, SWT.CHECK);
       
   185 		showClassFunctionNameCheckBox.setText(Messages
       
   186 				.getString("TraceViewerPreferencesPage.ShowClassFunctionName")); //$NON-NLS-1$
       
   187 		String showClassFunctionToolTip = Messages
       
   188 				.getString("TraceViewerPreferencesPage.ShowClassAndFunctionToolTip"); //$NON-NLS-1$
       
   189 		showClassFunctionNameCheckBox.setToolTipText(showClassFunctionToolTip);
       
   190 		showClassFunctionNameCheckBox
       
   191 				.setSelection(store
       
   192 						.getBoolean(PreferenceConstants.SHOW_CLASS_FUNCTION_NAME_CHECKBOX));
       
   193 
       
   194 		// Automatically reload changed Dictionaries checkbox
       
   195 		autoReloadDictionariesCheckBox = new Button(generalGroup, SWT.CHECK);
       
   196 		String autoReloadText = Messages
       
   197 				.getString("TraceViewerPreferencesPage.AutoReloadDictionariesText"); //$NON-NLS-1$
       
   198 		String autoReloadToolTip = Messages
       
   199 				.getString("TraceViewerPreferencesPage.AutoReloadDictionariesToolTip"); //$NON-NLS-1$
       
   200 		autoReloadDictionariesCheckBox.setText(autoReloadText);
       
   201 		autoReloadDictionariesCheckBox.setToolTipText(autoReloadToolTip);
       
   202 		autoReloadDictionariesCheckBox
       
   203 				.setSelection(store
       
   204 						.getBoolean(PreferenceConstants.AUTO_RELOAD_DICTIONARIES_CHECKBOX));
       
   205 
       
   206 		// Show BTrace variables in OST traces checkbox
       
   207 		showBTraceVariablesCheckBox = new Button(generalGroup, SWT.CHECK);
       
   208 		String btraceVariablesText = Messages
       
   209 				.getString("TraceViewerPreferencesPage.ShowBTraceVariablesText"); //$NON-NLS-1$
       
   210 		String btraceVariablesToolTip = Messages
       
   211 				.getString("TraceViewerPreferencesPage.ShowBTraceVariablesToolTip"); //$NON-NLS-1$
       
   212 		showBTraceVariablesCheckBox.setText(btraceVariablesText);
       
   213 		showBTraceVariablesCheckBox.setToolTipText(btraceVariablesToolTip);
       
   214 		showBTraceVariablesCheckBox
       
   215 				.setSelection(store
       
   216 						.getBoolean(PreferenceConstants.SHOW_BTRACE_VARIABLES_CHECKBOX));
       
   217 
       
   218 		// Timestamp accuracy group
       
   219 		Group timestampAccuracyGroup = new Group(top, SWT.NONE);
       
   220 		String timestampAccuracyGroupText = Messages
       
   221 				.getString("TraceViewerPreferencesPage.TimestampAccuracyText"); //$NON-NLS-1$
       
   222 		timestampAccuracyGroup.setText(timestampAccuracyGroupText);
       
   223 		GridData timestampAccuracyGroupGridData = new GridData(SWT.FILL,
       
   224 				SWT.FILL, true, false);
       
   225 		timestampAccuracyGroup.setLayoutData(timestampAccuracyGroupGridData);
       
   226 		timestampAccuracyGroup.setLayout(new GridLayout());
       
   227 
       
   228 		// Timestamp accuracy milliseconds
       
   229 		timestampAccuracyButton[0] = new Button(timestampAccuracyGroup,
       
   230 				SWT.RADIO);
       
   231 		String milliSecondsText = Messages
       
   232 				.getString("TraceViewerPreferencesPage.MilliSecondsText"); //$NON-NLS-1$
       
   233 		timestampAccuracyButton[0].setText(milliSecondsText);
       
   234 
       
   235 		// Timestamp accuracy microseconds
       
   236 		timestampAccuracyButton[1] = new Button(timestampAccuracyGroup,
       
   237 				SWT.RADIO);
       
   238 		String microSecondsText = Messages
       
   239 				.getString("TraceViewerPreferencesPage.MicroSecondsText"); //$NON-NLS-1$
       
   240 		timestampAccuracyButton[1].setText(microSecondsText);
       
   241 
       
   242 		// Get the current accuracy from PreferenceStore
       
   243 		String accuracy = store
       
   244 				.getString(PreferenceConstants.TIMESTAMP_ACCURACY);
       
   245 		if (accuracy.equals(PreferenceConstants.MILLISECOND_ACCURACY)) {
       
   246 			timestampAccuracyButton[0].setSelection(true);
       
   247 			timestampAccuracyButton[1].setSelection(false);
       
   248 		} else {
       
   249 			timestampAccuracyButton[0].setSelection(false);
       
   250 			timestampAccuracyButton[1].setSelection(true);
       
   251 		}
       
   252 
       
   253 		// Show undecoded traces as group
       
   254 		Group showUndecodedTracesGroup = new Group(top, SWT.NONE);
       
   255 		String showUndecodedTracesAs = Messages
       
   256 				.getString("TraceViewerPreferencesPage.ShowUndecodedTracesAsText"); //$NON-NLS-1$
       
   257 		showUndecodedTracesGroup.setText(showUndecodedTracesAs);
       
   258 		GridData showUndecodedTracesAsGroupGridData = new GridData(SWT.FILL,
       
   259 				SWT.FILL, true, false);
       
   260 		showUndecodedTracesGroup
       
   261 				.setLayoutData(showUndecodedTracesAsGroupGridData);
       
   262 		showUndecodedTracesGroup.setLayout(new GridLayout());
       
   263 
       
   264 		// Show undecoded traces as "BINARY TRACE"
       
   265 		showUndecodedTracesAsButton[0] = new Button(showUndecodedTracesGroup,
       
   266 				SWT.RADIO);
       
   267 		String asInfoText = Messages
       
   268 				.getString("TraceViewerPreferencesPage.ShowUndecodedTracesAsInfoText"); //$NON-NLS-1$
       
   269 		showUndecodedTracesAsButton[0].setText(asInfoText);
       
   270 
       
   271 		// Show undecoded traces as "HEX"
       
   272 		showUndecodedTracesAsButton[1] = new Button(showUndecodedTracesGroup,
       
   273 				SWT.RADIO);
       
   274 		String asHexText = Messages
       
   275 				.getString("TraceViewerPreferencesPage.ShowUndecodedTracesAsHexText"); //$NON-NLS-1$
       
   276 		showUndecodedTracesAsButton[1].setText(asHexText);
       
   277 
       
   278 		// Show undecoded traces as "ID numbers"
       
   279 		showUndecodedTracesAsButton[2] = new Button(showUndecodedTracesGroup,
       
   280 				SWT.RADIO);
       
   281 		String asTraceIDsText = Messages
       
   282 				.getString("TraceViewerPreferencesPage.ShowUndecodedTracesAsIDsText"); //$NON-NLS-1$
       
   283 		showUndecodedTracesAsButton[2].setText(asTraceIDsText);
       
   284 
       
   285 		// Get the current "show undecoded traces" value from PreferenceStore
       
   286 		String showUndecoded = store
       
   287 				.getString(PreferenceConstants.SHOW_UNDECODED_TRACES_TYPE);
       
   288 		if (showUndecoded.equals(PreferenceConstants.UNDECODED_INFO_TEXT)) {
       
   289 			showUndecodedTracesAsButton[0].setSelection(true);
       
   290 			showUndecodedTracesAsButton[1].setSelection(false);
       
   291 			showUndecodedTracesAsButton[2].setSelection(false);
       
   292 		} else if (showUndecoded.equals(PreferenceConstants.UNDECODED_HEX)) {
       
   293 			showUndecodedTracesAsButton[0].setSelection(false);
       
   294 			showUndecodedTracesAsButton[1].setSelection(true);
       
   295 			showUndecodedTracesAsButton[2].setSelection(false);
       
   296 		} else {
       
   297 			showUndecodedTracesAsButton[0].setSelection(false);
       
   298 			showUndecodedTracesAsButton[1].setSelection(false);
       
   299 			showUndecodedTracesAsButton[2].setSelection(true);
       
   300 		}
       
   301 
       
   302 		// Data format editor. Show only if there are more than one
       
   303 		// TraceProviders registered
       
   304 		List<TraceProvider> dataFormats = TraceViewerGlobals
       
   305 				.getListOfTraceProviders();
       
   306 		if (dataFormats.size() > 1) {
       
   307 
       
   308 			// Data format group
       
   309 			String dataFormatText = Messages
       
   310 					.getString("TraceViewerPreferencesPage.DataFormatText"); //$NON-NLS-1$
       
   311 			Group dataFormatGroup = new Group(top, SWT.NONE);
       
   312 			dataFormatGroup.setText(dataFormatText);
       
   313 			GridData dataFormatGroupGridData = new GridData(SWT.FILL, SWT.FILL,
       
   314 					true, false);
       
   315 			dataFormatGroup.setLayoutData(dataFormatGroupGridData);
       
   316 			dataFormatGroup.setLayout(new GridLayout());
       
   317 
       
   318 			dataFormatButton = new Button[dataFormats.size()];
       
   319 			String dataFormat = store
       
   320 					.getString(PreferenceConstants.DATA_FORMAT);
       
   321 
       
   322 			// Go through data formats
       
   323 			for (int i = 0; i < dataFormats.size(); i++) {
       
   324 				dataFormatButton[i] = new Button(dataFormatGroup, SWT.RADIO);
       
   325 				String dataFormatName = dataFormats.get(i).getName();
       
   326 				dataFormatButton[i].setText(dataFormatName);
       
   327 				if (dataFormat.equals(dataFormatName)) {
       
   328 					dataFormatButton[i].setSelection(true);
       
   329 				} else {
       
   330 					dataFormatButton[i].setSelection(false);
       
   331 				}
       
   332 			}
       
   333 		}
       
   334 
       
   335 		return top;
       
   336 
       
   337 	}
       
   338 
       
   339 	/*
       
   340 	 * (non-Javadoc)
       
   341 	 * 
       
   342 	 * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
       
   343 	 */
       
   344 	@Override
       
   345 	protected void performDefaults() {
       
   346 		if (getControl() != null && !getControl().isDisposed()) {
       
   347 
       
   348 			// Timestamp accuracy
       
   349 			timestampAccuracyButton[0].setSelection(true);
       
   350 			timestampAccuracyButton[1].setSelection(false);
       
   351 
       
   352 			timeFromPreviousTraceCheckBox.setSelection(true);
       
   353 
       
   354 			// Show undecoded traces as
       
   355 			showUndecodedTracesAsButton[0].setSelection(false);
       
   356 			showUndecodedTracesAsButton[1].setSelection(false);
       
   357 			showUndecodedTracesAsButton[2].setSelection(true);
       
   358 
       
   359 			showClassFunctionNameCheckBox.setSelection(true);
       
   360 			autoReloadDictionariesCheckBox.setSelection(true);
       
   361 			showBTraceVariablesCheckBox.setSelection(true);
       
   362 			super.performDefaults();
       
   363 		}
       
   364 	}
       
   365 
       
   366 	/*
       
   367 	 * (non-Javadoc)
       
   368 	 * 
       
   369 	 * @see org.eclipse.jface.preference.PreferencePage#performOk()
       
   370 	 */
       
   371 	@Override
       
   372 	public boolean performOk() {
       
   373 		saveSettings();
       
   374 		return super.performOk();
       
   375 	}
       
   376 
       
   377 	/*
       
   378 	 * (non-Javadoc)
       
   379 	 * 
       
   380 	 * @see org.eclipse.jface.preference.PreferencePage#performApply()
       
   381 	 */
       
   382 	@Override
       
   383 	public void performApply() {
       
   384 		saveSettings();
       
   385 		super.performApply();
       
   386 	}
       
   387 
       
   388 	/**
       
   389 	 * Saves settings
       
   390 	 */
       
   391 	private void saveSettings() {
       
   392 		if (getControl() != null && !getControl().isDisposed()) {
       
   393 
       
   394 			// Save old values before saving
       
   395 			boolean updateNeeded = false;
       
   396 			String oldTimestampAccuracy = store
       
   397 					.getString(PreferenceConstants.TIMESTAMP_ACCURACY);
       
   398 			boolean oldTimeFromPrevious = store
       
   399 					.getBoolean(PreferenceConstants.TIME_FROM_PREVIOUS_TRACE_CHECKBOX);
       
   400 			String oldShowBinaryAsType = store
       
   401 					.getString(PreferenceConstants.SHOW_UNDECODED_TRACES_TYPE);
       
   402 			boolean showComponentGroupNamePrevious = store
       
   403 					.getBoolean(PreferenceConstants.SHOW_COMPONENT_GROUP_NAME_CHECKBOX);
       
   404 			boolean showClassNamePrevious = store
       
   405 					.getBoolean(PreferenceConstants.SHOW_CLASS_FUNCTION_NAME_CHECKBOX);
       
   406 			boolean showThreadId = store
       
   407 					.getBoolean(PreferenceConstants.SHOW_BTRACE_VARIABLES_CHECKBOX);
       
   408 
       
   409 			// Store new values. Timestamp accuracy.
       
   410 			if (timestampAccuracyButton[0].getSelection()) {
       
   411 				store.setValue(PreferenceConstants.TIMESTAMP_ACCURACY,
       
   412 						PreferenceConstants.MILLISECOND_ACCURACY);
       
   413 			} else {
       
   414 				store.setValue(PreferenceConstants.TIMESTAMP_ACCURACY,
       
   415 						PreferenceConstants.MICROSECOND_ACCURACY);
       
   416 			}
       
   417 
       
   418 			// Show time from previous trace
       
   419 			store.setValue(
       
   420 					PreferenceConstants.TIME_FROM_PREVIOUS_TRACE_CHECKBOX,
       
   421 					timeFromPreviousTraceCheckBox.getSelection());
       
   422 
       
   423 			// Store "show undecoded traces" value
       
   424 			if (showUndecodedTracesAsButton[0].getSelection()) {
       
   425 				store.setValue(PreferenceConstants.SHOW_UNDECODED_TRACES_TYPE,
       
   426 						PreferenceConstants.UNDECODED_INFO_TEXT);
       
   427 			} else if (showUndecodedTracesAsButton[1].getSelection()) {
       
   428 				store.setValue(PreferenceConstants.SHOW_UNDECODED_TRACES_TYPE,
       
   429 						PreferenceConstants.UNDECODED_HEX);
       
   430 			} else {
       
   431 				store.setValue(PreferenceConstants.SHOW_UNDECODED_TRACES_TYPE,
       
   432 						PreferenceConstants.UNDECODED_ID_AND_DATA);
       
   433 			}
       
   434 
       
   435 			// Show component and group name
       
   436 			store.setValue(
       
   437 					PreferenceConstants.SHOW_COMPONENT_GROUP_NAME_CHECKBOX,
       
   438 					showComponentGroupNameCheckBox.getSelection());
       
   439 
       
   440 			// Show class and function name
       
   441 			store.setValue(
       
   442 					PreferenceConstants.SHOW_CLASS_FUNCTION_NAME_CHECKBOX,
       
   443 					showClassFunctionNameCheckBox.getSelection());
       
   444 
       
   445 			// Auto reload changed Dictionaries
       
   446 			store.setValue(
       
   447 					PreferenceConstants.AUTO_RELOAD_DICTIONARIES_CHECKBOX,
       
   448 					autoReloadDictionariesCheckBox.getSelection());
       
   449 
       
   450 			// Show Thread ID
       
   451 			store.setValue(PreferenceConstants.SHOW_BTRACE_VARIABLES_CHECKBOX,
       
   452 					showBTraceVariablesCheckBox.getSelection());
       
   453 
       
   454 			// Data format
       
   455 			if (dataFormatButton != null) {
       
   456 				for (int i = 0; i < dataFormatButton.length; i++) {
       
   457 					if (dataFormatButton[i].getSelection()) {
       
   458 						store.setValue(PreferenceConstants.DATA_FORMAT,
       
   459 								dataFormatButton[i].getText());
       
   460 					}
       
   461 				}
       
   462 			}
       
   463 
       
   464 			// Check if new values are different from old values and set
       
   465 			// updateNeeded boolean to true if needed
       
   466 			if (!store.getString(PreferenceConstants.TIMESTAMP_ACCURACY)
       
   467 					.equals(oldTimestampAccuracy)) {
       
   468 				updateNeeded = true;
       
   469 			} else if (store
       
   470 					.getBoolean(PreferenceConstants.TIME_FROM_PREVIOUS_TRACE_CHECKBOX) != oldTimeFromPrevious) {
       
   471 				updateNeeded = true;
       
   472 			} else if (!store.getString(
       
   473 					PreferenceConstants.SHOW_UNDECODED_TRACES_TYPE).equals(
       
   474 					oldShowBinaryAsType)) {
       
   475 				updateNeeded = true;
       
   476 			} else if (store
       
   477 					.getBoolean(PreferenceConstants.SHOW_COMPONENT_GROUP_NAME_CHECKBOX) != showComponentGroupNamePrevious) {
       
   478 				updateNeeded = true;
       
   479 			} else if (store
       
   480 					.getBoolean(PreferenceConstants.SHOW_CLASS_FUNCTION_NAME_CHECKBOX) != showClassNamePrevious) {
       
   481 				updateNeeded = true;
       
   482 			} else if (store
       
   483 					.getBoolean(PreferenceConstants.SHOW_BTRACE_VARIABLES_CHECKBOX) != showThreadId) {
       
   484 				updateNeeded = true;
       
   485 			}
       
   486 
       
   487 			// Update properties
       
   488 			updateProperties(updateNeeded);
       
   489 		}
       
   490 	}
       
   491 
       
   492 	/**
       
   493 	 * Updates properties to TraceViewer engine
       
   494 	 * 
       
   495 	 * @param updateNeeded
       
   496 	 *            if true, update to engine is needed
       
   497 	 */
       
   498 	private void updateProperties(boolean updateNeeded) {
       
   499 		// Change the values and refresh the TraceViewer view if update is
       
   500 		// needed
       
   501 		if (updateNeeded) {
       
   502 			// Set timestamp accuracy to timestampParser
       
   503 			boolean millisec = false;
       
   504 			if (store.getString(PreferenceConstants.TIMESTAMP_ACCURACY).equals(
       
   505 					PreferenceConstants.MILLISECOND_ACCURACY)) {
       
   506 				millisec = true;
       
   507 			}
       
   508 			TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
       
   509 					.getTimestampParser().setTimestampAccuracyMilliSecs(
       
   510 							millisec);
       
   511 
       
   512 			// Set showing time from previous trace to timestampParser
       
   513 			TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
       
   514 					.getTimestampParser().setShowTimeFromPrevious(
       
   515 							timeFromPreviousTraceCheckBox.getSelection());
       
   516 
       
   517 			// Set show class and function name before trace text
       
   518 			if (TraceViewerGlobals.getDecodeProvider() != null) {
       
   519 				TraceViewerGlobals.getDecodeProvider().setAddPrefixesToTrace(
       
   520 						showClassFunctionNameCheckBox.getSelection(),
       
   521 						showComponentGroupNameCheckBox.getSelection());
       
   522 			}
       
   523 
       
   524 			// Set show BTrace variables to Decoder
       
   525 			TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
       
   526 					.getDecoder().setShowBTraceVariables(
       
   527 							showBTraceVariablesCheckBox.getSelection());
       
   528 
       
   529 			// Update the TraceViewer view
       
   530 			TraceViewerGlobals.getTraceViewer().getView().refreshCurrentView();
       
   531 
       
   532 		}
       
   533 
       
   534 		// Set new TraceProvider. Find it from the list of TraceProviders using
       
   535 		// the selected name. TraceViewer handles the change. If provider is
       
   536 		// the same as previously, nothing is done.
       
   537 		List<TraceProvider> dataFormats = TraceViewerGlobals
       
   538 				.getListOfTraceProviders();
       
   539 		if (dataFormatButton != null) {
       
   540 			for (int i = 0; i < dataFormats.size(); i++) {
       
   541 
       
   542 				// Compare the name of the Provider to the name saved to the
       
   543 				// preference store
       
   544 				if (dataFormats.get(i).getName().equals(
       
   545 						store.getString(PreferenceConstants.DATA_FORMAT))) {
       
   546 
       
   547 					// Set new TraceProvider to the TraceViewer
       
   548 					TraceViewerGlobals.setTraceProvider(dataFormats.get(i),
       
   549 							false);
       
   550 					break;
       
   551 				}
       
   552 			}
       
   553 		}
       
   554 	}
       
   555 }