mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Disable unnecessary isOptionVisible() check during page creation.
This commit is contained in:
parent
622b2739c3
commit
ba4b0ab3ed
1 changed files with 100 additions and 100 deletions
|
@ -121,114 +121,114 @@ public class BuildOptionSettingsUI extends AbstractToolSettingUI {
|
||||||
IOptionApplicability applicabilityCalculator = opt.getApplicabilityCalculator();
|
IOptionApplicability applicabilityCalculator = opt.getApplicabilityCalculator();
|
||||||
IBuildObject config = fInfo;
|
IBuildObject config = fInfo;
|
||||||
|
|
||||||
if (applicabilityCalculator == null || applicabilityCalculator.isOptionVisible(config, holder, opt)) {
|
// Check for (un)visibility is now performed in setFieldEditorEnablement()
|
||||||
|
// if (applicabilityCalculator == null || applicabilityCalculator.isOptionVisible(config, holder, opt))
|
||||||
|
// {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Figure out which type the option is and add a proper field
|
// Figure out which type the option is and add a proper field
|
||||||
// editor for it
|
// editor for it
|
||||||
Composite fieldEditorParent = getFieldEditorParent();
|
Composite fieldEditorParent = getFieldEditorParent();
|
||||||
FieldEditor fieldEditor;
|
FieldEditor fieldEditor;
|
||||||
|
|
||||||
switch (opt.getValueType()) {
|
switch (opt.getValueType()) {
|
||||||
case IOption.STRING: {
|
case IOption.STRING: {
|
||||||
StringFieldEditor stringField;
|
StringFieldEditor stringField;
|
||||||
|
|
||||||
// If browsing is set, use a field editor that has a
|
// If browsing is set, use a field editor that has a
|
||||||
// browse button of the appropriate type.
|
// browse button of the appropriate type.
|
||||||
switch (opt.getBrowseType()) {
|
switch (opt.getBrowseType()) {
|
||||||
case IOption.BROWSE_DIR: {
|
case IOption.BROWSE_DIR: {
|
||||||
stringField = new DirectoryFieldEditor(optId, opt.getName(), fieldEditorParent);
|
stringField = new DirectoryFieldEditor(optId, opt.getName(), fieldEditorParent);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case IOption.BROWSE_FILE: {
|
case IOption.BROWSE_FILE: {
|
||||||
stringField = new FileFieldEditor(optId, opt.getName(), fieldEditorParent);
|
stringField = new FileFieldEditor(optId, opt.getName(), fieldEditorParent);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case IOption.BROWSE_NONE: {
|
case IOption.BROWSE_NONE: {
|
||||||
final StringFieldEditorM local = new StringFieldEditorM(optId, opt.getName(), fieldEditorParent);
|
final StringFieldEditorM local = new StringFieldEditorM(optId, opt.getName(), fieldEditorParent);
|
||||||
stringField = local;
|
stringField = local;
|
||||||
local.getTextControl().addModifyListener(new ModifyListener() {
|
local.getTextControl().addModifyListener(new ModifyListener() {
|
||||||
public void modifyText(ModifyEvent e) {
|
public void modifyText(ModifyEvent e) {
|
||||||
local.valueChanged();
|
local.valueChanged();
|
||||||
}
|
|
||||||
});
|
|
||||||
} break;
|
|
||||||
|
|
||||||
default: {
|
|
||||||
throw new BuildException(null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
} break;
|
||||||
|
|
||||||
stringField.getTextControl(fieldEditorParent).setToolTipText(opt.getToolTip());
|
default: {
|
||||||
stringField.getLabelControl(fieldEditorParent).setToolTipText(opt.getToolTip());
|
throw new BuildException(null);
|
||||||
PlatformUI.getWorkbench().getHelpSystem().setHelp(stringField.getTextControl(fieldEditorParent), opt.getContextId());
|
}
|
||||||
fieldEditor = stringField;
|
|
||||||
} break;
|
|
||||||
|
|
||||||
case IOption.BOOLEAN: {
|
|
||||||
fieldEditor = new TriStateBooleanFieldEditor(
|
|
||||||
optId,
|
|
||||||
opt.getName(),
|
|
||||||
opt.getToolTip(),
|
|
||||||
fieldEditorParent,
|
|
||||||
opt.getContextId(),
|
|
||||||
ohs,
|
|
||||||
curr);
|
|
||||||
} break;
|
|
||||||
|
|
||||||
case IOption.ENUMERATED: {
|
|
||||||
String selId = opt.getSelectedEnum();
|
|
||||||
String sel = opt.getEnumName(selId);
|
|
||||||
|
|
||||||
// Get all applicable values for this enumerated Option, But display
|
|
||||||
// only the enumerated values that are valid (static set of enumerated values defined
|
|
||||||
// in the plugin.xml file) in the UI Combobox. This refrains the user from selecting an
|
|
||||||
// invalid value and avoids issuing an error message.
|
|
||||||
String[] enumNames = opt.getApplicableValues();
|
|
||||||
Vector<String> enumValidList = new Vector<String>();
|
|
||||||
for (int i = 0; i < enumNames.length; ++i) {
|
|
||||||
if (opt.getValueHandler().isEnumValueAppropriate(config,
|
|
||||||
opt.getOptionHolder(), opt, opt.getValueHandlerExtraArgument(), enumNames[i])) {
|
|
||||||
enumValidList.add(enumNames[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
String[] enumValidNames = new String[enumValidList.size()];
|
|
||||||
enumValidList.copyInto(enumValidNames);
|
|
||||||
|
|
||||||
fieldEditor = new BuildOptionComboFieldEditor(optId, opt.getName(), opt.getToolTip(), opt.getContextId(), enumValidNames, sel, fieldEditorParent);
|
|
||||||
} break;
|
|
||||||
|
|
||||||
case IOption.INCLUDE_PATH:
|
|
||||||
case IOption.STRING_LIST:
|
|
||||||
case IOption.PREPROCESSOR_SYMBOLS:
|
|
||||||
case IOption.LIBRARIES:
|
|
||||||
case IOption.OBJECTS:
|
|
||||||
case IOption.INCLUDE_FILES:
|
|
||||||
case IOption.LIBRARY_PATHS:
|
|
||||||
case IOption.LIBRARY_FILES:
|
|
||||||
case IOption.MACRO_FILES:
|
|
||||||
case IOption.UNDEF_INCLUDE_PATH:
|
|
||||||
case IOption.UNDEF_PREPROCESSOR_SYMBOLS:
|
|
||||||
case IOption.UNDEF_INCLUDE_FILES:
|
|
||||||
case IOption.UNDEF_LIBRARY_PATHS:
|
|
||||||
case IOption.UNDEF_LIBRARY_FILES:
|
|
||||||
case IOption.UNDEF_MACRO_FILES: {
|
|
||||||
fieldEditor = new FileListControlFieldEditor(optId, opt.getName(), opt.getToolTip(), opt.getContextId(), fieldEditorParent, opt.getBrowseType());
|
|
||||||
} break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
throw new BuildException(null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setFieldEditorEnablement(holder, opt, applicabilityCalculator, fieldEditor, fieldEditorParent);
|
stringField.getTextControl(fieldEditorParent).setToolTipText(opt.getToolTip());
|
||||||
|
stringField.getLabelControl(fieldEditorParent).setToolTipText(opt.getToolTip());
|
||||||
|
PlatformUI.getWorkbench().getHelpSystem().setHelp(stringField.getTextControl(fieldEditorParent), opt.getContextId());
|
||||||
|
fieldEditor = stringField;
|
||||||
|
} break;
|
||||||
|
|
||||||
addField(fieldEditor);
|
case IOption.BOOLEAN: {
|
||||||
fieldsMap.put(optId, fieldEditor);
|
fieldEditor = new TriStateBooleanFieldEditor(
|
||||||
fieldEditorsToParentMap.put(fieldEditor, fieldEditorParent);
|
optId,
|
||||||
|
opt.getName(),
|
||||||
|
opt.getToolTip(),
|
||||||
|
fieldEditorParent,
|
||||||
|
opt.getContextId(),
|
||||||
|
ohs,
|
||||||
|
curr);
|
||||||
|
} break;
|
||||||
|
|
||||||
} catch (BuildException e) {
|
case IOption.ENUMERATED: {
|
||||||
|
String selId = opt.getSelectedEnum();
|
||||||
|
String sel = opt.getEnumName(selId);
|
||||||
|
|
||||||
|
// Get all applicable values for this enumerated Option, But display
|
||||||
|
// only the enumerated values that are valid (static set of enumerated values defined
|
||||||
|
// in the plugin.xml file) in the UI Combobox. This refrains the user from selecting an
|
||||||
|
// invalid value and avoids issuing an error message.
|
||||||
|
String[] enumNames = opt.getApplicableValues();
|
||||||
|
Vector<String> enumValidList = new Vector<String>();
|
||||||
|
for (int i = 0; i < enumNames.length; ++i) {
|
||||||
|
if (opt.getValueHandler().isEnumValueAppropriate(config,
|
||||||
|
opt.getOptionHolder(), opt, opt.getValueHandlerExtraArgument(), enumNames[i])) {
|
||||||
|
enumValidList.add(enumNames[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String[] enumValidNames = new String[enumValidList.size()];
|
||||||
|
enumValidList.copyInto(enumValidNames);
|
||||||
|
|
||||||
|
fieldEditor = new BuildOptionComboFieldEditor(optId, opt.getName(), opt.getToolTip(), opt.getContextId(), enumValidNames, sel, fieldEditorParent);
|
||||||
|
} break;
|
||||||
|
|
||||||
|
case IOption.INCLUDE_PATH:
|
||||||
|
case IOption.STRING_LIST:
|
||||||
|
case IOption.PREPROCESSOR_SYMBOLS:
|
||||||
|
case IOption.LIBRARIES:
|
||||||
|
case IOption.OBJECTS:
|
||||||
|
case IOption.INCLUDE_FILES:
|
||||||
|
case IOption.LIBRARY_PATHS:
|
||||||
|
case IOption.LIBRARY_FILES:
|
||||||
|
case IOption.MACRO_FILES:
|
||||||
|
case IOption.UNDEF_INCLUDE_PATH:
|
||||||
|
case IOption.UNDEF_PREPROCESSOR_SYMBOLS:
|
||||||
|
case IOption.UNDEF_INCLUDE_FILES:
|
||||||
|
case IOption.UNDEF_LIBRARY_PATHS:
|
||||||
|
case IOption.UNDEF_LIBRARY_FILES:
|
||||||
|
case IOption.UNDEF_MACRO_FILES: {
|
||||||
|
fieldEditor = new FileListControlFieldEditor(optId, opt.getName(), opt.getToolTip(), opt.getContextId(), fieldEditorParent, opt.getBrowseType());
|
||||||
|
} break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new BuildException(null);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
setFieldEditorEnablement(holder, opt, applicabilityCalculator, fieldEditor, fieldEditorParent);
|
||||||
|
|
||||||
|
addField(fieldEditor);
|
||||||
|
fieldsMap.put(optId, fieldEditor);
|
||||||
|
fieldEditorsToParentMap.put(fieldEditor, fieldEditorParent);
|
||||||
|
|
||||||
|
} catch (BuildException e) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue