sysperfana/analyzetoolext/com.nokia.s60tools.analyzetool/src/com/nokia/s60tools/analyzetool/engine/MMPInfo.java
changeset 1 1050670c6980
child 6 f65f740e69f9
equal deleted inserted replaced
0:5ad7ad99af01 1:1050670c6980
       
     1 /*
       
     2  * Copyright (c) 2008-2009 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:  Definitions for the class MMPInfo
       
    15  *
       
    16  */
       
    17 
       
    18 package com.nokia.s60tools.analyzetool.engine;
       
    19 
       
    20 import org.eclipse.core.resources.IFile;
       
    21 import org.eclipse.core.resources.ResourcesPlugin;
       
    22 import org.eclipse.core.runtime.Path;
       
    23 
       
    24 import com.nokia.s60tools.analyzetool.global.Util;
       
    25 
       
    26 /**
       
    27  * Contains one mmp(module) file info.
       
    28  *
       
    29  * @author kihe
       
    30  *
       
    31  */
       
    32 public class MMPInfo {
       
    33 
       
    34 	/** String mmp file name. */
       
    35 	private final String mmpName;
       
    36 
       
    37 	/** mmp file path. */
       
    38 	private String mmpFilePath = "";
       
    39 
       
    40 	/** mmp file target. */
       
    41 	private String mmpTarget = "";
       
    42 
       
    43 	/** Is this mmp(module) build successfully. */
       
    44 	private boolean buildSuccesfully = false;
       
    45 
       
    46 	/**
       
    47 	 * Constructor.
       
    48 	 *
       
    49 	 * @param name
       
    50 	 *            MMP file name
       
    51 	 */
       
    52 	public MMPInfo(final String name) {
       
    53 		mmpName = name;
       
    54 	}
       
    55 
       
    56 	/**
       
    57 	 * Gets mmp file location.
       
    58 	 *
       
    59 	 * @return MMP file location if it is set otherwise ""
       
    60 	 */
       
    61 	public final String getLocation() {
       
    62 		return mmpFilePath;
       
    63 	}
       
    64 
       
    65 	/**
       
    66 	 * Returns mmp file name.
       
    67 	 *
       
    68 	 * @return MMP file name
       
    69 	 */
       
    70 	public final String getName() {
       
    71 		return mmpName;
       
    72 	}
       
    73 
       
    74 	/**
       
    75 	 * Returns mmp file target.
       
    76 	 *
       
    77 	 * @return MMP file target
       
    78 	 */
       
    79 	public final String getTarget() {
       
    80 		return mmpTarget;
       
    81 	}
       
    82 
       
    83 	/**
       
    84 	 * Returns info is mmp file built successfully.
       
    85 	 *
       
    86 	 * @return True if module is build successfully otherwise False
       
    87 	 */
       
    88 	public final boolean isBuildSuccesfully() {
       
    89 		return buildSuccesfully;
       
    90 	}
       
    91 
       
    92 	/**
       
    93 	 * Sets info is mmp file build with AnalyzeTool.
       
    94 	 *
       
    95 	 * @param build
       
    96 	 *            Build info
       
    97 	 */
       
    98 	public final void setBuildInfo(final boolean build) {
       
    99 		buildSuccesfully = build;
       
   100 	}
       
   101 
       
   102 	/**
       
   103 	 * Sets info is mmp file build with AnalyzeTool.
       
   104 	 *
       
   105 	 * @param location
       
   106 	 *            MMP file location
       
   107 	 */
       
   108 	public final void setBuildInfoAndCheck(final String location) {
       
   109 		buildSuccesfully = Util.isModuleBuild(location);
       
   110 	}
       
   111 
       
   112 	/**
       
   113 	 * MMP file location.
       
   114 	 *
       
   115 	 * @param location
       
   116 	 *            MMP file location
       
   117 	 */
       
   118 	public final void setLocation(final String location) {
       
   119 		IFile file = null;
       
   120 
       
   121 		// try to find file
       
   122 		file = ResourcesPlugin.getWorkspace().getRoot().getFile(
       
   123 				new Path(location));
       
   124 
       
   125 		// file found from workspace store file location
       
   126 		if (file.exists()) {
       
   127 			mmpFilePath = file.getLocation().toOSString();
       
   128 
       
   129 		}
       
   130 		setBuildInfoAndCheck(mmpFilePath);
       
   131 	}
       
   132 
       
   133 	/**
       
   134 	 * Sets mmp file target.
       
   135 	 *
       
   136 	 * @param target
       
   137 	 *            MMP file target
       
   138 	 */
       
   139 	public final void setTarget(final String target) {
       
   140 		mmpTarget = target;
       
   141 	}
       
   142 }