trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/propertyfile/ComponentElementParser.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 * Parser for component element
       
    17 *
       
    18 */
       
    19 package com.nokia.tracebuilder.engine.propertyfile;
       
    20 
       
    21 import org.w3c.dom.Element;
       
    22 
       
    23 import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
       
    24 import com.nokia.tracebuilder.model.TraceBuilderException;
       
    25 import com.nokia.tracebuilder.model.TraceModel;
       
    26 
       
    27 /**
       
    28  * Parser for component element
       
    29  * 
       
    30  */
       
    31 final class ComponentElementParser implements PropertyFileElementParser {
       
    32 
       
    33 	/**
       
    34 	 * Property file parser
       
    35 	 */
       
    36 	private final PropertyFileParser propertyFileParser;
       
    37 
       
    38 	/**
       
    39 	 * Constructor
       
    40 	 * 
       
    41 	 * @param propertyFileParser
       
    42 	 *            the parser
       
    43 	 */
       
    44 	ComponentElementParser(PropertyFileParser propertyFileParser) {
       
    45 		this.propertyFileParser = propertyFileParser;
       
    46 	}
       
    47 
       
    48 	/*
       
    49 	 * (non-Javadoc)
       
    50 	 * 
       
    51 	 * @see com.nokia.tracebuilder.engine.propertyfile.PropertyFileElementParser#
       
    52 	 *      parse(java.lang.Object, org.w3c.dom.Element)
       
    53 	 */
       
    54 	public void parse(Object owner, Element element)
       
    55 			throws TraceBuilderException {
       
    56 		// Adds the properties directly to the model
       
    57 		TraceModel model = TraceBuilderGlobals.getTraceModel();
       
    58 		TraceObjectPropertyListImpl propertyList = model
       
    59 				.getExtension(TraceObjectPropertyListImpl.class);
       
    60 		if (propertyList == null) {
       
    61 			propertyList = new TraceObjectPropertyListImpl();
       
    62 			model.addExtension(propertyList);
       
    63 		}
       
    64 		propertyFileParser.parseChildren(propertyList, element);
       
    65 	}
       
    66 
       
    67 }