trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertydialog/DeleteTraceFromSourceCallback.java
changeset 10 ed1c9f64298a
equal deleted inserted replaced
9:14dc2103a631 10:ed1c9f64298a
       
     1 /*
       
     2 * Copyright (c) 2007 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 * Base class for deleter classes that remove traces from source file
       
    17 *
       
    18 */
       
    19 package com.nokia.tracebuilder.engine.propertydialog;
       
    20 
       
    21 import com.nokia.tracebuilder.engine.LocationProperties;
       
    22 import com.nokia.tracebuilder.engine.TraceLocation;
       
    23 import com.nokia.tracebuilder.engine.TraceLocationList;
       
    24 import com.nokia.tracebuilder.engine.source.SourceEngine;
       
    25 import com.nokia.tracebuilder.model.Trace;
       
    26 import com.nokia.tracebuilder.model.TraceObject;
       
    27 
       
    28 /**
       
    29  * Base class for deleter classes that remove traces from source file
       
    30  * 
       
    31  */
       
    32 abstract class DeleteTraceFromSourceCallback extends DeleteObjectCallback {
       
    33 
       
    34 	/**
       
    35 	 * The source engine for trace removal
       
    36 	 */
       
    37 	private SourceEngine sourceEngine;
       
    38 
       
    39 	/**
       
    40 	 * Constructor
       
    41 	 * 
       
    42 	 * @param object
       
    43 	 *            the object to be removed
       
    44 	 * @param sourceEngine
       
    45 	 *            the source engine for trace removal
       
    46 	 */
       
    47 	DeleteTraceFromSourceCallback(TraceObject object, SourceEngine sourceEngine) {
       
    48 		super(object);
       
    49 		this.sourceEngine = sourceEngine;
       
    50 	}
       
    51 
       
    52 	/**
       
    53 	 * Removes a trace from source files
       
    54 	 * 
       
    55 	 * @param trace
       
    56 	 *            the trace to be removed
       
    57 	 */
       
    58 	protected void removeTraceFromSource(Trace trace) {
       
    59 		TraceLocationList list = trace.getExtension(TraceLocationList.class);
       
    60 		if (list != null) {
       
    61 			for (LocationProperties loc : list) {
       
    62 				sourceEngine.removeLocation((TraceLocation) loc);
       
    63 			}
       
    64 		}
       
    65 	}
       
    66 
       
    67 }