From 01ce038d6f424c739ad3bfaeaf8b9e29e50928b0 Mon Sep 17 00:00:00 2001 From: Mike Kucera Date: Thu, 30 Apr 2009 19:54:36 +0000 Subject: [PATCH] [261232] update to XLC wizard so that it can be reused for UPC --- .../xlc/ui/wizards/XLCSettingsWizardPage.java | 10 ++--- .../ui/wizards/XLCSettingsWizardRunnable.java | 37 ++++++------------- 2 files changed, 17 insertions(+), 30 deletions(-) diff --git a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/wizards/XLCSettingsWizardPage.java b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/wizards/XLCSettingsWizardPage.java index b019827ea28..c07f44e32eb 100644 --- a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/wizards/XLCSettingsWizardPage.java +++ b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/wizards/XLCSettingsWizardPage.java @@ -131,20 +131,20 @@ public class XLCSettingsWizardPage extends MBSCustomPage { fDirTextBox.setText(compilerPath); // update the page manager with the setting - MBSCustomPageManager.addPageProperty(PAGE_ID, PreferenceConstants.P_XL_COMPILER_ROOT, fDirTextBox.getText()); + MBSCustomPageManager.addPageProperty(pageID, PreferenceConstants.P_XL_COMPILER_ROOT, fDirTextBox.getText()); fDirTextBox.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { // update the page manager with the setting - MBSCustomPageManager.addPageProperty(PAGE_ID, PreferenceConstants.P_XL_COMPILER_ROOT, fDirTextBox.getText()); + MBSCustomPageManager.addPageProperty(pageID, PreferenceConstants.P_XL_COMPILER_ROOT, fDirTextBox.getText()); } }); // create the browse button - String selectedPath = null; + //String selectedPath = null; GridData buttonData = new GridData(); buttonData.horizontalAlignment = SWT.RIGHT; Button browseButton = new Button(fComposite, SWT.PUSH); @@ -179,13 +179,13 @@ public class XLCSettingsWizardPage extends MBSCustomPage { fVersionCombo.setText(compilerVersion); // update the page manager with the setting - MBSCustomPageManager.addPageProperty(PAGE_ID, PreferenceConstants.P_XLC_COMPILER_VERSION, fVersionCombo.getText()); + MBSCustomPageManager.addPageProperty(pageID, PreferenceConstants.P_XLC_COMPILER_VERSION, fVersionCombo.getText()); fVersionCombo.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { // update the page manager with the setting - MBSCustomPageManager.addPageProperty(PAGE_ID, PreferenceConstants.P_XLC_COMPILER_VERSION, fVersionCombo.getText()); + MBSCustomPageManager.addPageProperty(pageID, PreferenceConstants.P_XLC_COMPILER_VERSION, fVersionCombo.getText()); } diff --git a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/wizards/XLCSettingsWizardRunnable.java b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/wizards/XLCSettingsWizardRunnable.java index 1f4bdad73fd..84d6b703bc5 100644 --- a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/wizards/XLCSettingsWizardRunnable.java +++ b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/wizards/XLCSettingsWizardRunnable.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 IBM Corporation and others. + * Copyright (c) 2007, 2009 IBM Corporation 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 @@ -12,9 +12,10 @@ package org.eclipse.cdt.managedbuilder.xlc.ui.wizards; import java.lang.reflect.InvocationTargetException; -import org.eclipse.cdt.ui.wizards.CDTCommonProjectWizard; +import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPageManager; import org.eclipse.cdt.managedbuilder.xlc.ui.preferences.PreferenceConstants; +import org.eclipse.cdt.ui.wizards.CDTCommonProjectWizard; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; @@ -28,21 +29,15 @@ import org.eclipse.jface.wizard.IWizardPage; */ public class XLCSettingsWizardRunnable implements IRunnableWithProgress { - /** - * - */ + protected String pageId = XLCSettingsWizardPage.PAGE_ID; + public XLCSettingsWizardRunnable() { - } - /* (non-Javadoc) - * @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor) - */ - public void run(IProgressMonitor monitor) throws InvocationTargetException, - InterruptedException { + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { // take the data from the page manager, and set the project properties with it - String compilerPath = MBSCustomPageManager.getPageProperty(XLCSettingsWizardPage.PAGE_ID, PreferenceConstants.P_XL_COMPILER_ROOT).toString(); - String compilerVersion = MBSCustomPageManager.getPageProperty(XLCSettingsWizardPage.PAGE_ID, PreferenceConstants.P_XLC_COMPILER_VERSION).toString(); + String compilerPath = MBSCustomPageManager.getPageProperty(pageId, PreferenceConstants.P_XL_COMPILER_ROOT).toString(); + String compilerVersion = MBSCustomPageManager.getPageProperty(pageId, PreferenceConstants.P_XLC_COMPILER_VERSION).toString(); // get a handle to the wizard IWizardPage[] pages = MBSCustomPageManager.getPages(); @@ -50,24 +45,16 @@ public class XLCSettingsWizardRunnable implements IRunnableWithProgress { if(pages != null && pages.length > 0) { CDTCommonProjectWizard wizard = (CDTCommonProjectWizard) pages[0].getWizard(); - IProject project = wizard.getLastProject(); try { - project.setPersistentProperty(new QualifiedName("", - PreferenceConstants.P_XL_COMPILER_ROOT), compilerPath); - - project.setPersistentProperty(new QualifiedName("", - PreferenceConstants.P_XLC_COMPILER_VERSION), compilerVersion); + project.setPersistentProperty(new QualifiedName("", PreferenceConstants.P_XL_COMPILER_ROOT), compilerPath); + project.setPersistentProperty(new QualifiedName("", PreferenceConstants.P_XLC_COMPILER_VERSION), compilerVersion); } catch (CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - + CCorePlugin.log(e); + } } - } }