sysperfana/analyzetoolext/com.nokia.s60tools.analyzetool/src/com/nokia/s60tools/analyzetool/builder/CustomPreBuilder.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 CustomPreBuilder
       
    15  *
       
    16  */
       
    17 
       
    18 package com.nokia.s60tools.analyzetool.builder;
       
    19 
       
    20 import org.eclipse.core.resources.IProject;
       
    21 import org.eclipse.core.runtime.IProgressMonitor;
       
    22 import org.eclipse.jface.preference.IPreferenceStore;
       
    23 
       
    24 import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin;
       
    25 import com.nokia.carbide.cdt.builder.builder.CarbideCommandLauncher;
       
    26 import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo;
       
    27 import com.nokia.s60tools.analyzetool.Activator;
       
    28 import com.nokia.s60tools.analyzetool.global.Constants;
       
    29 
       
    30 /**
       
    31  * Class to execute AnalyzeTool custom pre-build actions.
       
    32  *
       
    33  * This class holds many static variables because {@link CustomPostBuilder}
       
    34  * class need to know what variables is used when calling CustomPreBuilder
       
    35  * without creating a new object of this class
       
    36  *
       
    37  * @author kihe
       
    38  *
       
    39  */
       
    40 public class CustomPreBuilder extends AnalyzeToolBuilder {
       
    41 
       
    42 	/**
       
    43 	 * Executes AnalyzeTool post actions when user builds projects.
       
    44 	 *
       
    45 	 * @see com.nokia.carbide.cdt.builder.builder.CarbideCPPBuilder#build(int,
       
    46 	 *      java.util.Map, org.eclipse.core.runtime.IProgressMonitor)
       
    47 	 */
       
    48 	@Override
       
    49 	@SuppressWarnings("unchecked")
       
    50 	protected IProject[] build(final int kind, final java.util.Map args,
       
    51 			final IProgressMonitor monitor) {
       
    52 		// clear used build parameters
       
    53 		if (mmpFiles != null) {
       
    54 			mmpFiles.clear();
       
    55 		}
       
    56 		IPreferenceStore store = Activator.getPreferences();
       
    57 		store.setValue(Constants.PREFS_BUILD_CANCELLED, false);
       
    58 
       
    59 		// get selected project reference
       
    60 		final IProject project = super.getProject();
       
    61 
       
    62 		// get project info
       
    63 		final ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager()
       
    64 				.getProjectInfo(project);
       
    65 
       
    66 		final CarbideCommandLauncher launcher = new CarbideCommandLauncher(project,
       
    67 				monitor, Constants.atoolParserIds, cpi.getINFWorkingDirectory());
       
    68 		launcher.showCommand(true);
       
    69 
       
    70 		if (!runPreSteps(launcher, monitor, cpi)) {
       
    71 			return null;
       
    72 		}
       
    73 
       
    74 		runBuild(Constants.ATOOL_INST, monitor, cpi, null);
       
    75 
       
    76 		return new IProject[0];
       
    77 	}
       
    78 
       
    79 	@Override
       
    80 	protected void clean(final IProgressMonitor arg0){
       
    81 		// DO nothing by design
       
    82 	}
       
    83 
       
    84 }