summaryrefslogtreecommitdiffstats
path: root/org.rtems.cdt.toolchain2/org/rtems/cdt/wizards/FinishSetup.java
blob: d891c839ad40d315a3c4d64994ec87dd2dae019e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
 * Copyright (c) 2008
 * Embedded Brains GmbH
 * Obere Lagerstr. 30
 * D-82178 Puchheim
 * Germany
 * rtems@embedded-brains.de
 *
 * The license and distribution terms for this file may be found in the file
 * LICENSE in this distribution or at http://www.rtems.com/license/LICENSE.
 */

package org.rtems.cdt.wizards;

import org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPageManager;
import org.eclipse.cdt.ui.wizards.CDTCommonProjectWizard;
import org.eclipse.core.resources.IProject;
import org.eclipse.jface.wizard.IWizardPage;
import org.rtems.cdt.Constants;
import org.rtems.cdt.Storage;

public class FinishSetup implements Runnable {
	public void run() {
		// Get a handle to the wizard
		IWizardPage [] pages = MBSCustomPageManager.getPages();
		
		if (pages != null && pages.length > 0) {
			// Get last project
			CDTCommonProjectWizard wizard = (CDTCommonProjectWizard) pages [0].getWizard();
			IProject project = wizard.getLastProject();
			
			// Get wizard values
			String basePath = (String) MBSCustomPageManager.getPageProperty(
				BasicSetup.PAGE_ID, Constants.BASE_PATH_KEY
			);
			String bspPath = (String) MBSCustomPageManager.getPageProperty(
				BasicSetup.PAGE_ID, Constants.BSP_PATH_KEY
			);
			
			// Set project properties
			Storage.setProperty( project, Constants.BASE_PATH_KEY, basePath);
			Storage.setProperty( project, Constants.BSP_PATH_KEY, bspPath);
			
			// Update tools
			Storage.updateTools( project);
		}
	}
}