1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-25 18:05:33 +02:00

Work to support new feature C1, "Set Tool Command in Project". Created a new preference page that has a single string field editor (for now) to edit the tool command. There is an externalized string for the label. Now that there are preference pages for tools and for options, and both are managed by the property page, the common logic for both preference pages have been refactored into a superclass.

In the property page, there is now logic for remembering what tool has been selected as well as what option. The property page now creates preference pages for tools and options.	

Updated the settings store to add tools as well as options.
	
Tweaked the logic of the tool/option list provider for the property page slightly to handle the case where the selection is a tool and 	not simply an option.
This commit is contained in:
Sean Evoy 2004-03-02 15:27:47 +00:00
parent 3948f17fa0
commit f16dd5d814
8 changed files with 344 additions and 141 deletions

View file

@ -1,3 +1,21 @@
2004-03-02 Sean Evoy
Work to support new feature C1, "Set Tool Command in Project".
Created a new preference page that has a single string field editor
(for now) to edit the tool command. There is an externalized string
for the label. Now that there are preference pages for tools and for
options, and both are managed by the property page, the common logic
for both preference pages have been refactored into a superclass.
In the property page, there is now logic for remembering what tool
has been selected as well as what option. The property page now
creates preference pages for tools and options.
Updated the settings store to add tools as well as options.
Tweaked the logic of the tool/option list provider for the property
page slightly to handle the case where the selection is a tool and
not simply an option.
2004-02-27 John Camelon
New built-in compiler incldue search paths and defined symbols for the
Gnu C++ compiler on Cygwin.

View file

@ -78,3 +78,6 @@ BuildPropertyCommon.label.addVar=Add
BuildPropertyCommon.label.message=Value:
BuildPropertyCommon.label.browse=Browse...
BuildPropertyCommon.label.configs=Defined configurations:
# ----------- Field Editors -----------
FieldEditors.tool.command=Command:

View file

@ -0,0 +1,134 @@
package org.eclipse.cdt.managedbuilder.ui.properties;
import org.eclipse.cdt.managedbuilder.core.BuildException;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IOption;
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.StringFieldEditor;
import org.eclipse.swt.graphics.Point;
public class BuildOptionSettingsPage extends BuildSettingsPage {
private IOptionCategory category;
BuildOptionSettingsPage(IConfiguration configuration, IOptionCategory category) {
// Cache the configuration and option category this page is created for
super(configuration);
this.category = category;
}
/* (non-Javadoc)
* @see org.eclipse.jface.preference.PreferencePage#computeSize()
*/
public Point computeSize() {
return super.computeSize();
}
/**
* @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
*/
protected void createFieldEditors() {
// Get the preference store for the build settings
super.createFieldEditors();
// Iterate over the options in the category and create a field editor for each
IOption[] options = category.getOptions(configuration);
for (int index = 0; index < options.length; ++index) {
// Get the option
IOption opt = options[index];
// Figure out which type the option is and add a proper field editor for it
switch (opt.getValueType()) {
case IOption.STRING :
StringFieldEditor stringField = new StringFieldEditor(opt.getId(), opt.getName(), getFieldEditorParent());
addField(stringField);
break;
case IOption.BOOLEAN :
BooleanFieldEditor booleanField = new BooleanFieldEditor(opt.getId(), opt.getName(), getFieldEditorParent());
addField(booleanField);
break;
case IOption.ENUMERATED :
String sel;
try {
sel = opt.getSelectedEnum();
} catch (BuildException e) {
// If we get this exception, then the option type is wrong
break;
}
BuildOptionComboFieldEditor comboField = new BuildOptionComboFieldEditor(opt.getId(), opt.getName(), opt.getApplicableValues(), sel, getFieldEditorParent());
addField(comboField);
break;
case IOption.STRING_LIST :
case IOption.INCLUDE_PATH :
case IOption.PREPROCESSOR_SYMBOLS :
case IOption.LIBRARIES :
case IOption.OBJECTS:
BuildOptionListFieldEditor listField = new BuildOptionListFieldEditor(opt.getId(), opt.getName(), getFieldEditorParent());
addField(listField);
break;
default :
SummaryFieldEditor summaryField = new SummaryFieldEditor(opt.getId(), opt.getName(), category.getTool(), getFieldEditorParent());
addField(summaryField);
break;
// default :
// break;
}
}
}
/**
* @param category
* @return
*/
public boolean isForCategory(IOptionCategory category) {
if (category != null) {
return category.equals(this.category);
}
return false;
}
/**
* @see IPreferencePage#performOk()
*/
public boolean performOk() {
// Write the field editor contents out to the preference store
boolean ok = super.performOk();
// Write the preference store values back to the build model
IOption[] options = category.getOptions(configuration);
for (int i = 0; i < options.length; i++) {
IOption option = options[i];
// Transfer value from preference store to options
switch (option.getValueType()) {
case IOption.BOOLEAN :
boolean boolVal = getPreferenceStore().getBoolean(option.getId());
ManagedBuildManager.setOption(configuration, option, boolVal);
break;
case IOption.ENUMERATED :
String enumVal = getPreferenceStore().getString(option.getId());
ManagedBuildManager.setOption(configuration, option, enumVal);
break;
case IOption.STRING :
String strVal = getPreferenceStore().getString(option.getId());
ManagedBuildManager.setOption(configuration, option, strVal);
break;
case IOption.STRING_LIST :
case IOption.INCLUDE_PATH :
case IOption.PREPROCESSOR_SYMBOLS :
case IOption.LIBRARIES :
case IOption.OBJECTS:
String listStr = getPreferenceStore().getString(option.getId());
String[] listVal = BuildToolsSettingsStore.parseString(listStr);
ManagedBuildManager.setOption(configuration, option, listVal);
break;
default :
break;
}
}
return ok;
}
}

