*
* @see org.apache.karaf.shell.console.Completer#complete(java.lang.String,
* int, java.util.List)
*/
public int complete(String buffer, int cursor, List<String> candidates) {
StringsCompleter delegate = new StringsCompleter();
try {
for (Component component : scrService.getComponents()) {
if (logger.isDebugEnabled()) {
logger.debug("Component Name to work on: " + component.getName());
}
if (ScrActionSupport.showHiddenComponent(component)) {
// We display all because we are overridden
if (availableComponent(component)) {
delegate.getStrings().add(component.getName());
}
} else {
if (ScrActionSupport.isHiddenComponent(component)) {
// do nothing
} else {
// We aren't hidden so print it
if (availableComponent(component)) {
delegate.getStrings().add(component.getName());
}
}
}
}
} catch (Exception e) {
logger.warn("Exception completing the command request: " + e.getLocalizedMessage());
}
return delegate.complete(buffer, cursor, candidates);
}