mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
RESOLVED - bug 201296: add support for XL C/C++ v9.0
https://bugs.eclipse.org/bugs/show_bug.cgi?id=201296
This commit is contained in:
parent
f9cb175dee
commit
853d98c8dd
17 changed files with 1674 additions and 132 deletions
|
@ -0,0 +1,22 @@
|
|||
#/*******************************************************************************
|
||||
# * Copyright (c) 2007 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
|
||||
# * http://www.eclipse.org/legal/epl-v10.html
|
||||
# *
|
||||
# * Contributors:
|
||||
# * IBM Corporation - initial API and implementation
|
||||
# *******************************************************************************/
|
||||
#Thu Sep 20 11:01:49 EDT 2007
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.4
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.4
|
||||
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=warning
|
||||
org.eclipse.jdt.core.compiler.source=1.4
|
|
@ -2,13 +2,17 @@ Manifest-Version: 1.0
|
|||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %pluginName
|
||||
Bundle-SymbolicName: org.eclipse.cdt.managedbuilder.xlc.ui; singleton := true
|
||||
Bundle-Version: 4.0.0.qualifier
|
||||
Bundle-Activator: org.eclipse.cdt.managedbuilder.xlc.ui.XlcUIPlugin
|
||||
Bundle-Version: 4.0.1.qualifier
|
||||
Bundle-Activator: org.eclipse.cdt.managedbuilder.xlc.ui.XLCUIPlugin
|
||||
Bundle-Localization: plugin
|
||||
Require-Bundle: org.eclipse.ui,
|
||||
org.eclipse.core.runtime,
|
||||
org.eclipse.cdt.managedbuilder.core,
|
||||
org.eclipse.cdt.core
|
||||
org.eclipse.cdt.core,
|
||||
org.eclipse.core.resources,
|
||||
org.eclipse.cdt.managedbuilder.ui,
|
||||
org.eclipse.cdt.ui,
|
||||
org.eclipse.ui.ide
|
||||
Eclipse-LazyStart: true
|
||||
Export-Package: org.eclipse.cdt.managedbuilder.xlc.ui
|
||||
Bundle-Vendor: %providerName
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2007 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
*******************************************************************************/
|
||||
pluginName = XL C/C++ Managed Build Plugin
|
||||
#/*******************************************************************************
|
||||
# * Copyright (c) 2006, 2007 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
|
||||
# * http://www.eclipse.org/legal/epl-v10.html
|
||||
# *
|
||||
# * Contributors:
|
||||
# * IBM Corporation - initial API and implementation
|
||||
# *******************************************************************************/
|
||||
pluginName = XL C/C++ Managed Build UI Plugin
|
||||
providerName = Eclipse.org
|
||||
|
||||
#Build model names
|
||||
|
@ -55,6 +55,7 @@ OptionCategory.Optimize=Optimization
|
|||
OptionCategory.Comp = Compatibility
|
||||
OptionCategory.Misc=Miscellaneous
|
||||
OptionCategory.Assembler=Assembler Options
|
||||
OptionCategory.General=General
|
||||
|
||||
|
||||
# generic names used by multiple options
|
||||
|
@ -119,6 +120,7 @@ Option.Trace=Preview the steps for compilation(-#)
|
|||
Option.bmaxdata=Maximum size of the area shared by the static data ans the heap (-bmaxdata=)
|
||||
Option.c=Pass the source files through compiler component only(-c)
|
||||
Option.PreprocOnly=Preprocess the source files and create an output preprocessed source file (-E)
|
||||
Option.PreprocRemoveComments=Remove comments from preprocessed output (-C!)
|
||||
Option.M=Create an output file that contains targets for the make command (-M)
|
||||
Option.ma=Substitute inline code for calls to alloca (-ma)
|
||||
Option.o=Specify an output location for the files created by the compiler (-o)
|
||||
|
@ -211,6 +213,7 @@ Option.optimization.arch.ppcgr = PowerPC
|
|||
Option.optimization.arch.ppc64gr = PowerPC® 64-bit with graphics instructions
|
||||
Option.optimization.arch.ppc64grsq = PowerPC® 64-bit with graphics and square root instructions
|
||||
Option.optimization.arch.ppc64v = PowerPC® 64-bit with AltiVec
|
||||
Option.optimization.tune = Specify the processor architecture to tune code for (-qtune=)
|
||||
Option.optimization.assert = Assert program behaviours (-qassert=)
|
||||
Option.optimization.Cache = Specify the cache configuration (-qcache=option1:option2:...:optionN)
|
||||
Option.compact = Avoid transformations that lead to code expansion (-qcompact)
|
||||
|
@ -304,7 +307,10 @@ Option.rndflt = Control compile-time rounding mode of floating point expressions
|
|||
Option.rndflt.nearest = Nearest
|
||||
Option.rndflt.minusinf = Minus infinity
|
||||
Option.rndflt.plusinf = Plus infinity
|
||||
Option.rndflt.zero = Zero
|
||||
Option.rndflt.zero = Zero
|
||||
Option.dfp = Decimal floating-point support for types and literals
|
||||
Option.dfp.enabled = Enabled (-qdfp)
|
||||
Option.dfp.disabled = Disabled (-qnodfp)
|
||||
|
||||
# Compiler Customization options
|
||||
Option.B = Determine substitute program path name (-B)
|
||||
|
@ -349,10 +355,12 @@ Option.xref = Produce a cross reference listing of identifiers (-qxref)
|
|||
Option.xref.noxref = Do not report identifiers in the program (-qnoxref)
|
||||
Option.xref.fullxref = Report all the identifiers in the program (-qxref = full)
|
||||
Option.xref.xref = Report only those identifiers which are used (-qxref)
|
||||
Option.warnfourcharconsts = Enable warning of four-character constants in source
|
||||
Option.warnfourcharconsts = Enable warning of four-character constants in source
|
||||
Option.report = Produce listing files that show how sections of code have been optimized (-qreport)
|
||||
|
||||
# Error Checking and Debugging
|
||||
Option.g = Generate debugging information (-g)
|
||||
Option.optdebug = Enable debugging of optimized code (-qoptdebug)
|
||||
Option.DebugLevel=Debug Level
|
||||
Option.Debug.Min=Minimal (-g1)
|
||||
Option.Debug.Def=Default (-g)
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,36 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.managedbuilder.xlc.ui;
|
||||
|
||||
import org.eclipse.osgi.util.NLS;
|
||||
|
||||
public class Messages extends NLS {
|
||||
private static final String BUNDLE_NAME = "org.eclipse.cdt.managedbuilder.xlc.ui.messages"; //$NON-NLS-1$
|
||||
public static String XLCompilerPreferencePage_0;
|
||||
public static String XLCompilerPreferencePage_1;
|
||||
public static String XLCompilerPreferencePage_2;
|
||||
public static String XLCompilerPropertyPage_0;
|
||||
public static String XLCompilerPropertyPage_1;
|
||||
public static String XLCSettingsWizardPage_0;
|
||||
public static String XLCSettingsWizardPage_1;
|
||||
public static String XLCSettingsWizardPage_2;
|
||||
public static String XLCSettingsWizardPage_3;
|
||||
public static String XLCSettingsWizardPage_4;
|
||||
public static String XLCSettingsWizardPage_5;
|
||||
static {
|
||||
// initialize resource bundle
|
||||
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
|
||||
}
|
||||
|
||||
private Messages() {
|
||||
}
|
||||
}
|
|
@ -0,0 +1,116 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.managedbuilder.xlc.ui;
|
||||
|
||||
import org.eclipse.cdt.core.cdtvariables.ICdtVariable;
|
||||
import org.eclipse.cdt.managedbuilder.core.IManagedProject;
|
||||
import org.eclipse.cdt.managedbuilder.internal.macros.BuildMacro;
|
||||
import org.eclipse.cdt.managedbuilder.macros.IBuildMacro;
|
||||
import org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider;
|
||||
import org.eclipse.cdt.managedbuilder.macros.IProjectBuildMacroSupplier;
|
||||
import org.eclipse.cdt.managedbuilder.xlc.ui.preferences.PreferenceConstants;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.QualifiedName;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
|
||||
/**
|
||||
* @author crecoskie
|
||||
*
|
||||
*/
|
||||
public class XLCProjectMacroSupplier implements IProjectBuildMacroSupplier {
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.macros.IProjectBuildMacroSupplier#getMacro(java.lang.String, org.eclipse.cdt.managedbuilder.core.IManagedProject, org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider)
|
||||
*/
|
||||
public IBuildMacro getMacro(String macroName, IManagedProject project,
|
||||
IBuildMacroProvider provider) {
|
||||
|
||||
if(macroName.equals(PreferenceConstants.P_XL_COMPILER_ROOT)) {
|
||||
String compilerPath = null;
|
||||
|
||||
// figure out compiler path from properties and preferences
|
||||
|
||||
// search for property first
|
||||
IProject theProject = (IProject) project.getOwner();
|
||||
try {
|
||||
compilerPath = theProject.getPersistentProperty(new QualifiedName("",
|
||||
PreferenceConstants.P_XL_COMPILER_ROOT));
|
||||
} catch (CoreException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if(compilerPath == null) {
|
||||
// use the workbench preference
|
||||
IPreferenceStore prefStore = XLCUIPlugin.getDefault().getPreferenceStore();
|
||||
compilerPath = prefStore.getString(PreferenceConstants.P_XL_COMPILER_ROOT);
|
||||
}
|
||||
|
||||
BuildMacro macro = new BuildMacro(macroName, ICdtVariable.VALUE_PATH_DIR,
|
||||
compilerPath);
|
||||
|
||||
return macro;
|
||||
}
|
||||
|
||||
else
|
||||
return provider.getMacro(macroName, IBuildMacroProvider.CONTEXT_PROJECT, project, true);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.macros.IProjectBuildMacroSupplier#getMacros(org.eclipse.cdt.managedbuilder.core.IManagedProject, org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider)
|
||||
*/
|
||||
public IBuildMacro[] getMacros(IManagedProject project,
|
||||
IBuildMacroProvider provider) {
|
||||
|
||||
String macroName = PreferenceConstants.P_XL_COMPILER_ROOT;
|
||||
|
||||
String compilerPath = null;
|
||||
|
||||
// figure out compiler path from properties and preferences
|
||||
|
||||
// search for property first
|
||||
IProject theProject = (IProject) project.getOwner();
|
||||
try {
|
||||
compilerPath = theProject.getPersistentProperty(new QualifiedName("",
|
||||
PreferenceConstants.P_XL_COMPILER_ROOT));
|
||||
} catch (CoreException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if(compilerPath == null) {
|
||||
// use the workbench preference
|
||||
IPreferenceStore prefStore = XLCUIPlugin.getDefault().getPreferenceStore();
|
||||
compilerPath = prefStore.getString(PreferenceConstants.P_XL_COMPILER_ROOT);
|
||||
}
|
||||
|
||||
BuildMacro macro = new BuildMacro(macroName, ICdtVariable.VALUE_PATH_DIR,
|
||||
compilerPath);
|
||||
|
||||
// our array consists of our macro, plus all the macros from our parent
|
||||
IBuildMacro[] parentMacros = provider.getMacros(IBuildMacroProvider.CONTEXT_PROJECT, project, true);
|
||||
|
||||
int numMacros = parentMacros.length + 1; // +1 for our macro
|
||||
|
||||
IBuildMacro[] macros = new IBuildMacro[numMacros];
|
||||
|
||||
macros[0] = macro;
|
||||
|
||||
for(int k = 1; k < macros.length; k++) {
|
||||
macros[k] = parentMacros[k-1];
|
||||
}
|
||||
|
||||
return macros;
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006 IBM Corporation and others.
|
||||
* Copyright (c) 2006 2007 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,22 +12,23 @@
|
|||
package org.eclipse.cdt.managedbuilder.xlc.ui;
|
||||
|
||||
import org.eclipse.core.runtime.Plugin;
|
||||
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
||||
import org.osgi.framework.BundleContext;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* The main plugin class to be used in the desktop.
|
||||
*/
|
||||
public class XlcUIPlugin extends Plugin {
|
||||
public class XLCUIPlugin extends AbstractUIPlugin {
|
||||
//The shared instance.
|
||||
private static XlcUIPlugin plugin;
|
||||
private static XLCUIPlugin plugin;
|
||||
//Resource bundle.
|
||||
private ResourceBundle resourceBundle;
|
||||
|
||||
/**
|
||||
* The constructor.
|
||||
*/
|
||||
public XlcUIPlugin() {
|
||||
public XLCUIPlugin() {
|
||||
super();
|
||||
plugin = this;
|
||||
}
|
||||
|
@ -51,7 +52,7 @@ public class XlcUIPlugin extends Plugin {
|
|||
/**
|
||||
* Returns the shared instance.
|
||||
*/
|
||||
public static XlcUIPlugin getDefault() {
|
||||
public static XLCUIPlugin getDefault() {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
|
@ -60,7 +61,7 @@ public class XlcUIPlugin extends Plugin {
|
|||
* or 'key' if not found.
|
||||
*/
|
||||
public static String getResourceString(String key) {
|
||||
ResourceBundle bundle = XlcUIPlugin.getDefault().getResourceBundle();
|
||||
ResourceBundle bundle = XLCUIPlugin.getDefault().getResourceBundle();
|
||||
try {
|
||||
return (bundle != null) ? bundle.getString(key) : key;
|
||||
} catch (MissingResourceException e) {
|
|
@ -0,0 +1,22 @@
|
|||
#/*******************************************************************************
|
||||
# * Copyright (c) 2007 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
|
||||
# * http://www.eclipse.org/legal/epl-v10.html
|
||||
# *
|
||||
# * Contributors:
|
||||
# * IBM Corporation - initial API and implementation
|
||||
# *******************************************************************************/
|
||||
|
||||
XLCompilerPreferencePage_0=XL C/C++ Compiler Preferences
|
||||
XLCompilerPreferencePage_1=Compiler Root Path:
|
||||
XLCompilerPreferencePage_2=Compiler Version:
|
||||
XLCompilerPropertyPage_0=Compiler Root Path:
|
||||
XLCompilerPropertyPage_1=Compiler Version:
|
||||
XLCSettingsWizardPage_0=XL C/C++ Settings
|
||||
XLCSettingsWizardPage_1=Compiler Root Path:
|
||||
XLCSettingsWizardPage_2=Browse...
|
||||
XLCSettingsWizardPage_3=Compiler Version:
|
||||
XLCSettingsWizardPage_4=Please select the path to your compiler, and the version of the compiler that you are using.
|
||||
XLCSettingsWizardPage_5=XL Compiler Settings
|
|
@ -0,0 +1,26 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.managedbuilder.xlc.ui.preferences;
|
||||
|
||||
/**
|
||||
* Constant definitions for plug-in preferences
|
||||
*/
|
||||
public class PreferenceConstants {
|
||||
|
||||
public static final String P_XL_COMPILER_ROOT = "XL_compilerRoot"; //$NON-NLS-1$
|
||||
|
||||
public static final String P_XLC_COMPILER_VERSION = "XLC_compilerVersion"; //$NON-NLS-1$
|
||||
|
||||
public static final String P_XL_COMPILER_VERSION_8_NAME = "v8.0"; //$NON-NLS-1$
|
||||
public static final String P_XL_COMPILER_VERSION_9_NAME = "v9.0"; //$NON-NLS-1$
|
||||
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.managedbuilder.xlc.ui.preferences;
|
||||
|
||||
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
|
||||
import org.eclipse.cdt.managedbuilder.xlc.ui.XLCUIPlugin;
|
||||
|
||||
/**
|
||||
* Class used to initialize default preference values.
|
||||
*/
|
||||
public class PreferenceInitializer extends AbstractPreferenceInitializer {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
|
||||
*/
|
||||
public void initializeDefaultPreferences() {
|
||||
IPreferenceStore store = XLCUIPlugin.getDefault().getPreferenceStore();
|
||||
store.setDefault(PreferenceConstants.P_XL_COMPILER_ROOT, "/opt/ibmcmp"); //$NON-NLS-1$
|
||||
store.setDefault(PreferenceConstants.P_XLC_COMPILER_VERSION, PreferenceConstants.P_XL_COMPILER_VERSION_8_NAME);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.managedbuilder.xlc.ui.preferences;
|
||||
|
||||
import org.eclipse.jface.preference.*;
|
||||
import org.eclipse.ui.IWorkbenchPreferencePage;
|
||||
import org.eclipse.ui.IWorkbench;
|
||||
import org.eclipse.cdt.managedbuilder.xlc.ui.Messages;
|
||||
import org.eclipse.cdt.managedbuilder.xlc.ui.XLCUIPlugin;
|
||||
|
||||
/**
|
||||
* This class represents a preference page that
|
||||
* is contributed to the Preferences dialog. By
|
||||
* subclassing <samp>FieldEditorPreferencePage</samp>, we
|
||||
* can use the field support built into JFace that allows
|
||||
* us to create a page that is small and knows how to
|
||||
* save, restore and apply itself.
|
||||
* <p>
|
||||
* This page is used to modify preferences only. They
|
||||
* are stored in the preference store that belongs to
|
||||
* the main plug-in class. That way, preferences can
|
||||
* be accessed directly via the preference store.
|
||||
*/
|
||||
|
||||
public class XLCompilerPreferencePage
|
||||
extends FieldEditorPreferencePage
|
||||
implements IWorkbenchPreferencePage {
|
||||
|
||||
public XLCompilerPreferencePage() {
|
||||
super(FLAT);
|
||||
setPreferenceStore(XLCUIPlugin.getDefault().getPreferenceStore());
|
||||
setDescription(Messages.XLCompilerPreferencePage_0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the field editors. Field editors are abstractions of
|
||||
* the common GUI blocks needed to manipulate various types
|
||||
* of preferences. Each field editor knows how to save and
|
||||
* restore itself.
|
||||
*/
|
||||
public void createFieldEditors() {
|
||||
addField(new DirectoryFieldEditor(PreferenceConstants.P_XL_COMPILER_ROOT,
|
||||
Messages.XLCompilerPreferencePage_1, getFieldEditorParent()));
|
||||
|
||||
String[][] versionEntries = {{PreferenceConstants.P_XL_COMPILER_VERSION_8_NAME, "v8.0"}, //$NON-NLS-1$
|
||||
{PreferenceConstants.P_XL_COMPILER_VERSION_9_NAME, "v9.0"}}; //$NON-NLS-1$
|
||||
|
||||
addField(new ComboFieldEditor(PreferenceConstants.P_XLC_COMPILER_VERSION,
|
||||
Messages.XLCompilerPreferencePage_2, versionEntries, getFieldEditorParent()));
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
|
||||
*/
|
||||
public void init(IWorkbench workbench) {
|
||||
}
|
||||
|
||||
}
|
|
@ -9,7 +9,7 @@
|
|||
* IBM Corporation - initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.managedbuilder.xlc.ui;
|
||||
package org.eclipse.cdt.managedbuilder.xlc.ui.properties;
|
||||
|
||||
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
|
||||
import org.eclipse.cdt.managedbuilder.core.IHoldsOptions;
|
|
@ -0,0 +1,163 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.managedbuilder.xlc.ui.properties;
|
||||
|
||||
import org.eclipse.cdt.managedbuilder.ui.properties.BuildOptionComboFieldEditor;
|
||||
import org.eclipse.cdt.managedbuilder.xlc.ui.Messages;
|
||||
import org.eclipse.cdt.managedbuilder.xlc.ui.XLCUIPlugin;
|
||||
import org.eclipse.cdt.managedbuilder.xlc.ui.preferences.PreferenceConstants;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.QualifiedName;
|
||||
import org.eclipse.jface.preference.DirectoryFieldEditor;
|
||||
import org.eclipse.jface.preference.FieldEditorPreferencePage;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.swt.widgets.Combo;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.ui.IWorkbenchPropertyPage;
|
||||
|
||||
public class XLCompilerPropertyPage extends FieldEditorPreferencePage implements IWorkbenchPropertyPage {
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
|
||||
*/
|
||||
protected void createFieldEditors() {
|
||||
|
||||
Composite parent = getFieldEditorParent();
|
||||
|
||||
fPathEditor = new DirectoryFieldEditor(PreferenceConstants.P_XL_COMPILER_ROOT,
|
||||
Messages.XLCompilerPropertyPage_0, parent);
|
||||
addField(fPathEditor);
|
||||
|
||||
IProject project = ((IResource) getElement()).getProject();
|
||||
|
||||
String currentPath = null;
|
||||
|
||||
try {
|
||||
currentPath = project.getPersistentProperty(new QualifiedName("", //$NON-NLS-1$
|
||||
PreferenceConstants.P_XL_COMPILER_ROOT));
|
||||
} catch (CoreException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if(currentPath == null) {
|
||||
// if the property isn't set, then use the workbench preference
|
||||
IPreferenceStore prefStore = XLCUIPlugin.getDefault().getPreferenceStore();
|
||||
currentPath = prefStore.getString(PreferenceConstants.P_XL_COMPILER_ROOT);
|
||||
}
|
||||
|
||||
fPathEditor.setStringValue(currentPath);
|
||||
|
||||
String[] versionEntries = {PreferenceConstants.P_XL_COMPILER_VERSION_8_NAME,
|
||||
PreferenceConstants.P_XL_COMPILER_VERSION_9_NAME};
|
||||
|
||||
Composite versionParent = getFieldEditorParent();
|
||||
|
||||
fVersionEditor = new BuildOptionComboFieldEditor(PreferenceConstants.P_XLC_COMPILER_VERSION,
|
||||
Messages.XLCompilerPropertyPage_1, null, versionEntries, null, versionParent);
|
||||
|
||||
addField(fVersionEditor);
|
||||
|
||||
String currentVersion = null;
|
||||
try {
|
||||
currentVersion = project.getPersistentProperty(new QualifiedName("", //$NON-NLS-1$
|
||||
PreferenceConstants.P_XLC_COMPILER_VERSION));
|
||||
} catch (CoreException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if(currentVersion == null) {
|
||||
// if the property isn't set, then use the workbench preference
|
||||
IPreferenceStore prefStore = XLCUIPlugin.getDefault().getPreferenceStore();
|
||||
currentVersion = prefStore.getString(PreferenceConstants.P_XLC_COMPILER_VERSION);
|
||||
}
|
||||
|
||||
Combo versionCombo = fVersionEditor.getComboControl(versionParent);
|
||||
versionCombo.setText(currentVersion);
|
||||
|
||||
}
|
||||
|
||||
private DirectoryFieldEditor fPathEditor;
|
||||
|
||||
private BuildOptionComboFieldEditor fVersionEditor;
|
||||
|
||||
//private Composite parent;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor for SamplePropertyPage.
|
||||
*/
|
||||
public XLCompilerPropertyPage() {
|
||||
super(FieldEditorPreferencePage.FLAT);
|
||||
}
|
||||
|
||||
|
||||
protected void performDefaults() {
|
||||
// default to whatever is set on the workbench preference
|
||||
IPreferenceStore prefStore = XLCUIPlugin.getDefault().getPreferenceStore();
|
||||
String currentPath = prefStore.getString(PreferenceConstants.P_XL_COMPILER_ROOT);
|
||||
String currentVersion = prefStore.getString(PreferenceConstants.P_XLC_COMPILER_VERSION);
|
||||
|
||||
fPathEditor.setStringValue(currentPath);
|
||||
|
||||
fVersionEditor.getComboControl(getFieldEditorParent()).setText(currentVersion);
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.preference.FieldEditorPreferencePage#performOk()
|
||||
*/
|
||||
public boolean performOk() {
|
||||
// store the value in the owner text field
|
||||
try {
|
||||
IProject project = ((IResource) getElement()).getProject();
|
||||
|
||||
project.setPersistentProperty(new QualifiedName("", //$NON-NLS-1$
|
||||
PreferenceConstants.P_XL_COMPILER_ROOT), fPathEditor
|
||||
.getStringValue());
|
||||
|
||||
project.setPersistentProperty(new QualifiedName("", //$NON-NLS-1$
|
||||
PreferenceConstants.P_XLC_COMPILER_VERSION), fVersionEditor
|
||||
.getSelection());
|
||||
} catch (CoreException e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* The element.
|
||||
*/
|
||||
private IAdaptable element;
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.eclipse.ui.IWorkbenchPropertyPage#getElement()
|
||||
*/
|
||||
public IAdaptable getElement() {
|
||||
return element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the element that owns properties shown on this page.
|
||||
*
|
||||
* @param element
|
||||
* the element
|
||||
*/
|
||||
public void setElement(IAdaptable element) {
|
||||
this.element = element;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,116 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.managedbuilder.xlc.ui.properties;
|
||||
|
||||
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
|
||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||
import org.eclipse.cdt.managedbuilder.core.IFolderInfo;
|
||||
import org.eclipse.cdt.managedbuilder.core.IHoldsOptions;
|
||||
import org.eclipse.cdt.managedbuilder.core.IManagedProject;
|
||||
import org.eclipse.cdt.managedbuilder.core.IOption;
|
||||
import org.eclipse.cdt.managedbuilder.core.IOptionApplicability;
|
||||
import org.eclipse.cdt.managedbuilder.xlc.ui.XLCUIPlugin;
|
||||
import org.eclipse.cdt.managedbuilder.xlc.ui.preferences.PreferenceConstants;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.QualifiedName;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
|
||||
/**
|
||||
* @author crecoskie
|
||||
*
|
||||
*/
|
||||
public class XLCv8ApplicabiltyCalculator implements IOptionApplicability {
|
||||
|
||||
private boolean isVersion8(IBuildObject configuration) {
|
||||
// first we check the preference for this project, if it exists
|
||||
if(configuration instanceof IConfiguration) {
|
||||
IConfiguration config = (IConfiguration) configuration;
|
||||
IManagedProject managedProject = config.getManagedProject();
|
||||
|
||||
IProject project = (IProject) managedProject.getOwner();
|
||||
|
||||
String currentVersion = null;
|
||||
try {
|
||||
currentVersion = project.getPersistentProperty(new QualifiedName("",
|
||||
PreferenceConstants.P_XLC_COMPILER_VERSION));
|
||||
} catch (CoreException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if(currentVersion == null) {
|
||||
// if the property isn't set, then use the workbench preference
|
||||
IPreferenceStore prefStore = XLCUIPlugin.getDefault().getPreferenceStore();
|
||||
currentVersion = prefStore.getString(PreferenceConstants.P_XLC_COMPILER_VERSION);
|
||||
}
|
||||
|
||||
if(currentVersion.equals(PreferenceConstants.P_XL_COMPILER_VERSION_8_NAME))
|
||||
return true;
|
||||
}
|
||||
|
||||
if(configuration instanceof IFolderInfo) {
|
||||
IFolderInfo folderInfo = (IFolderInfo) configuration;
|
||||
|
||||
IConfiguration config = folderInfo.getParent();
|
||||
|
||||
IManagedProject managedProject = config.getManagedProject();
|
||||
|
||||
IProject project = (IProject) managedProject.getOwner();
|
||||
|
||||
String currentVersion = null;
|
||||
try {
|
||||
currentVersion = project.getPersistentProperty(new QualifiedName("",
|
||||
PreferenceConstants.P_XLC_COMPILER_VERSION));
|
||||
} catch (CoreException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if(currentVersion == null) {
|
||||
// if the property isn't set, then use the workbench preference
|
||||
IPreferenceStore prefStore = XLCUIPlugin.getDefault().getPreferenceStore();
|
||||
currentVersion = prefStore.getString(PreferenceConstants.P_XLC_COMPILER_VERSION);
|
||||
}
|
||||
|
||||
if(currentVersion.equals(PreferenceConstants.P_XL_COMPILER_VERSION_8_NAME))
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.IOptionApplicability#isOptionEnabled(org.eclipse.cdt.managedbuilder.core.IBuildObject, org.eclipse.cdt.managedbuilder.core.IHoldsOptions, org.eclipse.cdt.managedbuilder.core.IOption)
|
||||
*/
|
||||
public boolean isOptionEnabled(IBuildObject configuration,
|
||||
IHoldsOptions holder, IOption option) {
|
||||
return isVersion8(configuration);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.IOptionApplicability#isOptionUsedInCommandLine(org.eclipse.cdt.managedbuilder.core.IBuildObject, org.eclipse.cdt.managedbuilder.core.IHoldsOptions, org.eclipse.cdt.managedbuilder.core.IOption)
|
||||
*/
|
||||
public boolean isOptionUsedInCommandLine(IBuildObject configuration,
|
||||
IHoldsOptions holder, IOption option) {
|
||||
return isVersion8(configuration);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.IOptionApplicability#isOptionVisible(org.eclipse.cdt.managedbuilder.core.IBuildObject, org.eclipse.cdt.managedbuilder.core.IHoldsOptions, org.eclipse.cdt.managedbuilder.core.IOption)
|
||||
*/
|
||||
public boolean isOptionVisible(IBuildObject configuration,
|
||||
IHoldsOptions holder, IOption option) {
|
||||
return isVersion8(configuration);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,119 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.managedbuilder.xlc.ui.properties;
|
||||
|
||||
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
|
||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||
import org.eclipse.cdt.managedbuilder.core.IFolderInfo;
|
||||
import org.eclipse.cdt.managedbuilder.core.IHoldsOptions;
|
||||
import org.eclipse.cdt.managedbuilder.core.IManagedProject;
|
||||
import org.eclipse.cdt.managedbuilder.core.IOption;
|
||||
import org.eclipse.cdt.managedbuilder.core.IOptionApplicability;
|
||||
import org.eclipse.cdt.managedbuilder.xlc.ui.XLCUIPlugin;
|
||||
import org.eclipse.cdt.managedbuilder.xlc.ui.preferences.PreferenceConstants;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.QualifiedName;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
|
||||
/**
|
||||
* @author crecoskie
|
||||
*
|
||||
* This applicability calculator hides/shows options that are specific to the XL compilers, v9.0
|
||||
*
|
||||
*/
|
||||
public class XLCv9ApplicabilityCalculator implements IOptionApplicability {
|
||||
|
||||
private boolean isVersion9(IBuildObject configuration) {
|
||||
// first we check the preference for this project, if it exists
|
||||
if(configuration instanceof IConfiguration) {
|
||||
IConfiguration config = (IConfiguration) configuration;
|
||||
IManagedProject managedProject = config.getManagedProject();
|
||||
|
||||
IProject project = (IProject) managedProject.getOwner();
|
||||
|
||||
String currentVersion = null;
|
||||
try {
|
||||
currentVersion = project.getPersistentProperty(new QualifiedName("",
|
||||
PreferenceConstants.P_XLC_COMPILER_VERSION));
|
||||
} catch (CoreException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if(currentVersion == null) {
|
||||
// if the property isn't set, then use the workbench preference
|
||||
IPreferenceStore prefStore = XLCUIPlugin.getDefault().getPreferenceStore();
|
||||
currentVersion = prefStore.getString(PreferenceConstants.P_XLC_COMPILER_VERSION);
|
||||
}
|
||||
|
||||
if(currentVersion.equals(PreferenceConstants.P_XL_COMPILER_VERSION_9_NAME))
|
||||
return true;
|
||||
}
|
||||
|
||||
if(configuration instanceof IFolderInfo) {
|
||||
IFolderInfo folderInfo = (IFolderInfo) configuration;
|
||||
|
||||
IConfiguration config = folderInfo.getParent();
|
||||
|
||||
IManagedProject managedProject = config.getManagedProject();
|
||||
|
||||
IProject project = (IProject) managedProject.getOwner();
|
||||
|
||||
String currentVersion = null;
|
||||
try {
|
||||
currentVersion = project.getPersistentProperty(new QualifiedName("",
|
||||
PreferenceConstants.P_XLC_COMPILER_VERSION));
|
||||
} catch (CoreException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if(currentVersion == null) {
|
||||
// if the property isn't set, then use the workbench preference
|
||||
IPreferenceStore prefStore = XLCUIPlugin.getDefault().getPreferenceStore();
|
||||
currentVersion = prefStore.getString(PreferenceConstants.P_XLC_COMPILER_VERSION);
|
||||
}
|
||||
|
||||
if(currentVersion.equals(PreferenceConstants.P_XL_COMPILER_VERSION_9_NAME))
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.IOptionApplicability#isOptionEnabled(org.eclipse.cdt.managedbuilder.core.IBuildObject, org.eclipse.cdt.managedbuilder.core.IHoldsOptions, org.eclipse.cdt.managedbuilder.core.IOption)
|
||||
*/
|
||||
public boolean isOptionEnabled(IBuildObject configuration,
|
||||
IHoldsOptions holder, IOption option) {
|
||||
return isVersion9(configuration);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.IOptionApplicability#isOptionUsedInCommandLine(org.eclipse.cdt.managedbuilder.core.IBuildObject, org.eclipse.cdt.managedbuilder.core.IHoldsOptions, org.eclipse.cdt.managedbuilder.core.IOption)
|
||||
*/
|
||||
public boolean isOptionUsedInCommandLine(IBuildObject configuration,
|
||||
IHoldsOptions holder, IOption option) {
|
||||
return isVersion9(configuration);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.IOptionApplicability#isOptionVisible(org.eclipse.cdt.managedbuilder.core.IBuildObject, org.eclipse.cdt.managedbuilder.core.IHoldsOptions, org.eclipse.cdt.managedbuilder.core.IOption)
|
||||
*/
|
||||
public boolean isOptionVisible(IBuildObject configuration,
|
||||
IHoldsOptions holder, IOption option) {
|
||||
return isVersion9(configuration);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,300 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.managedbuilder.xlc.ui.wizards;
|
||||
|
||||
import org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPage;
|
||||
import org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPageManager;
|
||||
import org.eclipse.cdt.managedbuilder.xlc.ui.Messages;
|
||||
import org.eclipse.cdt.managedbuilder.xlc.ui.XLCUIPlugin;
|
||||
import org.eclipse.cdt.managedbuilder.xlc.ui.preferences.PreferenceConstants;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Combo;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.DirectoryDialog;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
import org.eclipse.swt.events.ModifyEvent;
|
||||
import org.eclipse.swt.events.ModifyListener;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.events.SelectionListener;
|
||||
|
||||
/**
|
||||
* @author crecoskie
|
||||
*
|
||||
*/
|
||||
public class XLCSettingsWizardPage extends MBSCustomPage {
|
||||
|
||||
public static final String PAGE_ID = "org.eclipse.cdt.managedbuilder.xlc.ui.XlcSettingsWizardPage"; //$NON-NLS-1$
|
||||
|
||||
private final class BrowseButtonSelectionListener implements
|
||||
SelectionListener {
|
||||
private final Composite composite;
|
||||
|
||||
private BrowseButtonSelectionListener(Composite composite) {
|
||||
this.composite = composite;
|
||||
}
|
||||
|
||||
public void widgetDefaultSelected(SelectionEvent e) {
|
||||
// meaningless for a button... do nothing
|
||||
|
||||
}
|
||||
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
// open a browse dialog
|
||||
DirectoryDialog dirDialog = new DirectoryDialog(composite.getShell(), SWT.APPLICATION_MODAL);
|
||||
String browsedDirectory = dirDialog.open();
|
||||
fDirTextBox.setText(browsedDirectory);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private boolean fVisited = false;
|
||||
|
||||
private Composite fComposite = null;
|
||||
|
||||
private Text fDirTextBox;
|
||||
|
||||
private Combo fVersionCombo;
|
||||
|
||||
/**
|
||||
* @param pageID
|
||||
*/
|
||||
public XLCSettingsWizardPage(String pageID) {
|
||||
super(pageID);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public XLCSettingsWizardPage() {
|
||||
super(PAGE_ID);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPage#isCustomPageComplete()
|
||||
*/
|
||||
protected boolean isCustomPageComplete() {
|
||||
// Don't allow the user to finish without visiting the page.
|
||||
return fVisited;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.wizard.IWizardPage#getName()
|
||||
*/
|
||||
public String getName() {
|
||||
String name = Messages.XLCSettingsWizardPage_0;
|
||||
return name;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
|
||||
*/
|
||||
public void createControl(Composite parent) {
|
||||
// create a new composite
|
||||
fComposite = new Composite(parent, SWT.NONE);
|
||||
fComposite.setBounds(parent.getBounds());
|
||||
GridLayout layout = new GridLayout(3, false);
|
||||
fComposite.setLayout(layout);
|
||||
fComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
|
||||
|
||||
|
||||
// set the layout data for the first column, which contains labels
|
||||
GridData labelGridData = new GridData();
|
||||
|
||||
|
||||
// create the first label
|
||||
Label label1 = new Label(fComposite, SWT.NONE);
|
||||
label1.setText(Messages.XLCSettingsWizardPage_1);
|
||||
labelGridData.widthHint = 120;
|
||||
label1.setLayoutData(labelGridData);
|
||||
label1.setVisible(true);
|
||||
|
||||
// create the text box for the path
|
||||
GridData dirBoxGridData = new GridData();
|
||||
dirBoxGridData.grabExcessHorizontalSpace = true;
|
||||
dirBoxGridData.horizontalAlignment = SWT.FILL;
|
||||
fDirTextBox = new Text(fComposite, SWT.SINGLE | SWT.BORDER);
|
||||
fDirTextBox.setLayoutData(dirBoxGridData);
|
||||
fDirTextBox.setVisible(true);
|
||||
|
||||
// set the default compiler location based on preferences
|
||||
IPreferenceStore prefStore = XLCUIPlugin.getDefault().getPreferenceStore();
|
||||
String compilerPath = prefStore.getString(PreferenceConstants.P_XL_COMPILER_ROOT);
|
||||
fDirTextBox.setText(compilerPath);
|
||||
|
||||
// update the page manager with the setting
|
||||
MBSCustomPageManager.addPageProperty(PAGE_ID, 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());
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// create the browse button
|
||||
String selectedPath = null;
|
||||
GridData buttonData = new GridData();
|
||||
buttonData.horizontalAlignment = SWT.RIGHT;
|
||||
Button browseButton = new Button(fComposite, SWT.PUSH);
|
||||
browseButton.setAlignment(SWT.CENTER);
|
||||
browseButton.setText(Messages.XLCSettingsWizardPage_2);
|
||||
browseButton.addSelectionListener(new BrowseButtonSelectionListener(fComposite)
|
||||
);
|
||||
|
||||
browseButton.setVisible(true);
|
||||
|
||||
// create the second label
|
||||
Label label2 = new Label(fComposite, SWT.NONE);
|
||||
label2.setText(Messages.XLCSettingsWizardPage_3);
|
||||
label2.setLayoutData(labelGridData);
|
||||
|
||||
label2.setVisible(true);
|
||||
|
||||
// create the version dropdown
|
||||
GridData comboData = new GridData();
|
||||
comboData.horizontalSpan = 2;
|
||||
comboData.grabExcessHorizontalSpace = true;
|
||||
comboData.horizontalAlignment = SWT.FILL;
|
||||
|
||||
fVersionCombo = new Combo(fComposite, SWT.READ_ONLY);
|
||||
fVersionCombo.setLayoutData(comboData);
|
||||
|
||||
// populate the combo
|
||||
fVersionCombo.add(PreferenceConstants.P_XL_COMPILER_VERSION_8_NAME);
|
||||
fVersionCombo.add(PreferenceConstants.P_XL_COMPILER_VERSION_9_NAME);
|
||||
|
||||
// set the default based on the workbench preference
|
||||
String compilerVersion = prefStore.getString(PreferenceConstants.P_XLC_COMPILER_VERSION);
|
||||
fVersionCombo.setText(compilerVersion);
|
||||
|
||||
// update the page manager with the setting
|
||||
MBSCustomPageManager.addPageProperty(PAGE_ID, 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());
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
fVersionCombo.setVisible(true);
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.dialogs.IDialogPage#dispose()
|
||||
*/
|
||||
public void dispose() {
|
||||
fComposite.dispose();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.dialogs.IDialogPage#getControl()
|
||||
*/
|
||||
public Control getControl() {
|
||||
return fComposite;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.dialogs.IDialogPage#getDescription()
|
||||
*/
|
||||
public String getDescription() {
|
||||
return Messages.XLCSettingsWizardPage_4;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.dialogs.IDialogPage#getErrorMessage()
|
||||
*/
|
||||
public String getErrorMessage() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.dialogs.IDialogPage#getImage()
|
||||
*/
|
||||
public Image getImage() {
|
||||
return wizard.getDefaultPageImage();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.dialogs.IDialogPage#getMessage()
|
||||
*/
|
||||
public String getMessage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.dialogs.IDialogPage#getTitle()
|
||||
*/
|
||||
public String getTitle() {
|
||||
return Messages.XLCSettingsWizardPage_5;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.dialogs.IDialogPage#performHelp()
|
||||
*/
|
||||
public void performHelp() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.dialogs.IDialogPage#setDescription(java.lang.String)
|
||||
*/
|
||||
public void setDescription(String description) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.dialogs.IDialogPage#setImageDescriptor(org.eclipse.jface.resource.ImageDescriptor)
|
||||
*/
|
||||
public void setImageDescriptor(ImageDescriptor image) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.dialogs.IDialogPage#setTitle(java.lang.String)
|
||||
*/
|
||||
public void setTitle(String title) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.dialogs.IDialogPage#setVisible(boolean)
|
||||
*/
|
||||
public void setVisible(boolean visible) {
|
||||
fComposite.setVisible(visible);
|
||||
if (visible) {
|
||||
fVisited = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.managedbuilder.xlc.ui.wizards;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
import org.eclipse.cdt.ui.wizards.CDTCommonProjectWizard;
|
||||
import org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPageManager;
|
||||
import org.eclipse.cdt.managedbuilder.xlc.ui.preferences.PreferenceConstants;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.QualifiedName;
|
||||
import org.eclipse.jface.operation.IRunnableWithProgress;
|
||||
import org.eclipse.jface.wizard.IWizardPage;
|
||||
|
||||
/**
|
||||
* @author crecoskie
|
||||
*
|
||||
*/
|
||||
public class XLCSettingsWizardRunnable implements IRunnableWithProgress {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public XLCSettingsWizardRunnable() {
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor)
|
||||
*/
|
||||
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();
|
||||
|
||||
// get a handle to the wizard
|
||||
IWizardPage[] pages = MBSCustomPageManager.getPages();
|
||||
|
||||
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);
|
||||
|
||||
} catch (CoreException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue