Set<Tuple<String, String>> mods = new HashSet<Tuple<String, String>>();
//1. check if it is some module
//use a single buffer to create all the strings
FastStringBuffer buffer = new FastStringBuffer();
boolean doIgnoreImportsStartingWithUnder = AutoImportsPreferencesPage.doIgnoreImportsStartingWithUnder();
for (String completeName : allModules) {
FullRepIterable iterable = new FullRepIterable(completeName);
for (String mod : iterable) {
if (fullRep.startsWith(mod)) {
if (fullRep.length() == mod.length() //it does not only start with, but it is equal to it.
|| (fullRep.length() > mod.length() && fullRep.charAt(mod.length()) == '.')) {
buffer.clear();
String realImportRep = buffer.append("import ").append(mod).toString();
buffer.clear();
String displayString = buffer.append("Import ").append(mod).toString();
addProp(props, realImportRep, displayString, packageImage, offset, mods);
}
}
String[] strings = FullRepIterable.headAndTail(mod);
String packageName = strings[0];
String importRep = strings[1];
if (importRep.equals(markerContents)) {
if (packageName.length() > 0) {
buffer.clear();
String realImportRep = buffer.append("from ").append(packageName).append(" ").append("import ")
.append(strings[1]).toString();
buffer.clear();
String displayString = buffer.append("Import ").append(importRep).append(" (")
.append(packageName).append(")").toString();
addProp(props, realImportRep, displayString, packageImage, offset, mods);
} else {
buffer.clear();
String realImportRep = buffer.append("import ").append(strings[1]).toString();
buffer.clear();
String displayString = buffer.append("Import ").append(importRep).toString();
addProp(props, realImportRep, displayString, packageImage, offset, mods);
}
}
}
}
//2. check if it is some global class or method
List<AbstractAdditionalTokensInfo> additionalInfo;
try {
additionalInfo = AdditionalProjectInterpreterInfo.getAdditionalInfo(nature);
} catch (MisconfigurationException e) {
return;
}
FastStringBuffer tempBuf = new FastStringBuffer();
for (AbstractAdditionalTokensInfo info : additionalInfo) {
Collection<IInfo> tokensEqualTo = info.getTokensEqualTo(markerContents,
AbstractAdditionalTokensInfo.TOP_LEVEL);
for (IInfo found : tokensEqualTo) {
//there always is a declaring module