View file

@ -106,11 +106,12 @@ public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropert
private ITarget selectedTarget;
private IConfiguration [] configurations;
private IConfiguration selectedConfiguration;
private BuildToolSettingsPage currentSettingsPage;
private BuildSettingsPage currentSettingsPage;
private Map configToPageListMap;
private BuildToolsSettingsStore settingsStore;
private IOptionCategory selectedCategory;
private Point lastShellSize;
private ITool selectedTool;
/**
* The minimum page size; 200 by 200 by default.
@ -279,7 +280,7 @@ public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropert
optionList.setLabelProvider(new ToolListLabelProvider());
}
/**
/* (non-Javadoc)
* Method displayOptionsForTool.
* @param toolReference
*/
@ -288,24 +289,26 @@ public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropert
if (category == selectedCategory) {
return;
}
selectedTool = null;
selectedCategory = category;
// Cache the current build setting page
BuildToolSettingsPage oldPage = currentSettingsPage;
BuildSettingsPage oldPage = currentSettingsPage;
currentSettingsPage = null;
// Create a new settings page if necessary
List pages = getPagesForConfig();
ListIterator iter = pages.listIterator();
while (iter.hasNext()) {
BuildToolSettingsPage page = (BuildToolSettingsPage) iter.next();
if (page.getCategory().equals(category)) {
BuildSettingsPage page = (BuildSettingsPage) iter.next();
if (page instanceof BuildOptionSettingsPage &&
((BuildOptionSettingsPage)page).isForCategory(category)) {
currentSettingsPage = page;
break;
}
}
if (currentSettingsPage == null) {
currentSettingsPage = new BuildToolSettingsPage(selectedConfiguration, category);
currentSettingsPage = new BuildOptionSettingsPage(selectedConfiguration, category);
pages.add(currentSettingsPage);
currentSettingsPage.setContainer(this);
if (currentSettingsPage.getControl() == null) {
@ -329,6 +332,57 @@ public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropert
settingsPageContainer.layout();
}
/* (non-Javadoc)
* @param tool
*/
private void displayOptionsForTool(ITool tool) {
if (tool == selectedTool) {
return;
}
// Unselect the category
selectedCategory = null;
// record that the tool selection has changed
selectedTool = tool;
// Cache the current build setting page
BuildSettingsPage oldPage = currentSettingsPage;
currentSettingsPage = null;
// Create a new page if we need one
List pages = getPagesForConfig();
ListIterator iter = pages.listIterator();
while (iter.hasNext()) {
BuildSettingsPage page = (BuildSettingsPage) iter.next();
if (page instanceof BuildToolSettingsPage &&
((BuildToolSettingsPage)page).isForTool(tool)) {
currentSettingsPage = page;
break;
}
}
if (currentSettingsPage == null) {
currentSettingsPage = new BuildToolSettingsPage(selectedConfiguration, tool);
pages.add(currentSettingsPage);
currentSettingsPage.setContainer(this);
if (currentSettingsPage.getControl() == null) {
currentSettingsPage.createControl(settingsPageContainer);
}
}
// Make all the other pages invisible
Control[] children = settingsPageContainer.getChildren();
Control currentControl = currentSettingsPage.getControl();
for (int i = 0; i < children.length; i++) {
if (children[i] != currentControl)
children[i].setVisible(false);
}
currentSettingsPage.setVisible(true);
if (oldPage != null)
oldPage.setVisible(false);
// Set the size of the scrolled area
containerSC.setMinSize(currentSettingsPage.computeSize());
settingsPageContainer.layout();
}
/* (non-Javadoc)
* @return an array of names for the configurations defined for the chosen target
*/
@ -523,7 +577,9 @@ public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropert
// Set the option page based on the selection
Object element = selection.getFirstElement();
if (element instanceof IOptionCategory) {
if (element instanceof ITool) {
displayOptionsForTool((ITool)element);
} else if (element instanceof IOptionCategory) {
displayOptionsForCategory((IOptionCategory)element);
}
}
@ -702,8 +758,12 @@ public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropert
List pages = getPagesForConfig();
ListIterator iter = pages.listIterator();
while (iter.hasNext()) {
BuildToolSettingsPage page = (BuildToolSettingsPage) iter.next();
page.performOk();
BuildSettingsPage page = (BuildSettingsPage) iter.next();
if (page instanceof BuildToolSettingsPage) {
((BuildToolSettingsPage)page).performOk();
} else if (page instanceof BuildOptionSettingsPage) {
((BuildOptionSettingsPage)page).performOk();
}
}
// Write out the build model info

View file

@ -0,0 +1,40 @@
package org.eclipse.cdt.managedbuilder.ui.properties;
/**********************************************************************
* Copyright (c) 2004 IBM Rational Software Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v05.html
*
* Contributors:
* IBM Rational Software - Initial API and implementation
* **********************************************************************/
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.IPreferenceStore;
public class BuildSettingsPage extends FieldEditorPreferencePage {
protected IConfiguration configuration;
/**
* @param style
*/
protected BuildSettingsPage(IConfiguration config) {
// Must be a grid layout and we don't want another set of buttons
super(GRID);
noDefaultAndApplyButton();
configuration = config;
}
/* (non-Javadoc)
* @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
*/
protected void createFieldEditors() {
// Get the preference store for the build settings
IPreferenceStore settings = getPreferenceStore();
setPreferenceStore(settings);
}
}

View file

@ -1,7 +1,7 @@
package org.eclipse.cdt.managedbuilder.ui.properties;
/**********************************************************************
* Copyright (c) 2002,2003 Rational Software Corporation and others.
* Copyright (c) 2004 IBM Rational Software Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
@ -11,140 +11,79 @@ package org.eclipse.cdt.managedbuilder.ui.properties;
* IBM Rational Software - Initial API and implementation
* **********************************************************************/
import org.eclipse.cdt.managedbuilder.core.BuildException;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IOption;
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.internal.core.ToolReference;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin;
import org.eclipse.jface.preference.StringFieldEditor;
import org.eclipse.swt.graphics.Point;
public class BuildToolSettingsPage extends FieldEditorPreferencePage {
public class BuildToolSettingsPage extends BuildSettingsPage {
// Field editor label
private static final String COMMAND = "FieldEditors.tool.command"; //$NON-NLS-1$
// Variables to help map this page back to an option category and tool
private IConfiguration configuration;
private IOptionCategory category;
// Tool the settings belong to
private ITool tool;
BuildToolSettingsPage(IConfiguration configuration, IOptionCategory category) {
// Must be a grid layout and we don't want another set of buttons
super(GRID);
noDefaultAndApplyButton();
// Cache the option category this page is created for
this.configuration = configuration;
this.category = category;
BuildToolSettingsPage(IConfiguration configuration, ITool tool) {
// Cache the configuration and tool this page is for
super(configuration);
this.tool = tool;
}
/* (non-Javadoc)
* @see org.eclipse.jface.preference.PreferencePage#computeSize()
*/
public Point computeSize() {
// TODO Auto-generated method stub
return super.computeSize();
}
/**
/* (non-Javadoc)
* @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
*/
protected void createFieldEditors() {
// Get the preference store for the build settings
IPreferenceStore settings = getPreferenceStore();
setPreferenceStore(settings);
// Iterate over the options in the category and create a field editor for each
IOption[] options = category.getOptions(configuration);
for (int index = 0; index < options.length; ++index) {
// Get the option
IOption opt = options[index];
// Figure out which type the option is and add a proper field editor for it
switch (opt.getValueType()) {
case IOption.STRING :
StringFieldEditor stringField = new StringFieldEditor(opt.getId(), opt.getName(), getFieldEditorParent());
addField(stringField);
break;
case IOption.BOOLEAN :
BooleanFieldEditor booleanField = new BooleanFieldEditor(opt.getId(), opt.getName(), getFieldEditorParent());
addField(booleanField);
break;
case IOption.ENUMERATED :
String sel;
try {
sel = opt.getSelectedEnum();
} catch (BuildException e) {
// If we get this exception, then the option type is wrong
break;
}
BuildOptionComboFieldEditor comboField = new BuildOptionComboFieldEditor(opt.getId(), opt.getName(), opt.getApplicableValues(), sel, getFieldEditorParent());
addField(comboField);
break;
case IOption.STRING_LIST :
case IOption.INCLUDE_PATH :
case IOption.PREPROCESSOR_SYMBOLS :
case IOption.LIBRARIES :
case IOption.OBJECTS:
BuildOptionListFieldEditor listField = new BuildOptionListFieldEditor(opt.getId(), opt.getName(), getFieldEditorParent());
addField(listField);
break;
default :
SummaryFieldEditor summaryField = new SummaryFieldEditor(opt.getId(), opt.getName(), category.getTool(), getFieldEditorParent());
addField(summaryField);
break;
// default :
// break;
}
}
// Load up the preference store
super.createFieldEditors();
// Add a string editor to edit the tool command
StringFieldEditor stringField = new StringFieldEditor(tool.getId(), ManagedBuilderUIPlugin.getResourceString(COMMAND), getFieldEditorParent());
stringField.setEmptyStringAllowed(false);
addField(stringField);
}
/**
* @return the option category the page was created for
* Answers <code>true</code> if the receiver manages settings for the argument
*
* @param tool
* @return
*/
public IOptionCategory getCategory() {
return category;
public boolean isForTool(ITool tool) {
if (tool != null) {
return tool.equals(this.tool);
}
return false;
}
/**
* @see IPreferencePage#performOk()
/* (non-Javadoc)
* @see org.eclipse.jface.preference.FieldEditorPreferencePage#performOk()
*/
public boolean performOk() {
// Write the field editor contents out to the preference store
boolean ok = super.performOk();
// Write the preference store values back to the build model
IOption[] options = category.getOptions(configuration);
for (int i = 0; i < options.length; i++) {
IOption option = options[i];
// Transfer value from preference store to options
switch (option.getValueType()) {
case IOption.BOOLEAN :
boolean boolVal = getPreferenceStore().getBoolean(option.getId());
ManagedBuildManager.setOption(configuration, option, boolVal);
break;
case IOption.ENUMERATED :
String enumVal = getPreferenceStore().getString(option.getId());
ManagedBuildManager.setOption(configuration, option, enumVal);
break;
case IOption.STRING :
String strVal = getPreferenceStore().getString(option.getId());
ManagedBuildManager.setOption(configuration, option, strVal);
break;
case IOption.STRING_LIST :
case IOption.INCLUDE_PATH :
case IOption.PREPROCESSOR_SYMBOLS :
case IOption.LIBRARIES :
case IOption.OBJECTS:
String listStr = getPreferenceStore().getString(option.getId());
String[] listVal = BuildToolsSettingsStore.parseString(listStr);
ManagedBuildManager.setOption(configuration, option, listVal);
break;
default :
break;
}
// Do the super-class thang
boolean result = super.performOk();
// Get the actual value out of the field editor
String command = getPreferenceStore().getString(tool.getId());
if (command.length() == 0) {
return result;
}
return ok;
// The tool may be a reference.
if (tool instanceof ToolReference) {
// If so, just set the command in the reference
((ToolReference)tool).setToolCommand(command);
} else {
configuration.setToolCommand(tool, command);
}
return result;
}
}

View file

@ -31,7 +31,7 @@ public class BuildToolsSettingsStore implements IPreferenceStore {
// List of listeners on the property store
private ListenerList listenerList;
private Map optionMap;
private Map settingsMap;
private boolean dirtyFlag;
private IConfiguration owner;
@ -41,7 +41,7 @@ public class BuildToolsSettingsStore implements IPreferenceStore {
owner = config;
// Now populate the options map
populateOptionMap();
populateSettingsMap();
}
@ -56,7 +56,7 @@ public class BuildToolsSettingsStore implements IPreferenceStore {
* @see org.eclipse.jface.preference.IPreferenceStore#contains(java.lang.String)
*/
public boolean contains(String name) {
return getOptionMap().containsKey(name);
return getSettingsMap().containsKey(name);
}
/**
@ -98,7 +98,7 @@ public class BuildToolsSettingsStore implements IPreferenceStore {
* @see org.eclipse.jface.preference.IPreferenceStore#getBoolean(java.lang.String)
*/
public boolean getBoolean(String name) {
Object b = getOptionMap().get(name);
Object b = getSettingsMap().get(name);
if (b instanceof Boolean)
{
return ((Boolean)b).booleanValue();
@ -182,11 +182,11 @@ public class BuildToolsSettingsStore implements IPreferenceStore {
*
* @return
*/
private Map getOptionMap() {
if (optionMap == null) {
optionMap = new HashMap();
private Map getSettingsMap() {
if (settingsMap == null) {
settingsMap = new HashMap();
}
return optionMap;
return settingsMap;
}
private void getOptionsForCategory(IOptionCategory cat) {
@ -210,12 +210,12 @@ public class BuildToolsSettingsStore implements IPreferenceStore {
// Exception occurs if there's an option value type mismatch
break;
}
getOptionMap().put(name, value);
getSettingsMap().put(name, value);
break;
case IOption.ENUMERATED :
value = createList(opt.getApplicableValues());
getOptionMap().put(name, value);
getSettingsMap().put(name, value);
break;
case IOption.STRING :
@ -224,7 +224,7 @@ public class BuildToolsSettingsStore implements IPreferenceStore {
} catch (BuildException e) {
break;
}
getOptionMap().put(name, value);
getSettingsMap().put(name, value);
break;
case IOption.STRING_LIST :
@ -233,7 +233,7 @@ public class BuildToolsSettingsStore implements IPreferenceStore {
} catch (BuildException e) {
break;
}
getOptionMap().put(name, value);
getSettingsMap().put(name, value);
break;
case IOption.INCLUDE_PATH :
try {
@ -241,7 +241,7 @@ public class BuildToolsSettingsStore implements IPreferenceStore {
} catch (BuildException e) {
break;
}
getOptionMap().put(name, value);
getSettingsMap().put(name, value);
break;
case IOption.PREPROCESSOR_SYMBOLS :
try {
@ -249,7 +249,7 @@ public class BuildToolsSettingsStore implements IPreferenceStore {
} catch (BuildException e) {
break;
}
getOptionMap().put(name, value);
getSettingsMap().put(name, value);
break;
case IOption.LIBRARIES :
try {
@ -257,7 +257,7 @@ public class BuildToolsSettingsStore implements IPreferenceStore {
} catch (BuildException e) {
break;
}
getOptionMap().put(name, value);
getSettingsMap().put(name, value);
break;
case IOption.OBJECTS :
try {
@ -265,7 +265,7 @@ public class BuildToolsSettingsStore implements IPreferenceStore {
} catch (BuildException e) {
break;
}
getOptionMap().put(name, value);
getSettingsMap().put(name, value);
break;
default :
break;
@ -277,7 +277,7 @@ public class BuildToolsSettingsStore implements IPreferenceStore {
* @see org.eclipse.jface.preference.IPreferenceStore#getString(java.lang.String)
*/
public String getString(String name) {
Object s = getOptionMap().get(name);
Object s = getSettingsMap().get(name);
if ( s instanceof String )
{
@ -312,11 +312,15 @@ public class BuildToolsSettingsStore implements IPreferenceStore {
/**
*
*/
private void populateOptionMap() {
private void populateSettingsMap() {
// Each configuration has a list of tools
ITool [] tools = owner.getTools();
for (int index = 0; index < tools.length; ++index) {
// Add the tool to the map
ITool tool = tools[index];
getSettingsMap().put(tool.getId(), tool.getToolCommand());
// Add the options defined for the tool
IOptionCategory cat = tool.getTopOptionCategory();
getOptionsForCategory(cat);
}
@ -326,10 +330,10 @@ public class BuildToolsSettingsStore implements IPreferenceStore {
* @see org.eclipse.jface.preference.IPreferenceStore#putValue(java.lang.String, java.lang.String)
*/
public void putValue(String name, String value) {
Object oldValue = getOptionMap().get(name);
Object oldValue = getSettingsMap().get(name);
if (oldValue == null || !oldValue.equals(value))
{
getOptionMap().put(name, value);
getSettingsMap().put(name, value);
setDirty(true);
}
}
@ -418,7 +422,7 @@ public class BuildToolsSettingsStore implements IPreferenceStore {
Object oldValue = getString(name);
if (oldValue == null || !oldValue.equals(value))
{
getOptionMap().put(name, value);
getSettingsMap().put(name, value);
setDirty(true);
firePropertyChangeEvent(name, oldValue, value);
}
@ -431,7 +435,7 @@ public class BuildToolsSettingsStore implements IPreferenceStore {
boolean oldValue = getBoolean(name);
if (oldValue != value)
{
getOptionMap().put(name, new Boolean(value));
getSettingsMap().put(name, new Boolean(value));
setDirty(true);
firePropertyChangeEvent(name, new Boolean(oldValue), new Boolean(value));
}

View file

@ -42,6 +42,11 @@ public class ToolListContentProvider implements ITreeContentProvider{
categories[index] = tools[index].getTopOptionCategory();
}
return categories;
} else if (parentElement instanceof ITool) {
// If this is a tool, return the categories it contains
ITool tool = (ITool)parentElement;
IOptionCategory[] children = tool.getTopOptionCategory().getChildCategories();
return (children == null) ? EMPTY_ARRAY : children;
} else if (parentElement instanceof IOptionCategory) {
// Categories can have child categories
IOptionCategory cat = (IOptionCategory)parentElement;