Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] MBS wizard page can't get project template type in time to show a different wizard page content


hi Beth,

 I'm not sure this is a good way to be going about this as the template engine
is invoked upon wizard finish - i.e. after the custom MPI page is displayed. That
means any actions taken in the processes will need be picked up by any custom pages.

Having taken a look at the current implementation in CVS, I think we can get
what you want to happen via the existing template pages extension mechanism, which
means we don't hit the data-flow problem from above.

The attached patch shows how this could work - I've verified that the data is being
passed around as expected:

       

I hit a bug in the template engine during this, but have updated cdt_4_0 and HEAD now
so you might need to sync to the latest sources.

thanks,
Andrew


> I am using project templates to nicely allow several types of C projects
> with different sample content, ideal for a tutorial so the students have
> easily-created C projects.
>
> I am using MBSCustomPage to add a wizard page that calculates how to add
> the include paths, and other calculated entities.
> (Can't use the static information that a template wizard page could do.)
>
> I want to use a different wizard page depending on the type of project the
> user selected from the templates, but I can't seem to get that information
> in time to
> affect which wizard page I show.
> In order to get the project type, I added a process type that just
> remembers the project type:
>  <extension point="org.eclipse.cdt.core.templateProcessTypes">
>   <processType name="storeInfo"
>    processRunner=
> "org.eclipse.ptp.pldt.wizards.wizardPages.StoreInfoProcessRunner">
>    <simple name=."projectName"> </simple>
>    <simple name=."projectType"> </simple>
>   </processType>.
>  </extension>
>
> So then in the template.xml I put:
>       <process type="org.eclipse.ptp.pldt.wizards.storeInfo">
>             <simple name="projectName" value="$(projectName)"/>
>             <simple name="projectType" value="mpi_project"/>
>       </process>
> This way I should be able to determine that the user chose an "mpi_project"
>
> However, I don't get this information in time.
> Here's the order that things happen  (MPIProjectWizardPage is an
> MBSCustomPage).
>
> StoreInfoProcessRunner.ctor()
> MPIProjectWizardPage().ctor...
>   projectType=null  --- don't know it yet
> MPIProjectWizardPage.createUserEntryArea()
>   projectType=null  --- don't know it yet   (need it at this point to
> determine what wizard page to show, but earlier would be better)
> StoreInfoProcessRunner.process()...
>   projectName=mpihello2 ---> now I have it, but it's too late.
>
> Is there any way to get some information about which template is running,
> before the MBS wizard page displays?
>
> ...Beth
>
> Beth Tibbitts  (859) 243-4981  (TL 545-4981)
> High Productivity Tools / Parallel Tools  http://eclipse.org/ptp
> IBM T.J.Watson Research Center
> Mailing Address:  IBM Corp., 455 Park Place, Lexington, KY 40511
>
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/cdt-dev


**********************************************************************
Symbian Software Ltd is a company registered in England and Wales with registered number 4190020 and registered office at 2-6 Boundary Row, Southwark, London, SE1 8HP, UK. This message is intended only for use by the named addressee and may contain privileged and/or confidential information. If you are not the named addressee you should not disseminate, copy or take any action in reliance on it. If you have received this message in error please notify postmaster@xxxxxxxxxxx and delete the message and any attachments accompanying it immediately. Neither Symbian nor any of its Affiliates accepts liability for any corruption, interception, amendment, tampering or viruses occurring to this message in transit or for any message sent by its employees which is not in compliance with Symbian corporate policy.
**********************************************************************

### Eclipse Workspace Patch 1.0
#P org.eclipse.ptp.pldt.common
Index: .settings/org.eclipse.jdt.core.prefs
===================================================================
RCS file: .settings/org.eclipse.jdt.core.prefs
diff -N .settings/org.eclipse.jdt.core.prefs
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ .settings/org.eclipse.jdt.core.prefs	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,12 @@
+#Thu Nov 08 10:19:05 GMT 2007
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
#P org.eclipse.ptp.pldt.mpi.core
Index: .settings/org.eclipse.jdt.core.prefs
===================================================================
RCS file: .settings/org.eclipse.jdt.core.prefs
diff -N .settings/org.eclipse.jdt.core.prefs
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ .settings/org.eclipse.jdt.core.prefs	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,12 @@
+#Thu Nov 08 10:19:49 GMT 2007
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
#P org.eclipse.ptp.pldt.wizards
Index: templates/MPIpiCproject/template.xml
===================================================================
RCS file: /cvsroot/tools/org.eclipse.ptp/tools/org.eclipse.ptp.pldt.wizards/templates/MPIpiCproject/template.xml,v
retrieving revision 1.1
diff -u -r1.1 template.xml
--- templates/MPIpiCproject/template.xml	8 Nov 2007 03:46:25 -0000	1.1
+++ templates/MPIpiCproject/template.xml	8 Nov 2007 12:09:01 -0000
@@ -60,9 +60,8 @@
 		</complex-array>
 	</process>
 	
-	<process type="org.eclipse.ptp.pldt.wizards.storeInfo">
-		<simple name="projectName" value="$(projectName)"/>
-		<simple name="projectType" value="mpi_project"/>
+	<process type="org.eclipse.ptp.pldt.wizards.mpiProjectProcess">
+		<!-- no arguments as we go straight to the store (not recommended usage of template engine..) -->
 	</process>
 
 </template>
Index: templates/MPIemptyCproject/template.xml
===================================================================
RCS file: /cvsroot/tools/org.eclipse.ptp/tools/org.eclipse.ptp.pldt.wizards/templates/MPIemptyCproject/template.xml,v
retrieving revision 1.2
diff -u -r1.2 template.xml
--- templates/MPIemptyCproject/template.xml	7 Nov 2007 20:44:10 -0000	1.2
+++ templates/MPIemptyCproject/template.xml	8 Nov 2007 12:09:01 -0000
@@ -4,9 +4,8 @@
 		id="MPIemptyCproject" label="MPI Empty C Project" description="An empty MPI  project template"
 		 help="help.html">
 
-	<process type="org.eclipse.ptp.pldt.wizards.storeInfo">
-		<simple name="projectName" value="$(projectName)"/>
-		<simple name="projectType" value="mpi_project"/>
+	<process type="org.eclipse.ptp.pldt.wizards.mpiProjectProcess">
+		<!-- no arguments as we go straight to the store (not recommended usage of template engine..) -->
 	</process>
 </template>
 
Index: templates/OpenMPemptyCproject/template.xml
===================================================================
RCS file: /cvsroot/tools/org.eclipse.ptp/tools/org.eclipse.ptp.pldt.wizards/templates/OpenMPemptyCproject/template.xml,v
retrieving revision 1.2
diff -u -r1.2 template.xml
--- templates/OpenMPemptyCproject/template.xml	7 Nov 2007 20:44:11 -0000	1.2
+++ templates/OpenMPemptyCproject/template.xml	8 Nov 2007 12:09:01 -0000
@@ -4,9 +4,8 @@
 		id="OpenMPemptyCProject" label="OpenMP Empty C Project" description="An OpenMP MPI project template"
 		 help="help.html">
 
-	<process type="org.eclipse.ptp.pldt.wizards.storeInfo">
-		<simple name="projectName" value="$(projectName)"/>
-		<simple name="projectType" value="openMP_project"/>
+	<process type="org.eclipse.ptp.pldt.wizards.mpiProjectProcess">
+		<!-- no arguments as we go straight to the store (not recommended usage of template engine..) -->
 	</process>
 </template>
 
Index: src/org/eclipse/ptp/pldt/wizards/wizardPages/StoreInfoProcessRunner.java
===================================================================
RCS file: src/org/eclipse/ptp/pldt/wizards/wizardPages/StoreInfoProcessRunner.java
diff -N src/org/eclipse/ptp/pldt/wizards/wizardPages/StoreInfoProcessRunner.java
--- src/org/eclipse/ptp/pldt/wizards/wizardPages/StoreInfoProcessRunner.java	8 Nov 2007 02:43:20 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corp. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *     IBM Corp. - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.ptp.pldt.wizards.wizardPages;
-
-import org.eclipse.cdt.core.templateengine.TemplateCore;
-import org.eclipse.cdt.core.templateengine.process.ProcessArgument;
-import org.eclipse.cdt.core.templateengine.process.ProcessFailureException;
-import org.eclipse.cdt.core.templateengine.process.ProcessRunner;
-import org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPageManager;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-/**
- * @author tibbitts
- *
- */
-public class StoreInfoProcessRunner extends ProcessRunner {
-	/** key to use in MBSCustomPage data for storing project type found in template */
-	public static final String PROJECT_TYPE_KEY="projectType";
-	public static final String PROJECT_TYPE_VALUE_MPI="mpi_project";
-	public static final String PROJECT_TYPE_VALUE_OPENMP="openMP_project";
-	private boolean wizTraceOn=MPIProjectWizardPage.wizardTraceOn;
-
-	/**
-	 * 
-	 */
-	public StoreInfoProcessRunner() {
-		if(wizTraceOn)System.out.println("StoreInfoProcessRunner.ctor()");
-	}
-
-	/**
-	 * Process runner to execute with information obtained from StoreInfo template process
-	 * @see org.eclipse.cdt.core.templateengine.process.ProcessRunner#process(org.eclipse.cdt.core.templateengine.TemplateCore, org.eclipse.cdt.core.templateengine.process.ProcessArgument[], java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
-	 */
-	@Override
-	public void process(TemplateCore template, ProcessArgument[] args,
-			String processId, IProgressMonitor monitor)
-			throws ProcessFailureException {
-		if(wizTraceOn)System.out.println("StoreInfoProcessRunner.process()...");
-		String projectName = args[0].getSimpleValue();
-		if(wizTraceOn)System.out.println("  projectName="+projectName);
-		Object pto = args[1];
-		
-		String projectType=pto.toString();
-		if(wizTraceOn)System.out.println("  projectType="+projectType);
-		
-		//MPSCustomPageManager.addPageData
-		String pageID=MPIProjectWizardPage.PAGE_ID;
-		MBSCustomPageManager.addPageProperty(pageID, PROJECT_TYPE_KEY, projectType);
-		MBSCustomPageManager.getPageProperty("pageID", "propID");
-		//MBSCustomPageManager.setPageHideStatus("pageID", status)
-
-	}
-
-	/**
-	 * This method Adds the File to the corresponding Project.
-	 */
-	public void process2(TemplateCore template, ProcessArgument[] args, String processId, IProgressMonitor monitor) throws ProcessFailureException {
-		String projectName = args[0].getSimpleValue();
-		ProcessArgument file = args[1];
-		
-	}
-
-}
Index: src/org/eclipse/ptp/pldt/wizards/wizardPages/TestExtraPagesProvider.java
===================================================================
RCS file: src/org/eclipse/ptp/pldt/wizards/wizardPages/TestExtraPagesProvider.java
diff -N src/org/eclipse/ptp/pldt/wizards/wizardPages/TestExtraPagesProvider.java
--- src/org/eclipse/ptp/pldt/wizards/wizardPages/TestExtraPagesProvider.java	8 Nov 2007 02:43:20 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corp. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *     IBM Corp. - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.ptp.pldt.wizards.wizardPages;
-
-import java.util.Collections;
-import java.util.Map;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchWizard;
-
-import org.eclipse.cdt.ui.templateengine.AbstractWizardDataPage;
-import org.eclipse.cdt.ui.templateengine.IPagesAfterTemplateSelectionProvider;
-import org.eclipse.cdt.ui.templateengine.IWizardDataPage;
-
-/**
- * An example implementation of {@link IPagesAfterTemplateSelectionProvider} for
- * testing purposes.
- */
-public class TestExtraPagesProvider implements IPagesAfterTemplateSelectionProvider {
-	IWizardDataPage[] pages;
-	
-	public IWizardDataPage[] createAdditionalPages(IWorkbenchWizard wizard,
-			IWorkbench workbench, IStructuredSelection selection) {
-		pages= new IWizardDataPage[1];
-		pages[0]= new MyPage("Example custom page 1", "exampleAttr1", "Value1");
-//		pages[1]= new MyPage("Example custom page 2", "exampleAttr2", "Value2");
-//		pages[2]= new MyPage("Example custom page 3", "exampleAttr3", "Value3");
-		return pages;
-	}
-
-	public IWizardDataPage[] getCreatedPages(IWorkbenchWizard wizard) {
-		return pages;
-	}
-
-	/**
-	 * An example implementation of {@link IWizardDataPage} for test purposes.
-	 */
-	static class MyPage extends AbstractWizardDataPage implements IWizardDataPage {
-		String labelText , dataKey, dataValue;
-		
-		public MyPage(String labelText, String dataKey, String dataValue) {
-			super("CustomTestPageName", "Title", null);
-			setMessage("Custom test page message");
-			this.labelText= labelText;
-			this.dataKey= dataKey;
-			this.dataValue= dataValue;
-		}
-		
-		public Map getPageData() {// gets called after FINISH
-			return Collections.singletonMap(dataKey, dataValue);
-		}
-
-		public void createControl(Composite parent) {
-			Label l= new Label(parent, SWT.NONE);
-			l.setText(labelText);
-			setControl(l);
-		}
-	}
-}
Index: src/org/eclipse/ptp/pldt/wizards/wizardPages/MPIProjectWizardPage.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.ptp/tools/org.eclipse.ptp.pldt.wizards/src/org/eclipse/ptp/pldt/wizards/wizardPages/MPIProjectWizardPage.java,v
retrieving revision 1.11
diff -u -r1.11 MPIProjectWizardPage.java
--- src/org/eclipse/ptp/pldt/wizards/wizardPages/MPIProjectWizardPage.java	8 Nov 2007 02:43:20 -0000	1.11
+++ src/org/eclipse/ptp/pldt/wizards/wizardPages/MPIProjectWizardPage.java	8 Nov 2007 12:09:01 -0000
@@ -13,22 +13,16 @@
 
 import java.net.URI;
 import java.net.URISyntaxException;
+import java.util.HashMap;
+import java.util.Map;
 
-import org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPage;
-import org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPageData;
-import org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPageManager;
-import org.eclipse.cdt.ui.wizards.CProjectWizard;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.cdt.ui.templateengine.AbstractWizardDataPage;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.QualifiedName;
 import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.jface.preference.IPreferenceStore;
 import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.IWizardPage;
 import org.eclipse.ptp.pldt.mpi.core.MpiIDs;
 import org.eclipse.ptp.pldt.mpi.core.MpiPlugin;
 import org.eclipse.swt.SWT;
@@ -54,7 +48,8 @@
  * @author Beth Tibbitts
  * 
  */
