public final void setControllerExtendsComboBox() {
Object currentItem = controllerExtendsComboBox.getSelectedItem();
controllerExtendsComboBox.removeAllItems();
controllerExtendsComboBox.addItem(""); // NOI18N
controllerExtendsComboBox.setEditable(true);
EditorSupport editorSupport = Lookup.getDefault().lookup(EditorSupport.class);
FileObject controllerDirectory = FuelUtils.getControllerDirectory(phpModule);
FileObject coreDirectory = FuelUtils.getCoreDirectory(phpModule);
FileObject coreControllerDirectory = null;
if (coreDirectory != null) {
coreControllerDirectory = coreDirectory.getFileObject("classes/controller"); // NOI18N
}
List<FileObject> controllers = new LinkedList<FileObject>();
// core
if (coreControllerDirectory != null) {
Enumeration<? extends FileObject> children = coreControllerDirectory.getChildren(true);
controllers.addAll(Collections.list(children));
}
// app
if (controllerDirectory != null) {
Enumeration<? extends FileObject> children = controllerDirectory.getChildren(true);
controllers.addAll(Collections.list(children));
}
// add items
controllerExtendsComboBox.addItem("Controller"); // NOI18N
FuelUtils.sortFileObject(controllers);
for (FileObject controller : controllers) {
for (PhpClass phpClass : editorSupport.getClasses(controller)) {
String className = phpClass.getName();
if (className.startsWith(FuelUtils.CONTROLLER_PREFIX)) {
controllerExtendsComboBox.addItem(className);
}
}