upload tizen1.0 source
[sdk/ide/product.git] / org.eclipse.cdt.ui / src / org / eclipse / cdt / ui / actions / BuildConfigAction.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2008 Nokia and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  *     Nokia - initial API and implementation
10  *******************************************************************************/
11 package org.eclipse.cdt.ui.actions;
12
13 import java.util.HashSet;
14
15 import org.eclipse.core.resources.IProject;
16 import org.eclipse.jface.viewers.StructuredSelection;
17 import org.eclipse.ui.actions.BuildAction;
18
19 /**
20  * Action which builds the active configurations of the selected projects.
21  */
22 public class BuildConfigAction extends ChangeConfigAction {
23         
24         private BuildAction buildAction;
25
26         /**
27          * Constructs the action.
28          * @param projects List of selected managed-built projects 
29          * @param configName Build configuration name
30          * @param accel Number to be used as accelerator
31          */
32         public BuildConfigAction(HashSet<IProject> projects, String configName, String displayName, int accel, BuildAction buildAction) {
33                 super(projects, configName, displayName, accel);
34                 this.buildAction = buildAction;
35         }
36         
37         /**
38          * @see org.eclipse.jface.action.IAction#run()
39          */
40         @Override
41         public void run() {
42                 super.run();
43                 buildAction.selectionChanged(new StructuredSelection(fProjects.toArray()));
44                 buildAction.run();              
45         }
46 }