-public class MPIProjectWizardPage extends MBSCustomPage {
+public class MPIProjectWizardPage extends AbstractWizardDataPage {
+	public static final String DOT = ".";
 	private static final boolean traceOn=false;
 	public static final boolean wizardTraceOn=false;
 
@@ -122,7 +117,8 @@
 	 */
 	private boolean useMpiProjectSettings=false;
 	private String desc = "MPI Project Page";
-
+	private String fTemplateID;
+	
 	/**
 	 * The CDT new project wizard page for MPI projects.  
 	 * Adds the include paths, library information, etc. for an MPI project.
@@ -131,14 +127,9 @@
 	 * 
 	 */
 	public MPIProjectWizardPage() throws CoreException {
-		super(PAGE_ID);
-		if(wizardTraceOn)System.out.println("MPIProjectWizardPage().ctor...");
-		String key=StoreInfoProcessRunner.PROJECT_TYPE_KEY;
-		Object projectType=MBSCustomPageManager.getPageProperty(pageID, key);
-		if(wizardTraceOn)System.out.println("  projectType="+projectType);
+		super("MPI Project Settings");
 		
-		
-
+		if(wizardTraceOn)System.out.println("MPIProjectWizardPage().ctor...");
 
 		//CommonPlugin.log(IStatus.ERROR,"Test error");
 		//CommonPlugin.log(IStatus.WARNING,"Test warning");
@@ -167,16 +158,20 @@
 	/**
 	 * Warn user that the MPI project preferences aren't set, and thus the new project wizard will not be very useful.
 	 * <br>
-	 * TODO: do we need a "do not show this message again" setting?
+	 * TODO: do we need a "do not show this message again" setting? (af - yes please! ;)
 	 * TODO: need to not show this UNLESS it's really an MPI project.
 	 */
-	private void showNoPrefs() {
-		Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
-		StringBuffer buf=new StringBuffer("No MPI Preferences set; ");
-		buf.append("Default project setting will be more useful if MPI preferences are set first. ");
-		buf.append("\nUse Window > Preferences and select Parallel Language Development Tools, which may be under PTP preferences.");
-		buf.append("You can cancel out of new project wizard to enter MPI preferences now.");
-		MessageDialog.openWarning(shell, "No MPI Preferences set", buf.toString());
+	private static boolean alreadyShown;
+	private static void showNoPrefs() {
+		if(!alreadyShown) {
+			Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+			StringBuffer buf=new StringBuffer("No MPI Preferences set; ");
+			buf.append("Default project setting will be more useful if MPI preferences are set first. ");
+			buf.append("\nUse Window > Preferences and select Parallel Language Development Tools, which may be under PTP preferences.");
+			buf.append("You can cancel out of new project wizard to enter MPI preferences now.");
+			MessageDialog.openWarning(shell, "No MPI Preferences set", buf.toString());
+			alreadyShown= true;
+		}
 	}
 
 	/**
@@ -230,7 +225,7 @@
 	 */
 	private void setCurrentMpiIncludePath(String path) {
 		currentMpiIncludePath = path;
-		MBSCustomPageManager.addPageProperty(pageID, INCLUDE_PATH_PROP_ID, path);
+		pageData.put(PAGE_ID+DOT+INCLUDE_PATH_PROP_ID, path);
 	}
 	/**
 	 * This sets what will be remembered for library name when we leave the wizard page
@@ -241,8 +236,11 @@
 	 */
 	private void setCurrentMpiLibName(String name) {
 		currentMpiIncludePath = name;
-		MBSCustomPageManager.addPageProperty(pageID, LIB_PROP_ID, name);
+		pageData.put(PAGE_ID+DOT+LIB_PROP_ID, name);
 	}
+	
+	Map<String, String> pageData= new HashMap<String, String>();
+	
 	/**
 	 * This sets what will be remembered for library search path when we leave the wizard page
 	 * (so we can retrieve the information from the Runnable to actualy do the change
@@ -252,25 +250,19 @@
 	 */
 	private void setCurrentMpiLibPath(String path) {
 		currentMpiIncludePath = path;
-		MBSCustomPageManager.addPageProperty(pageID, LIBRARY_SEARCH_PATH_PROP_ID, path);
+		pageData.put(PAGE_ID+DOT+LIBRARY_SEARCH_PATH_PROP_ID, path);
 	}
 	private void setCurrentMpiCompileCommand(String buildCommand) {
 		currentMpiCompileCommand = buildCommand;
-		MBSCustomPageManager.addPageProperty(pageID, MPI_COMPILE_COMMAND_PROP_ID, buildCommand);
+		pageData.put(PAGE_ID+DOT+MPI_COMPILE_COMMAND_PROP_ID, buildCommand);
 	}
 	private void setCurrentMpiLinkCommand(String buildCommand) {
 		currentMpiLinkCommand = buildCommand;
-		MBSCustomPageManager.addPageProperty(pageID, MPI_LINK_COMMAND_PROP_ID, buildCommand);
+		pageData.put(PAGE_ID+DOT+MPI_LINK_COMMAND_PROP_ID, buildCommand);
 	}
 	private void setCurrentMpiSample(boolean doit){
 		String str=Boolean.toString(doit);
-		MBSCustomPageManager.addPageProperty(pageID, MPI_SAMPLE_FILE_PROP_ID, str);
-	}
-
-
-	public boolean canFlipToNextPage() {
-
-		return (MBSCustomPageManager.getNextPage(pageID) != null);
+		pageData.put(PAGE_ID+DOT+MPI_SAMPLE_FILE_PROP_ID, str);
 	}
 
 	public String getName() {
@@ -384,11 +376,6 @@
 		//?? err? causes things to happen in wrong order??   IProject project = this.getProject();
 		//String name = project.getName();
 		if(wizardTraceOn)System.out.println("MPIProjectWizardPage.createUserEntryArea() " );
-
-		String key=StoreInfoProcessRunner.PROJECT_TYPE_KEY;
-		Object pto=MBSCustomPageManager.getPageProperty(pageID, key);
-		String projectType=(String)pto;
-		if(wizardTraceOn)System.out.println("  projectType="+projectType); 
 		
 		includePathLabel = new Label(composite, SWT.NONE);
 		includePathLabel.setText("Include path:");
@@ -533,7 +520,7 @@
 			public void widgetSelected(SelectionEvent e) {
 				useMpiProjectSettings = useMpiProjectSettingsButton.getSelection();
 				// set value so we can read it later
-				MBSCustomPageManager.addPageProperty(pageID, DO_MPI_INCLUDES, Boolean.toString(useMpiProjectSettings));
+				pageData.put(PAGE_ID+DOT+DO_MPI_INCLUDES, Boolean.toString(useMpiProjectSettings));
 				
 				useDefaultsButton.setEnabled(useMpiProjectSettings);
 				if(mpiSampleButton!=null)
@@ -639,7 +626,7 @@
 	}
 
 	public Image getImage() {
-		return wizard.getDefaultPageImage();
+		return getWizard().getDefaultPageImage();
 	}
 
 	public String getMessage() {
@@ -734,30 +721,9 @@
 	public static boolean getDefaultUseMpiIncludes() {
 		return defaultUseMpiIncludes;
 	}
-	
-	public IProject getProject(){
-		CProjectWizard wiz=null;
-		MBSCustomPageData pData = MBSCustomPageManager.getPageData(PAGE_ID);
-		
 
- 		try {
-			IWizardPage wp = pData.getWizardPage();// in the constructor, this isn't available
-			IWizard w = wp.getWizard();
-			if(w instanceof CProjectWizard){
-				wiz = (CProjectWizard)w;
-			}
-			if(wiz==null){
-				System.out.println("Can't get CProjectWizard from MBS page data. Quitting. No MPI info added to project.");
-				return null;
-			}
-		}
-		catch (Exception e) {
-			Throwable reason = e.getCause();
-			System.out.println(e.getMessage()+" reason: "+reason);
-			
-		}
-		IProject proj=wiz.getProject(true);
-		return proj;
+	public Map<String,String> getPageData() {
+		return pageData;
 	}
 
 }
Index: src/org/eclipse/ptp/pldt/wizards/wizardPages/MPIProjectRunnable.java
===================================================================
RCS file: src/org/eclipse/ptp/pldt/wizards/wizardPages/MPIProjectRunnable.java
diff -N src/org/eclipse/ptp/pldt/wizards/wizardPages/MPIProjectRunnable.java
--- src/org/eclipse/ptp/pldt/wizards/wizardPages/MPIProjectRunnable.java	8 Nov 2007 02:43:20 -0000	1.11
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,594 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006,2007 IBM Corp. 
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *     IBM Corp. - initial implementation
- *******************************************************************************/
-
-package org.eclipse.ptp.pldt.wizards.wizardPages;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-import org.eclipse.cdt.managedbuilder.core.BuildException;
-import org.eclipse.cdt.managedbuilder.core.IConfiguration;
-import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
-import org.eclipse.cdt.managedbuilder.core.IManagedProject;
-import org.eclipse.cdt.managedbuilder.core.IOption;
-import org.eclipse.cdt.managedbuilder.core.ITool;
-import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
-import org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPageData;
-import org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPageManager;
-import org.eclipse.cdt.ui.wizards.CProjectWizard;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.ptp.pldt.wizards.MpiWizardsPlugin;
-import org.osgi.framework.Bundle;
-
-/**
- * 
- * After the MPIProjectWizardPage runs, and we get MPI include path from the user,
- * we have this opportunity to use that information to modify the include paths etc.
- * in the project
- * 
- * <p>Note: not sure we handle C++ projects correctly yet.
- * 
- * @author Beth Tibbitts
- *
- */
-public class MPIProjectRunnable implements Runnable {
-	private static final boolean traceOn=false;
-	private boolean wizTraceOn=MPIProjectWizardPage.wizardTraceOn;
-
-	/**
-	 * Take the info from the MPI project wizard page and fix up the project include paths etc.
-	 * 
-	 * @see java.lang.Runnable#run()
-	 */
-	public void run() {
-		if(wizTraceOn)System.out.println("MPIProjectRunnable().run()...");
-		
-		String pageID = MPIProjectWizardPage.PAGE_ID;
-		String propID = MPIProjectWizardPage.DO_MPI_INCLUDES;
-		
-		String key=StoreInfoProcessRunner.PROJECT_TYPE_KEY;
-		Object projectType=MBSCustomPageManager.getPageProperty(pageID, key);
-		if(traceOn)System.out.println("  projectType="+projectType);
-
-		
-		Object obj = MBSCustomPageManager.getPageProperty(pageID, propID);
-		boolean doMpiIncludes = MPIProjectWizardPage.getDefaultUseMpiIncludes();
-		if (obj != null)
-			doMpiIncludes = Boolean.valueOf((String) obj);
-		if (!doMpiIncludes) {
-			if (traceOn)
-				System.out.println("Do not save MPI info in this project.");
-			return;
-		}
-		MBSCustomPageData pData = MBSCustomPageManager.getPageData(pageID);
- 		CProjectWizard wiz=null;//cdt40  (cdt 3.1 was NewCProjectWizard)
-
- 		try {
-			IWizardPage wp = pData.getWizardPage();
-			IWizard w = wp.getWizard();
-			if(w instanceof CProjectWizard){
-				wiz = (CProjectWizard)w;
-			}
-			if(wiz==null){
-				System.out.println("Can't get CProjectWizard from MBS page data. Quitting. No MPI info added to project.");
-				return;
-			}
-		}
-		catch (Exception e) {
-			Throwable reason = e.getCause();
-			System.out.println(e.getMessage()+" reason: "+reason);
-			
-		}
-		IProject proj=wiz.getProject(true);
-
-		if(traceOn)System.out.println("Project: " + proj.getName());
-
-		// Collect the values that the user entered on the wizard page
-		propID = MPIProjectWizardPage.INCLUDE_PATH_PROP_ID;
-		String newIncludePath = getNewPropValue(pageID, propID,"c:/mpich2/include");
-		if(traceOn)System.out.println("Got prop: "+propID+"="+newIncludePath);
-		
-		propID = MPIProjectWizardPage.LIB_PROP_ID;
-		String newLib=getNewPropValue(pageID,propID,"lib");
-		
-		propID=MPIProjectWizardPage.LIBRARY_SEARCH_PATH_PROP_ID;
-		String newLibSearchPath=getNewPropValue(pageID,propID,"c:/mpich2/lib");
-		
-		propID=MPIProjectWizardPage.MPI_COMPILE_COMMAND_PROP_ID;
-		String mpiCompileCommand=getNewPropValue(pageID,propID,"mpicc");
-		
-		propID=MPIProjectWizardPage.MPI_LINK_COMMAND_PROP_ID;
-		String mpiLinkCommand=getNewPropValue(pageID,propID,"mpicc");
-		
-		propID=MPIProjectWizardPage.MPI_SAMPLE_FILE_PROP_ID;
-		String mpiSampleFileInsert=getNewPropValue(pageID, propID, "false");
- 
-		IManagedBuildInfo info = null;
-		try {
-			info = ManagedBuildManager.getBuildInfo(proj);
-			// note: assumed null if this is not a managed build project? will we get here in that case?
-			if(traceOn)System.out.println("Build info: " + info);
-		} catch (Exception e) {
-			System.out.println("MPIProjectRunnable.run(), "+e.getMessage());
-			e.printStackTrace();
-			return;
-		}
-		assert(info!=null);
-		
-		IManagedProject mProj = info.getManagedProject();
-		if(traceOn)showOptions(mProj);
-		
-		// add the include path & linker values to all the configurations
-		IConfiguration[] configs = mProj.getConfigurations();
-		for (int i = 0; i < configs.length; i++) {
-			IConfiguration cf = configs[i];
-			if(traceOn)System.out.println("Config " + i + ": " + cf.getName());
-			addIncludePath(cf, newIncludePath);
-			addLinkerOpt(cf,newLib,newLibSearchPath);
-			setCompileCommand(cf,mpiCompileCommand);
-			setLinkCommand(cf,mpiLinkCommand);		
-		}
-		if(traceOn)System.out.println("MPIProjectRunnable, newIncludePath: "+newIncludePath);
-		if(traceOn)System.out.println("   newLib: "+newLib+"  newLibSrchPth: "+newLibSearchPath);
-		if(traceOn)System.out.println("   compileCmd: "+mpiCompileCommand);
-		if(traceOn)System.out.println("   linkCmd: "+mpiLinkCommand);
-		// ManagedBuildManger.saveBuildInfo(...) assures that the
-		// values are persisted in the build model, otherwise they will
-		// be lost when you shut down Eclipse.
-		if(traceOn)System.out.println("ManagedBuildManager.saveBuildInfo...");
-		
-		if(mpiSampleFileInsert.equals("true")){
-			 try {
-				Bundle bundle = Platform.getBundle(MpiWizardsPlugin.getPluginId());
-				String sourceFilename="samples/testMPI.c";
-				String destFileName="testMPI.c";
-				Path path = new Path(sourceFilename);
-				URL fileURL = FileLocator.find(bundle, path, null);
-				InputStream destFileStream = null;
-				try {
-					destFileStream = fileURL.openStream();
-					proj.getFile(destFileName).create(destFileStream,false,null);
-					//System.out.println("file "+fname+" created.");
-				} catch (IOException e) {
-					System.out.println("Error creating file: "+destFileName);
-					//e.printStackTrace();
-				}
-			} catch (CoreException e) {
-				System.out.println("Error creating testMPI.c");
-				e.printStackTrace();
-			}
-		}
-		ManagedBuildManager.saveBuildInfo(proj, true);
-
-	}
-	public static String getResourceString(String key) {
-		ResourceBundle bundle = MpiWizardsPlugin.getDefault().getResourceBundle();
-		try {
-			return (bundle != null) ? bundle.getString(key) : key;
-		} catch (MissingResourceException e) {
-			return key;
-		}
-	}
-
-	/**
-	 * Get a value that was possibly obtained from the user on the associated wizard page.
-	 * @param pageID The pageID for our wizard page
-	 * @param propID The propID of the value we want
-	 * @param defaultVal The default value to use if the user didn't select anything,
-	 * or if we haven't gotten around to LETTING the user select anything yet.
-	 * @return
-	 */
-	private String getNewPropValue(String pageID, String propID, String defaultVal) {
-		Object obj = MBSCustomPageManager.getPageProperty(pageID, propID);
-		// if selection made on page, obj is non-null.
-		String newValue = defaultVal;
-		String msg=" ( used default value)";
-		if (obj != null) {
-			newValue = obj.toString();
-			msg="";
-		}
-		if(traceOn)System.out.println("propID=" + propID + "  value=" + newValue+msg);
-		return newValue;
-	}
-
-
-	/**
-	 * Add an include path for C compiling to the existing include paths of the given
-	 * Configuration.  XLC is handled as a special case to find its include path option;
-	 * for other tools, we assume there is a single option for include paths, so we take
-	 * the first one.
-	 * 
-	 * @param cf
-	 *            the configuration of the project (e.g. Release, Debug, etc.)
-	 * @param newIncludePath
-	 *            include path(s) to add.  If more than one, separate by
-	 *            java.io.File.pathSeparator, which is semicolon for Windows, colon for Mac/Linux
-	 */
-	private void addIncludePath(IConfiguration cf, String newIncludePath) {
-		// note: could be > 1 path in 'newIncludePath'
-		String ext = "c";
-		ITool cfTool = cf.getToolFromInputExtension(ext);
-		// do we need to also handle c++ case as well?
-
-		String id = cfTool.getId(); // "cdt.managedbuild.tool.xlc.c.compiler.exe.debug.1423270745"
-		String name = cfTool.getName();// "XL C Compiler"
-		IOption option = null;
-		if (name.startsWith("XL C")) { // special case for XL C compiler
-			option = cfTool.getOptionById("xlc.c.compiler.option.include.paths");
-		} else { // otherwise we assume there is only one include path option.
-			option = getFirstOptionByType(cf, cfTool, IOption.INCLUDE_PATH);
-		}
-		if (option != null) {
-			String[] includePaths = null;
-			try {
-				includePaths = option.getIncludePaths();
-			} catch (BuildException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
-			String[] newIncludePaths = add(includePaths, newIncludePath);
-			if (traceOn)
-				System.out.println("        add " + newIncludePath + " to existing includePaths: "
-						+ unroll(includePaths));
-			ManagedBuildManager.setOption(cf, cfTool, option, newIncludePaths);
-		}
-		else{
-			System.out.println("MPIProjectRunnable, no option for include paths found.");
-		}
-	}
-
-
-	/**
-	 * Add a new linker option.  Assumes that there is ONE instance of an option
-	 * of type <code>IOption.LIBRARY_PATHS</code> and <code>IOption.LIBRARIES</code>.
-	 * This method adds the libName and libPath to these two options.
-	 * @param cf the Configuration to which we want to add to linker options
-	 * @param libName the lib name (e.g. "lib")
-	 * @param libPath the library search path name (e.g. "c:/mypath/lib")
-	 * 
-	 */
-	private void addLinkerOpt(IConfiguration cf, String libName, String libPath) {
-		String ext = "o";
-		ITool cfTool = cf.getToolFromInputExtension(ext);
-
-		IOption lpOpt = getFirstOptionByType(cf, cfTool, IOption.LIBRARY_PATHS);
-		addOptionValue(cf, cfTool, lpOpt, libPath);
-
-		IOption libOpt = getFirstOptionByType(cf, cfTool, IOption.LIBRARIES);
-		addOptionValue(cf, cfTool, libOpt, libName);
-	}                                                                                                                     
-
-	
-	private void setCompileCommand(IConfiguration cf, String buildCmd) {
-		if(traceOn)System.out.println("compile cmd: "+buildCmd);
-		ITool compiler = cf.getToolFromInputExtension("c");
-		compiler.setToolCommand(buildCmd);
-		
-	}
-	private void setLinkCommand(IConfiguration cf, String buildCmd) {
-		if(traceOn)System.out.println("link cmd: "+buildCmd);
-		ITool linker=cf.getToolFromInputExtension("o");
-		linker.setToolCommand(buildCmd);
-		
-	}
-	
-	/**
-	 * Add a value to a multi-valued tool option<br>
-	 * (For example, add a path to include paths, or a lib to libraries list)
-	 * @param cf the Configuration
-	 * @param tool the tool in which to update the option
-	 * @param option the option to update 
-	 * @param value the new value to add to the list of existing values in the option
-	 */
-	private void addOptionValue(IConfiguration cf, ITool tool, IOption option, String value) {
-		try {
-			int type = option.getValueType();
-			String[] valueList = null;
-			switch (type) {
-			case IOption.INCLUDE_PATH:
-				valueList = option.getIncludePaths();
-				valueList = add(valueList,value);
-				break;
-			case IOption.LIBRARIES:
-				valueList = option.getLibraries();
-				valueList=addNotPath(valueList, value);
-				break;
-			case IOption.LIBRARY_PATHS:// this is type for library search path cdt 4.0 
-				valueList=option.getBasicStringListValue();
-				valueList=addNotPath(valueList,value);
-				break;
-			
-			default:
-				System.out.println("MPIProjectWizard runnable postprocessing (MPIProjectRunnable), can't get type of option for " + option.getName());
-				return;
-			}
-			// update the option in the managed builder options
-			ManagedBuildManager.setOption(cf, tool, option, valueList);
-
-		} catch (BuildException e) {
-			System.out.println("MPIProjectRunnable.addOptionValue(), "+e.getMessage());
-			System.out.println(e.getMessage());
-			e.printStackTrace();
-		}
-
-	}
-
-	/**
-	 * Print the options for a project.<br>
-	 * e.g. for Debug and Release configurations, get all the tools (compiler, linker etc.) then for each tool, 
-	 * get all the options and print them.
-	 * 
-	 * IResource resource= ... ;// can be any resource, I use project.
-     * IManagedBuildInfo mbo = ManagedBuildManager.getBuildInfo(resource);
-     * IManagedProject mp=mbo.getManagedProject();
-	 * <br>
-	 * This helps in figuring out what they are, and what you want to change.
-	 * Some sample output is at the bottom of this file.
-	 * 
-	 * @param proj the (managed) project for which print all this stuff.
-	 */
-	private void showOptions(IManagedProject proj) {
-		if(traceOn)System.out.println("Managed Project: "+proj.getName());
-		if(traceOn)System.out.println("Path.SEPARATOR="+Path.SEPARATOR);
-		if(traceOn)System.out.println("Path.DEVICE_SEPARATOR="+Path.DEVICE_SEPARATOR);
-		IConfiguration[] configs = proj.getConfigurations();
-		try {
-			for (int i = 0; i < configs.length; i++) {
-				IConfiguration cf = configs[i];
-				ITool[] allTools = cf.getTools();
-
-				int numTools = allTools.length;
-				System.out.println("Config " + i + ": " + cf.getName()+ " has "+numTools+" tools.");
-
-				for (int k = 0; k < allTools.length; k++) {
-					ITool tool = allTools[k];
-					System.out.println("  Tool " + k + ": " + tool.getName());
-					//boolean rc=tool.setToolCommand("foo");
-					String toolCmd=tool.getToolCommand();
-					String toolID=tool.getId();
-					System.out.println("  cmd="+toolCmd+"  toolID="+toolID);
-					
-					
-					IOption[] options = tool.getOptions();
-
-					for (int j = 0; j < options.length; j++) {
-						IOption opt = options[j];
-						String foundOptionID = opt.getId();
-						int type=opt.getValueType();
-						System.out.println("    option " + j + " " + opt.getName() + " id="
-								+ foundOptionID+"  type="+showType(type));
-						if(opt.getValueType()==IOption.INCLUDE_PATH) {
-							showIncludePaths(opt);
-						}
-					}
-				}
-
-				System.out.println("Config " + i + ": " + cf.getName()
-						+ "======= End of ALL tools ");
-				
-				// another way to access Tool
-				String ext = "c";
-				ITool cfTool = cf.getToolFromInputExtension(ext);
-				System.out.println("Tool by ext: " + ext + " is: " + cfTool.getName());
-				
-				// Look for include path
-				IOption option = getFirstOptionByType(cf, cfTool, IOption.INCLUDE_PATH);
-				if (option != null) {
-					String oname = option.getName();
-					System.out.println("Option " + option.getId() + " is " + oname);
-					showIncludePaths(option);
-				}
-				else System.out.println("No include path option found. ");
-
-			}
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-
-	}
-	private String showType(int type){
-		if(type==IOption.INCLUDE_PATH) return type+" (IOption.INCLUDE_PATH)";
-		if(type==IOption.LIBRARY_PATHS) return type+" (IOption.LIBRARY_PATHS)";
-		if(type==IOption.LIBRARIES)     return type+" (IOption.LIBRARIES)";
-		return type+" ";
-	}
-
-	/**
-	 * Display the list of include paths in an option which is presumed
-	 * to be the include paths option.
-	 * @param opt
-	 * @throws BuildException
-	 */
-	private void showIncludePaths(IOption opt) throws BuildException {
-		assert opt.getValueType() == IOption.INCLUDE_PATH ;
-		// if the option is a list of include paths, display them.
-		String[] includePaths = opt.getIncludePaths();
-		for (int index = 0; index < includePaths.length; index++) {
-			String path = includePaths[index];
-			System.out.println("   include path " + index + ": " + path);
-		}
-
-	}
-
-	/**
-	 * Add one or more paths to the list of paths
-	 * 
-	 * @param existingPaths the existing list of paths to add to
-	 * @param newPath the new path to add; may be >1 directory, with path delimiter java.io.File.pathSeparator 
-	 * (usually semicolon or colon)
-	 * @return the merged list
-	 */
-	private String[] add(String[] existingPaths, String newPath) {
-		String pathSep=java.io.File.pathSeparator;  // semicolon for windows, colon for Mac/Linux
-		List<String> newPathList = new ArrayList<String>();
-		String path;
-		for (int i = 0; i < existingPaths.length; i++) {
-			path = existingPaths[i];
-			newPathList.add(path);
-		}
-		String[] newPathArray=newPath.split(pathSep);
-		for (int i = 0; i < newPathArray.length; i++) {
-			path = newPathArray[i];
-			newPathList.add(path);
-		}
-		
-		String[] newArray=(String[])newPathList.toArray(new String[0]);
-		return newArray;
-		
-		/*
-
-		*/
-	}
-
-	/**
-	 * Add a single string to an array of strings
-	 * @param strList
-	 * @param newStr
-	 * @return
-	 */
-	private String[] addNotPath(String[] strList, String newStr) {
-		int len = strList.length;
-		String newList[] = new String[len + 1];
-		System.arraycopy(strList, 0, newList, 0, len);
-		newList[len] = newStr;
-		return newList;
-	}
-	/**
-	 * Simple string representation of items in a string array
-	 * @param list
-	 * @return
-	 */
-	private String unroll (String[] list){
-		StringBuffer result=new StringBuffer();
-		//list = new String[]{"one","two"};
-		//System.out.println(list);
-		for (int i = 0; i < list.length; i++) {
-			String string = list[i];
-			result.append(string);
-			result.append(", ");
-			
-			
-		}
-		if (result.length() > 2) {
-			result.delete(result.length() - 2, result.length() - 1);
-		}
-		return result.toString();
-	}
-	/**
-	 * Get the options of a specific type.<br>
-	 * We really need an ITool.getOptionsByType(int) so we don't have to do
-	 * this.
-	 * 
-	 * @param cf
-	 *            the IConfiguration in which to search
-	 * @param cfTool
-	 *            the ITool whose options are being searched
-	 * @param optionType
-	 *            the option type we are looking for, e.g. IOption.SOMETHING
-	 * @return
-	 */
-	private List<IOption> getOptionsByType(IConfiguration cf, ITool cfTool, int optionType) {
-
-		// run thru ALL options and check type for each, returning the ones that match
-		IOption[] allOptions = cfTool.getOptions();
-		List<IOption> foundOptions = new ArrayList<IOption>();
-
-		for (int i = 0; i < allOptions.length; i++) {
-			IOption option = allOptions[i];
-
-			int oType = 0;
-			try {
-				oType = option.getValueType();
-			} catch (BuildException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-				continue;
-			}
-			if (optionType == oType) {
-				// add it to the list
-				foundOptions.add(option);
-			}
-
-		}
-		//IOption[] ret= foundOptions.toArray(new IOption[foundOptions.size()]);
-		return foundOptions;
-	}
-	/**
-	 * Returns the <i>first</i> option of the specified type from the tool
-	 * @param cf
-	 * @param cfTool
-	 * @param optionType
-	 * @return
-	 */
-	private IOption getFirstOptionByType(IConfiguration cf, ITool cfTool, int optionType){
-		List<IOption> allOptions=getOptionsByType(cf,cfTool,optionType);
-		if(allOptions.size()>0){
-			return allOptions.get(0);
-		}
-		return null;
-	}
-
-}
-/**
- * 
- * Some sample tool data from showOptions() on Windows XP with cygwin Tool 1:
- * GCC C Compiler
- * <p>
- * 
- * option 0 Do not search system directories (-nostdinc)
- * id=gnu.c.compiler.option.preprocessor.nostdinc<br>
- * option 1 Preprocess only (-E)
- * id=gnu.c.compiler.option.preprocessor.preprocess<br>
- * option 2 Defined symbols (-D)
- * id=gnu.c.compiler.option.preprocessor.def.symbols<br>
- * option 3 Undefined symbols (-U)
- * id=gnu.c.compiler.option.preprocessor.undef.symbol<br>
- * option 4 Include paths (-I) id=gnu.c.compiler.option.include.paths<br>
- * option 5 Optimization Level
- * id=gnu.c.compiler.cygwin.exe.release.option.optimization.level<br>
- * option 6 Other optimization flags id=gnu.c.compiler.option.optimization.flags<br>
- * option 7 Debug Level
- * id=gnu.c.compiler.cygwin.exe.release.option.debugging.level<br>
- * option 8 Other debugging flags id=gnu.c.compiler.option.debugging.other<br>
- * option 9 Generate gprof information (-pg)
- * id=gnu.c.compiler.option.debugging.gprof<br>
- * option 10 Generate prof information (-p)
- * id=gnu.c.compiler.option.debugging.prof<br>
- * option 11 Check syntax only (-fsyntax-only)
- * id=gnu.c.compiler.option.warnings.syntax<br>
- * option 12 Pedantic (-pedantic) id=gnu.c.compiler.option.warnings.pedantic<br>
- * option 13 Pedantic warnings as errors (-pedantic-errors)
- * id=gnu.c.compiler.option.warnings.pedantic.error<br>
- * option 14 Inhibit all warnings (-w) id=gnu.c.compiler.option.warnings.nowarn<br>
- * option 15 All warnings (-Wall) id=gnu.c.compiler.option.warnings.allwarn<br>
- * option 16 Warnings as errors (-Werror)
- * id=gnu.c.compiler.option.warnings.toerrors<br>
- * option 17 Other flags id=gnu.c.compiler.option.misc.other<br>
- * option 18 Verbose (-v) id=gnu.c.compiler.option.misc.verbose<br>
- * option 19 Support ANSI programs (-ansi) id=gnu.c.compiler.option.misc.ansi<br>
- * 
- * Tool 2: GCC C Linker <br>
- * option 5 Libraries (-l) id=gnu.c.link.option.libs<br>
- * option 6 Library search path (-L) id=gnu.c.link.option.paths<br>
- * 
- */
-
Index: templates/OpenMPhelloWorldCproject/template.xml
===================================================================
RCS file: /cvsroot/tools/org.eclipse.ptp/tools/org.eclipse.ptp.pldt.wizards/templates/OpenMPhelloWorldCproject/template.xml,v
retrieving revision 1.2
diff -u -r1.2 template.xml
--- templates/OpenMPhelloWorldCproject/template.xml	7 Nov 2007 20:44:11 -0000	1.2
+++ templates/OpenMPhelloWorldCproject/template.xml	8 Nov 2007 12:09:01 -0000
@@ -61,9 +61,8 @@
 		</complex-array>
 	</process>
 
-	<process type="org.eclipse.ptp.pldt.wizards.storeInfo">
-		<simple name="projectName" value="$(projectName)"/>
-		<simple name="projectType" value="openMP_project"/>
+	<process type="org.eclipse.ptp.pldt.wizards.mpiProjectProcess">
+		<!-- no arguments as we go straight to the store (not recommended usage of template engine..) -->
 	</process>
 </template>
 
Index: plugin.xml
===================================================================
RCS file: /cvsroot/tools/org.eclipse.ptp/tools/org.eclipse.ptp.pldt.wizards/plugin.xml,v
retrieving revision 1.5
diff -u -r1.5 plugin.xml
--- plugin.xml	8 Nov 2007 03:46:26 -0000	1.5
+++ plugin.xml	8 Nov 2007 12:09:01 -0000
@@ -2,14 +2,6 @@
 <?eclipse version="3.0"?>
 <plugin>
 
-     <extension
-         point="org.eclipse.cdt.managedbuilder.ui.newWizardPages">
-      <wizardPage
-            ID="org.eclipse.ptp.pldt.wizards.wizardPages.MPIProjectWizardPage"
-            operationClass="org.eclipse.ptp.pldt.wizards.wizardPages.MPIProjectRunnable"
-            pageClass="org.eclipse.ptp.pldt.wizards.wizardPages.MPIProjectWizardPage"/>
-
-   </extension>
    
       <extension
          point="org.eclipse.cdt.core.templates">
@@ -17,27 +9,32 @@
             filterPattern=" "
             id="org.eclipse.ptp.pldt.projects.MPIhelloWorldCProject"
             location="templates/MPIhelloWorldCproject/template.xml"
+            pagesAfterTemplateSelectionProvider="org.eclipse.ptp.pldt.wizards.wizardPages.MPIProjectProcessPages"
             projectType="org.eclipse.cdt.build.core.buildArtefactType.exe">
       </template>
             <template
-            filterPattern=" "
-            id="org.eclipse.ptp.pldt.projects.MPIpiCProject"
-            location="templates/MPIpiCproject/template.xml"
-            projectType="org.eclipse.cdt.build.core.buildArtefactType.exe">
+                  filterPattern=" "
+                  id="org.eclipse.ptp.pldt.projects.MPIpiCProject"
+                  location="templates/MPIpiCproject/template.xml"
+                  pagesAfterTemplateSelectionProvider="org.eclipse.ptp.pldt.wizards.wizardPages.MPIProjectProcessPages"
+                  projectType="org.eclipse.cdt.build.core.buildArtefactType.exe">
       </template>
       <template
             id="org.eclipse.ptp.pldt.projects.MPIemptyCproject"
             location="templates/MPIemptyCproject/template.xml"
+            pagesAfterTemplateSelectionProvider="org.eclipse.ptp.pldt.wizards.wizardPages.MPIProjectProcessPages"
             projectType="org.eclipse.cdt.build.core.buildArtefactType.exe">
       </template>
          <template
-            id="org.eclipse.ptp.pldt.projects.OpenMPhelloWorldCProject"
-            location="templates/OpenMPhelloWorldCproject/template.xml"
-            projectType="org.eclipse.cdt.build.core.buildArtefactType.exe">
+               id="org.eclipse.ptp.pldt.projects.OpenMPhelloWorldCProject"
+               location="templates/OpenMPhelloWorldCproject/template.xml"
+               pagesAfterTemplateSelectionProvider="org.eclipse.ptp.pldt.wizards.wizardPages.MPIProjectProcessPages"
+               projectType="org.eclipse.cdt.build.core.buildArtefactType.exe">
       </template>
       <template
             id="org.eclipse.ptp.pldt.projects.OpenMPemptyCproject"
             location="templates/OpenMPemptyCproject/template.xml"
+            pagesAfterTemplateSelectionProvider="org.eclipse.ptp.pldt.wizards.wizardPages.MPIProjectProcessPages"
             projectType="org.eclipse.cdt.build.core.buildArtefactType.exe">
       </template>
    
@@ -45,15 +42,8 @@
       <extension
             point="org.eclipse.cdt.core.templateProcessTypes">
          <processType
-               name="storeInfo"
-               processRunner="org.eclipse.ptp.pldt.wizards.wizardPages.StoreInfoProcessRunner">
-                       <simple
-                  name="projectName">
-            </simple>
-            <simple
-                  name="projectType">
-            </simple>
-
+               name="mpiProjectProcess"
+               processRunner="org.eclipse.ptp.pldt.wizards.wizardPages.MPIProjectProcess">
          </processType>
       </extension>
 
Index: templates/MPIhelloWorldCproject/template.xml
===================================================================
RCS file: /cvsroot/tools/org.eclipse.ptp/tools/org.eclipse.ptp.pldt.wizards/templates/MPIhelloWorldCproject/template.xml,v
retrieving revision 1.2
diff -u -r1.2 template.xml
--- templates/MPIhelloWorldCproject/template.xml	7 Nov 2007 20:44:10 -0000	1.2
+++ templates/MPIhelloWorldCproject/template.xml	8 Nov 2007 12:09:01 -0000
@@ -60,9 +60,8 @@
 		</complex-array>
 	</process>
 	
-	<process type="org.eclipse.ptp.pldt.wizards.storeInfo">
-		<simple name="projectName" value="$(projectName)"/>
-		<simple name="projectType" value="mpi_project"/>
+	<process type="org.eclipse.ptp.pldt.wizards.mpiProjectProcess">
+		<!-- no arguments as we go straight to the store (not recommended usage of template engine..) -->
 	</process>
 
 </template>
Index: .settings/org.eclipse.jdt.core.prefs
===================================================================
RCS file: .settings/org.eclipse.jdt.core.prefs
diff -N .settings/org.eclipse.jdt.core.prefs
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ .settings/org.eclipse.jdt.core.prefs	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,12 @@
+#Thu Nov 08 10:20:04 GMT 2007
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Index: src/org/eclipse/ptp/pldt/wizards/wizardPages/MPIProjectProcess.java
===================================================================
RCS file: src/org/eclipse/ptp/pldt/wizards/wizardPages/MPIProjectProcess.java
diff -N src/org/eclipse/ptp/pldt/wizards/wizardPages/MPIProjectProcess.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/ptp/pldt/wizards/wizardPages/MPIProjectProcess.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,587 @@
+/*******************************************************************************
+ * Copyright (c) 2006,2007 IBM Corp. 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corp. - initial implementation
+ *******************************************************************************/
+
+package org.eclipse.ptp.pldt.wizards.wizardPages;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import org.eclipse.cdt.core.templateengine.TemplateCore;
+import org.eclipse.cdt.core.templateengine.process.ProcessArgument;
+import org.eclipse.cdt.core.templateengine.process.ProcessFailureException;
+import org.eclipse.cdt.core.templateengine.process.ProcessRunner;
+import org.eclipse.cdt.managedbuilder.core.BuildException;
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
+import org.eclipse.cdt.managedbuilder.core.IManagedProject;
+import org.eclipse.cdt.managedbuilder.core.IOption;
+import org.eclipse.cdt.managedbuilder.core.ITool;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.cdt.ui.wizards.CProjectWizard;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.ptp.pldt.wizards.MpiWizardsPlugin;
+import org.osgi.framework.Bundle;
+
+/**
+ * 
+ * After the MPIProjectWizardPage runs, and we get MPI include path from the user,
+ * we have this opportunity to use that information to modify the include paths etc.
+ * in the project
+ * 
+ * <p>Note: not sure we handle C++ projects correctly yet.
+ * 
+ * @author Beth Tibbitts
+ *
+ */
+public class MPIProjectProcess extends ProcessRunner {
+	private static final boolean traceOn=false;
+	private boolean wizTraceOn=MPIProjectWizardPage.wizardTraceOn;
+
+	private Map<String,String> valueStore;
+	
+	@Override
+	@SuppressWarnings("unchecked")
+	public void process(TemplateCore template, ProcessArgument[] args,
+			String processId, IProgressMonitor monitor)
+			throws ProcessFailureException {
+		if(wizTraceOn)System.out.println("MPIProjectRunnable().run()...");
+		
+		valueStore= template.getValueStore();
+		String pageID = MPIProjectWizardPage.PAGE_ID;
+		
+		String templateID= template.getTemplateId(); // TODO - is this enough instead of project type?
+		//		Object projectType=valueStore.get("projectType");
+		//		if(traceOn)System.out.println("  projectType="+projectType);
+
+		
+		Object obj = getNewPropValue(pageID, MPIProjectWizardPage.DO_MPI_INCLUDES, null);
+		boolean doMpiIncludes = MPIProjectWizardPage.getDefaultUseMpiIncludes();
+		if (obj != null)
+			doMpiIncludes = Boolean.valueOf((String) obj);
+		if (!doMpiIncludes) {
+			if (traceOn)
+				System.out.println("Do not save MPI info in this project.");
+			return;
+		}
+
+ 		CProjectWizard wiz=null;//cdt40  (cdt 3.1 was NewCProjectWizard)
+
+ 		// this process must be executed after a separate process which creates the project
+		IProject proj= ResourcesPlugin.getWorkspace().getRoot().getProject(valueStore.get("projectName"));
+		if(!proj.exists()) {
+			System.out.println("Project does not exist!. Quitting. No MPI info added to project.");
+			return;	
+		}
+
+		if(traceOn)System.out.println("Project: " + proj.getName());
+
+		// Collect the values that the user entered on the wizard page
+		String propID = MPIProjectWizardPage.INCLUDE_PATH_PROP_ID;
+		String newIncludePath = getNewPropValue(pageID, propID,"c:/mpich2/include");
+		if(traceOn)System.out.println("Got prop: "+propID+"="+newIncludePath);
+		
+		propID = MPIProjectWizardPage.LIB_PROP_ID;
+		String newLib=getNewPropValue(pageID,propID,"lib");
+		
+		propID=MPIProjectWizardPage.LIBRARY_SEARCH_PATH_PROP_ID;
+		String newLibSearchPath=getNewPropValue(pageID,propID,"c:/mpich2/lib");
+		
+		propID=MPIProjectWizardPage.MPI_COMPILE_COMMAND_PROP_ID;
+		String mpiCompileCommand=getNewPropValue(pageID,propID,"mpicc");
+		
+		propID=MPIProjectWizardPage.MPI_LINK_COMMAND_PROP_ID;
+		String mpiLinkCommand=getNewPropValue(pageID,propID,"mpicc");
+		
+		propID=MPIProjectWizardPage.MPI_SAMPLE_FILE_PROP_ID;
+		String mpiSampleFileInsert=getNewPropValue(pageID, propID, "false");
+ 
+		IManagedBuildInfo info = null;
+		try {
+			info = ManagedBuildManager.getBuildInfo(proj);
+			// note: assumed null if this is not a managed build project? will we get here in that case?
+			if(traceOn)System.out.println("Build info: " + info);
+		} catch (Exception e) {
+			System.out.println("MPIProjectRunnable.run(), "+e.getMessage());
+			e.printStackTrace();
+			return;
+		}
+		assert(info!=null);
+		
+		IManagedProject mProj = info.getManagedProject();
+		if(traceOn)showOptions(mProj);
+		
+		// add the include path & linker values to all the configurations
+		IConfiguration[] configs = mProj.getConfigurations();
+		for (int i = 0; i < configs.length; i++) {
+			IConfiguration cf = configs[i];
+			if(traceOn)System.out.println("Config " + i + ": " + cf.getName());
+			addIncludePath(cf, newIncludePath);
+			addLinkerOpt(cf,newLib,newLibSearchPath);
+			setCompileCommand(cf,mpiCompileCommand);
+			setLinkCommand(cf,mpiLinkCommand);		
+		}
+		if(traceOn)System.out.println("MPIProjectRunnable, newIncludePath: "+newIncludePath);
+		if(traceOn)System.out.println("   newLib: "+newLib+"  newLibSrchPth: "+newLibSearchPath);
+		if(traceOn)System.out.println("   compileCmd: "+mpiCompileCommand);
+		if(traceOn)System.out.println("   linkCmd: "+mpiLinkCommand);
+		// ManagedBuildManger.saveBuildInfo(...) assures that the
+		// values are persisted in the build model, otherwise they will
+		// be lost when you shut down Eclipse.
+		if(traceOn)System.out.println("ManagedBuildManager.saveBuildInfo...");
+		
+		if(mpiSampleFileInsert.equals("true")){
+			 try {
+				Bundle bundle = Platform.getBundle(MpiWizardsPlugin.getPluginId());
+				String sourceFilename="samples/testMPI.c";
+				String destFileName="testMPI.c";
+				Path path = new Path(sourceFilename);
+				URL fileURL = FileLocator.find(bundle, path, null);
+				InputStream destFileStream = null;
+				try {
+					destFileStream = fileURL.openStream();
+					proj.getFile(destFileName).create(destFileStream,false,null);
+					//System.out.println("file "+fname+" created.");
+				} catch (IOException e) {
+					System.out.println("Error creating file: "+destFileName);
+					//e.printStackTrace();
+				}
+			} catch (CoreException e) {
+				System.out.println("Error creating testMPI.c");
+				e.printStackTrace();
+			}
+		}
+		ManagedBuildManager.saveBuildInfo(proj, true);
+
+	}
+	public static String getResourceString(String key) {
+		ResourceBundle bundle = MpiWizardsPlugin.getDefault().getResourceBundle();
+		try {
+			return (bundle != null) ? bundle.getString(key) : key;
+		} catch (MissingResourceException e) {
+			return key;
+		}
+	}
+
+	/**
+	 * Get a value that was possibly obtained from the user on the associated wizard page.
+	 * @param pageID The pageID for our wizard page
+	 * @param propID The propID of the value we want
+	 * @param defaultVal The default value to use if the user didn't select anything,
+	 * or if we haven't gotten around to LETTING the user select anything yet.
+	 * @return
+	 */
+	private String getNewPropValue(String pageID, String propID, String defaultVal) {
+		Object obj = valueStore.get(pageID+MPIProjectWizardPage.DOT+propID);
+		// if selection made on page, obj is non-null.
+		String newValue = defaultVal;
+		String msg=" ( used default value)";
+		if (obj != null) {
+			newValue = obj.toString();
+			msg="";
+		}
+		if(traceOn)System.out.println("propID=" + propID + "  value=" + newValue+msg);
+		return newValue;
+	}
+
+
+	/**
+	 * Add an include path for C compiling to the existing include paths of the given
+	 * Configuration.  XLC is handled as a special case to find its include path option;
+	 * for other tools, we assume there is a single option for include paths, so we take
+	 * the first one.
+	 * 
+	 * @param cf
+	 *            the configuration of the project (e.g. Release, Debug, etc.)
+	 * @param newIncludePath
+	 *            include path(s) to add.  If more than one, separate by
+	 *            java.io.File.pathSeparator, which is semicolon for Windows, colon for Mac/Linux
+	 */
+	private void addIncludePath(IConfiguration cf, String newIncludePath) {
+		// note: could be > 1 path in 'newIncludePath'
+		String ext = "c";
+		ITool cfTool = cf.getToolFromInputExtension(ext);
+		// do we need to also handle c++ case as well?
+
+		String id = cfTool.getId(); // "cdt.managedbuild.tool.xlc.c.compiler.exe.debug.1423270745"
+		String name = cfTool.getName();// "XL C Compiler"
+		IOption option = null;
+		if (name.startsWith("XL C")) { // special case for XL C compiler
+			option = cfTool.getOptionById("xlc.c.compiler.option.include.paths");
+		} else { // otherwise we assume there is only one include path option.
+			option = getFirstOptionByType(cf, cfTool, IOption.INCLUDE_PATH);
+		}
+		if (option != null) {
+			String[] includePaths = null;
+			try {
+				includePaths = option.getIncludePaths();
+			} catch (BuildException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+			String[] newIncludePaths = add(includePaths, newIncludePath);
+			if (traceOn)
+				System.out.println("        add " + newIncludePath + " to existing includePaths: "
+						+ unroll(includePaths));
+			ManagedBuildManager.setOption(cf, cfTool, option, newIncludePaths);
+		}
+		else{
+			System.out.println("MPIProjectRunnable, no option for include paths found.");
+		}
+	}
+
+
+	/**
+	 * Add a new linker option.  Assumes that there is ONE instance of an option
+	 * of type <code>IOption.LIBRARY_PATHS</code> and <code>IOption.LIBRARIES</code>.
+	 * This method adds the libName and libPath to these two options.
+	 * @param cf the Configuration to which we want to add to linker options
+	 * @param libName the lib name (e.g. "lib")
+	 * @param libPath the library search path name (e.g. "c:/mypath/lib")
+	 * 
+	 */
+	private void addLinkerOpt(IConfiguration cf, String libName, String libPath) {
+		String ext = "o";
+		ITool cfTool = cf.getToolFromInputExtension(ext);
+
+		IOption lpOpt = getFirstOptionByType(cf, cfTool, IOption.LIBRARY_PATHS);
+		addOptionValue(cf, cfTool, lpOpt, libPath);
+
+		IOption libOpt = getFirstOptionByType(cf, cfTool, IOption.LIBRARIES);
+		addOptionValue(cf, cfTool, libOpt, libName);
+	}                                                                                                                     
+
+	
+	private void setCompileCommand(IConfiguration cf, String buildCmd) {
+		if(traceOn)System.out.println("compile cmd: "+buildCmd);
+		ITool compiler = cf.getToolFromInputExtension("c");
+		compiler.setToolCommand(buildCmd);
+		
+	}
+	private void setLinkCommand(IConfiguration cf, String buildCmd) {
+		if(traceOn)System.out.println("link cmd: "+buildCmd);
+		ITool linker=cf.getToolFromInputExtension("o");
+		linker.setToolCommand(buildCmd);
+		
+	}
+	
+	/**
+	 * Add a value to a multi-valued tool option<br>
+	 * (For example, add a path to include paths, or a lib to libraries list)
+	 * @param cf the Configuration
+	 * @param tool the tool in which to update the option
+	 * @param option the option to update 
+	 * @param value the new value to add to the list of existing values in the option
+	 */
+	private void addOptionValue(IConfiguration cf, ITool tool, IOption option, String value) {
+		try {
+			int type = option.getValueType();
+			String[] valueList = null;
+			switch (type) {
+			case IOption.INCLUDE_PATH:
+				valueList = option.getIncludePaths();
+				valueList = add(valueList,value);
+				break;
+			case IOption.LIBRARIES:
+				valueList = option.getLibraries();
+				valueList=addNotPath(valueList, value);
+				break;
+			case IOption.LIBRARY_PATHS:// this is type for library search path cdt 4.0 
+				valueList=option.getBasicStringListValue();
+				valueList=addNotPath(valueList,value);
+				break;
+			
+			default:
+				System.out.println("MPIProjectWizard runnable postprocessing (MPIProjectRunnable), can't get type of option for " + option.getName());
+				return;
+			}
+			// update the option in the managed builder options
+			ManagedBuildManager.setOption(cf, tool, option, valueList);
+
+		} catch (BuildException e) {
+			System.out.println("MPIProjectRunnable.addOptionValue(), "+e.getMessage());
+			System.out.println(e.getMessage());
+			e.printStackTrace();
+		}
+
+	}
+
+	/**
+	 * Print the options for a project.<br>
+	 * e.g. for Debug and Release configurations, get all the tools (compiler, linker etc.) then for each tool, 
+	 * get all the options and print them.
+	 * 
+	 * IResource resource= ... ;// can be any resource, I use project.
+     * IManagedBuildInfo mbo = ManagedBuildManager.getBuildInfo(resource);
+     * IManagedProject mp=mbo.getManagedProject();
+	 * <br>
+	 * This helps in figuring out what they are, and what you want to change.
+	 * Some sample output is at the bottom of this file.
+	 * 
+	 * @param proj the (managed) project for which print all this stuff.
+	 */
+	private void showOptions(IManagedProject proj) {
+		if(traceOn)System.out.println("Managed Project: "+proj.getName());
+		if(traceOn)System.out.println("Path.SEPARATOR="+Path.SEPARATOR);
+		if(traceOn)System.out.println("Path.DEVICE_SEPARATOR="+Path.DEVICE_SEPARATOR);
+		IConfiguration[] configs = proj.getConfigurations();
+		try {
+			for (int i = 0; i < configs.length; i++) {
+				IConfiguration cf = configs[i];
+				ITool[] allTools = cf.getTools();
+
+				int numTools = allTools.length;
+				System.out.println("Config " + i + ": " + cf.getName()+ " has "+numTools+" tools.");
+
+				for (int k = 0; k < allTools.length; k++) {
+					ITool tool = allTools[k];
+					System.out.println("  Tool " + k + ": " + tool.getName());
+					//boolean rc=tool.setToolCommand("foo");
+					String toolCmd=tool.getToolCommand();
+					String toolID=tool.getId();
+					System.out.println("  cmd="+toolCmd+"  toolID="+toolID);
+					
+					
+					IOption[] options = tool.getOptions();
+
+					for (int j = 0; j < options.length; j++) {
+						IOption opt = options[j];
+						String foundOptionID = opt.getId();
+						int type=opt.getValueType();
+						System.out.println("    option " + j + " " + opt.getName() + " id="
+								+ foundOptionID+"  type="+showType(type));
+						if(opt.getValueType()==IOption.INCLUDE_PATH) {
+							showIncludePaths(opt);
+						}
+					}
+				}
+
+				System.out.println("Config " + i + ": " + cf.getName()
+						+ "======= End of ALL tools ");
+				
+				// another way to access Tool
+				String ext = "c";
+				ITool cfTool = cf.getToolFromInputExtension(ext);
+				System.out.println("Tool by ext: " + ext + " is: " + cfTool.getName());
+				
+				// Look for include path
+				IOption option = getFirstOptionByType(cf, cfTool, IOption.INCLUDE_PATH);
+				if (option != null) {
+					String oname = option.getName();
+					System.out.println("Option " + option.getId() + " is " + oname);
+					showIncludePaths(option);
+				}
+				else System.out.println("No include path option found. ");
+
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+
+	}
+	private String showType(int type){
+		if(type==IOption.INCLUDE_PATH) return type+" (IOption.INCLUDE_PATH)";
+		if(type==IOption.LIBRARY_PATHS) return type+" (IOption.LIBRARY_PATHS)";
+		if(type==IOption.LIBRARIES)     return type+" (IOption.LIBRARIES)";
+		return type+" ";
+	}
+
+	/**
+	 * Display the list of include paths in an option which is presumed
+	 * to be the include paths option.
+	 * @param opt
+	 * @throws BuildException
+	 */
+	private void showIncludePaths(IOption opt) throws BuildException {
+		assert opt.getValueType() == IOption.INCLUDE_PATH ;
+		// if the option is a list of include paths, display them.
+		String[] includePaths = opt.getIncludePaths();
+		for (int index = 0; index < includePaths.length; index++) {
+			String path = includePaths[index];
+			System.out.println("   include path " + index + ": " + path);
+		}
+
+	}
+
+	/**
+	 * Add one or more paths to the list of paths
+	 * 
+	 * @param existingPaths the existing list of paths to add to
+	 * @param newPath the new path to add; may be >1 directory, with path delimiter java.io.File.pathSeparator 
+	 * (usually semicolon or colon)
+	 * @return the merged list
+	 */
+	private String[] add(String[] existingPaths, String newPath) {
+		String pathSep=java.io.File.pathSeparator;  // semicolon for windows, colon for Mac/Linux
+		List<String> newPathList = new ArrayList<String>();
+		String path;
+		for (int i = 0; i < existingPaths.length; i++) {
+			path = existingPaths[i];
+			newPathList.add(path);
+		}
+		String[] newPathArray=newPath.split(pathSep);
+		for (int i = 0; i < newPathArray.length; i++) {
+			path = newPathArray[i];
+			newPathList.add(path);
+		}
+		
+		String[] newArray=(String[])newPathList.toArray(new String[0]);
+		return newArray;
+		
+		/*
+
+		*/
+	}
+
+	/**
+	 * Add a single string to an array of strings
+	 * @param strList
+	 * @param newStr
+	 * @return
+	 */
+	private String[] addNotPath(String[] strList, String newStr) {
+		int len = strList.length;
+		String newList[] = new String[len + 1];
+		System.arraycopy(strList, 0, newList, 0, len);
+		newList[len] = newStr;
+		return newList;
+	}
+	/**
+	 * Simple string representation of items in a string array
+	 * @param list
+	 * @return
+	 */
+	private String unroll (String[] list){
+		StringBuffer result=new StringBuffer();
+		//list = new String[]{"one","two"};
+		//System.out.println(list);
+		for (int i = 0; i < list.length; i++) {
+			String string = list[i];
+			result.append(string);
+			result.append(", ");
+			
+			
+		}
+		if (result.length() > 2) {
+			result.delete(result.length() - 2, result.length() - 1);
+		}
+		return result.toString();
+	}
+	/**
+	 * Get the options of a specific type.<br>
+	 * We really need an ITool.getOptionsByType(int) so we don't have to do
+	 * this.
+	 * 
+	 * @param cf
+	 *            the IConfiguration in which to search
+	 * @param cfTool
+	 *            the ITool whose options are being searched
+	 * @param optionType
+	 *            the option type we are looking for, e.g. IOption.SOMETHING
+	 * @return
+	 */
+	private List<IOption> getOptionsByType(IConfiguration cf, ITool cfTool, int optionType) {
+
+		// run thru ALL options and check type for each, returning the ones that match
+		IOption[] allOptions = cfTool.getOptions();
+		List<IOption> foundOptions = new ArrayList<IOption>();
+
+		for (int i = 0; i < allOptions.length; i++) {
+			IOption option = allOptions[i];
+
+			int oType = 0;
+			try {
+				oType = option.getValueType();
+			} catch (BuildException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+				continue;
+			}
+			if (optionType == oType) {
+				// add it to the list
+				foundOptions.add(option);
+			}
+
+		}
+		//IOption[] ret= foundOptions.toArray(new IOption[foundOptions.size()]);
+		return foundOptions;
+	}
+	/**
+	 * Returns the <i>first</i> option of the specified type from the tool
+	 * @param cf
+	 * @param cfTool
+	 * @param optionType
+	 * @return
+	 */
+	private IOption getFirstOptionByType(IConfiguration cf, ITool cfTool, int optionType){
+		List<IOption> allOptions=getOptionsByType(cf,cfTool,optionType);
+		if(allOptions.size()>0){
+			return allOptions.get(0);
+		}
+		return null;
+	}
+}
+
+/**
+ * 
+ * Some sample tool data from showOptions() on Windows XP with cygwin Tool 1:
+ * GCC C Compiler
+ * <p>
+ * 
+ * option 0 Do not search system directories (-nostdinc)
+ * id=gnu.c.compiler.option.preprocessor.nostdinc<br>
+ * option 1 Preprocess only (-E)
+ * id=gnu.c.compiler.option.preprocessor.preprocess<br>
+ * option 2 Defined symbols (-D)
+ * id=gnu.c.compiler.option.preprocessor.def.symbols<br>
+ * option 3 Undefined symbols (-U)
+ * id=gnu.c.compiler.option.preprocessor.undef.symbol<br>
+ * option 4 Include paths (-I) id=gnu.c.compiler.option.include.paths<br>
+ * option 5 Optimization Level
+ * id=gnu.c.compiler.cygwin.exe.release.option.optimization.level<br>
+ * option 6 Other optimization flags id=gnu.c.compiler.option.optimization.flags<br>
+ * option 7 Debug Level
+ * id=gnu.c.compiler.cygwin.exe.release.option.debugging.level<br>
+ * option 8 Other debugging flags id=gnu.c.compiler.option.debugging.other<br>
+ * option 9 Generate gprof information (-pg)
+ * id=gnu.c.compiler.option.debugging.gprof<br>
+ * option 10 Generate prof information (-p)
+ * id=gnu.c.compiler.option.debugging.prof<br>
+ * option 11 Check syntax only (-fsyntax-only)
+ * id=gnu.c.compiler.option.warnings.syntax<br>
+ * option 12 Pedantic (-pedantic) id=gnu.c.compiler.option.warnings.pedantic<br>
+ * option 13 Pedantic warnings as errors (-pedantic-errors)
+ * id=gnu.c.compiler.option.warnings.pedantic.error<br>
+ * option 14 Inhibit all warnings (-w) id=gnu.c.compiler.option.warnings.nowarn<br>
+ * option 15 All warnings (-Wall) id=gnu.c.compiler.option.warnings.allwarn<br>
+ * option 16 Warnings as errors (-Werror)
+ * id=gnu.c.compiler.option.warnings.toerrors<br>
+ * option 17 Other flags id=gnu.c.compiler.option.misc.other<br>
+ * option 18 Verbose (-v) id=gnu.c.compiler.option.misc.verbose<br>
+ * option 19 Support ANSI programs (-ansi) id=gnu.c.compiler.option.misc.ansi<br>
+ * 
+ * Tool 2: GCC C Linker <br>
+ * option 5 Libraries (-l) id=gnu.c.link.option.libs<br>
+ * option 6 Library search path (-L) id=gnu.c.link.option.paths<br>
+ * 
+ */
+
Index: src/org/eclipse/ptp/pldt/wizards/wizardPages/MPIProjectProcessPages.java
===================================================================
RCS file: src/org/eclipse/ptp/pldt/wizards/wizardPages/MPIProjectProcessPages.java
diff -N src/org/eclipse/ptp/pldt/wizards/wizardPages/MPIProjectProcessPages.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/ptp/pldt/wizards/wizardPages/MPIProjectProcessPages.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,27 @@
+package org.eclipse.ptp.pldt.wizards.wizardPages;
+import org.eclipse.cdt.ui.templateengine.IPagesAfterTemplateSelectionProvider;
+import org.eclipse.cdt.ui.templateengine.IWizardDataPage;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWizard;
+
+
+public class MPIProjectProcessPages implements IPagesAfterTemplateSelectionProvider {
+	IWizardDataPage[] pages;
+	
+	public IWizardDataPage[] createAdditionalPages(IWorkbenchWizard wizard,
+			IWorkbench workbench, IStructuredSelection selection) {
+		try {
+			pages= new IWizardDataPage[] {new MPIProjectWizardPage()};
+			// TODO - log error
+		} catch(CoreException ce) {
+			pages= new IWizardDataPage[0];
+		}
+		return pages;
+	}
+
+	public IWizardDataPage[] getCreatedPages(IWorkbenchWizard wizard) {
+		return pages;
+	}
+}

Back to the top