final List<Completion> completions, final String existingData,
final String optionContext) {
if (!projectOperations.isFocusedProjectAvailable()) {
return;
}
final Pom targetModule;
final String heading;
final String prefix;
final String formattedPrefix;
final String typeName;
if (existingData.contains(MODULE_PATH_SEPARATOR)) {
// Looking for a type in another module
final String targetModuleName = existingData.substring(0,
existingData.indexOf(MODULE_PATH_SEPARATOR));
targetModule = projectOperations
.getPomFromModuleName(targetModuleName);
heading = "";
prefix = targetModuleName + MODULE_PATH_SEPARATOR;
formattedPrefix = decorate(
targetModuleName + MODULE_PATH_SEPARATOR, FG_CYAN);
typeName = StringUtils.substringAfterLast(existingData,
MODULE_PATH_SEPARATOR);
}
else {
// Looking for a type in the currently focused module
targetModule = projectOperations.getFocusedModule();
heading = targetModule.getModuleName();
prefix = "";
formattedPrefix = "";
typeName = existingData;
}
final String topLevelPackage = typeLocationService
.getTopLevelPackageForModule(targetModule);
final String basePackage = resolveTopLevelPackageSymbol(typeName,
topLevelPackage);
addCompletionsForOtherModuleNames(completions, targetModule);
if (!"pom".equals(targetModule.getPackaging())) {
addCompletionsForTypesInTargetModule(completions, optionContext,
targetModule, heading, prefix, formattedPrefix,
topLevelPackage, basePackage);
}
}