mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-31 21:05:37 +02:00
Apply patch for PR 63973
Support of browseType for String options
This commit is contained in:
parent
0839371d4c
commit
1927cf14da
2 changed files with 54 additions and 11 deletions
|
@ -1,5 +1,5 @@
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* Copyright (c) 2003,2004 IBM Corporation and others.
|
* Copyright (c) 2003, 2005 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Common Public License v0.5
|
* are made available under the terms of the Common Public License v0.5
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -25,7 +25,10 @@ import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||||
import org.eclipse.jface.preference.BooleanFieldEditor;
|
import org.eclipse.jface.preference.BooleanFieldEditor;
|
||||||
import org.eclipse.jface.preference.FieldEditor;
|
import org.eclipse.jface.preference.FieldEditor;
|
||||||
import org.eclipse.jface.preference.StringFieldEditor;
|
import org.eclipse.jface.preference.StringFieldEditor;
|
||||||
|
import org.eclipse.jface.preference.DirectoryFieldEditor;
|
||||||
|
import org.eclipse.jface.preference.FileFieldEditor;
|
||||||
import org.eclipse.swt.graphics.Point;
|
import org.eclipse.swt.graphics.Point;
|
||||||
|
import java.lang.AssertionError;
|
||||||
|
|
||||||
public class BuildOptionSettingsPage extends BuildSettingsPage {
|
public class BuildOptionSettingsPage extends BuildSettingsPage {
|
||||||
private Map fieldsMap = new HashMap();
|
private Map fieldsMap = new HashMap();
|
||||||
|
@ -77,11 +80,39 @@ public class BuildOptionSettingsPage extends BuildSettingsPage {
|
||||||
// editor for it
|
// editor for it
|
||||||
switch (opt.getValueType()) {
|
switch (opt.getValueType()) {
|
||||||
case IOption.STRING :
|
case IOption.STRING :
|
||||||
StringFieldEditor stringField = new StringFieldEditor(
|
// fix for PR 63973
|
||||||
opt.getId(), opt.getName(), getFieldEditorParent());
|
// Check browse type.
|
||||||
addField(stringField);
|
// If browsing is set, use a field editor that has a browse button of
|
||||||
fieldsMap.put(opt.getId(), stringField);
|
// the appropriate type.
|
||||||
break;
|
// Otherwise, use a regular text field.
|
||||||
|
switch(opt.getBrowseType())
|
||||||
|
{
|
||||||
|
case IOption.BROWSE_DIR :
|
||||||
|
DirectoryFieldEditor dirFieldEditor = new DirectoryFieldEditor(
|
||||||
|
opt.getId(), opt.getName(), getFieldEditorParent());
|
||||||
|
addField(dirFieldEditor);
|
||||||
|
fieldsMap.put(opt.getId(), dirFieldEditor);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case IOption.BROWSE_FILE:
|
||||||
|
FileFieldEditor fileFieldEditor = new FileFieldEditor(
|
||||||
|
opt.getId(), opt.getName(), getFieldEditorParent());
|
||||||
|
addField(fileFieldEditor);
|
||||||
|
fieldsMap.put(opt.getId(), fileFieldEditor);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case IOption.BROWSE_NONE:
|
||||||
|
StringFieldEditor stringField = new StringFieldEditor(
|
||||||
|
opt.getId(), opt.getName(), getFieldEditorParent());
|
||||||
|
addField(stringField);
|
||||||
|
fieldsMap.put(opt.getId(), stringField);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// should not be possible
|
||||||
|
throw( new AssertionError()); }
|
||||||
|
// end fix for 63973
|
||||||
|
break;
|
||||||
case IOption.BOOLEAN :
|
case IOption.BOOLEAN :
|
||||||
BooleanFieldEditor booleanField = new BooleanFieldEditor(
|
BooleanFieldEditor booleanField = new BooleanFieldEditor(
|
||||||
opt.getId(), opt.getName(), getFieldEditorParent());
|
opt.getId(), opt.getName(), getFieldEditorParent());
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* Copyright (c) 2004 IBM Rational Software Corporation and others.
|
* Copyright (c) 2004, 2005 IBM Rational Software Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Common Public License v0.5
|
* are made available under the terms of the Common Public License v0.5
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -27,15 +27,27 @@ public abstract class BuildSettingsPage extends FieldEditorPreferencePage {
|
||||||
* @param style
|
* @param style
|
||||||
*/
|
*/
|
||||||
protected BuildSettingsPage(IConfiguration config) {
|
protected BuildSettingsPage(IConfiguration config) {
|
||||||
// Must be a grid layout and we don't want another set of buttons
|
// fix for PR 63973
|
||||||
super(GRID);
|
// If we use a grid layout then widgets that should be layed out horizontally,
|
||||||
|
// e.g. StringButtonFieldEditor, will have their component widgets
|
||||||
|
// arranged vertically. This looks terrible when you have for instance
|
||||||
|
// a StringButtonFieldEditor, which has a label, an edit box, and a "modify" button
|
||||||
|
// to the right because all three will be stacked vertically.
|
||||||
|
super(FLAT);
|
||||||
|
// end fix for 63973
|
||||||
noDefaultAndApplyButton();
|
noDefaultAndApplyButton();
|
||||||
configuration = config;
|
configuration = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected BuildSettingsPage(IResourceConfiguration resConfig) {
|
protected BuildSettingsPage(IResourceConfiguration resConfig) {
|
||||||
// Must be a grid layout and we don't want another set of buttons
|
// fix for PR 63973
|
||||||
super(GRID);
|
// If we use a grid layout then widgets that should be layed out horizontally,
|
||||||
|
// e.g. StringButtonFieldEditor, will have their component widgets
|
||||||
|
// arranged vertically. This looks terrible when you have for instance
|
||||||
|
// a StringButtonFieldEditor, which has a label, an edit box, and a "modify" button
|
||||||
|
// to the right because all three will be stacked vertically.
|
||||||
|
super(FLAT);
|
||||||
|
// end fix for 63973
|
||||||
noDefaultAndApplyButton();
|
noDefaultAndApplyButton();
|
||||||
this.resConfig = resConfig;
|
this.resConfig = resConfig;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue