private Collection<ICompletionProposal> getNavigationProposals(IDocument doc, int offset) { String navPrefix = navigationPrefixFinder.getPrefix(doc, offset); try { if (navPrefix != null) { int navOffset = offset - navPrefix.length() - 1; // offset of 'nav' operator char (i.e. '.' or ']'). navPrefix = fuzzySearchPrefix.getPrefix(doc, navOffset); if (navPrefix != null && !navPrefix.isEmpty()) { PropertyInfo prop = findLongestValidProperty(getIndex(), navPrefix); if (prop != null) { int regionStart = navOffset - navPrefix.length(); PropertyNavigator navigator = new PropertyNavigator(doc, null, typeUtil, region(regionStart, navOffset)); Type type = navigator.navigate( regionStart + prop.getId().length(), TypeParser.parse(prop.getType())); if (type != null) { return getNavigationProposals(doc, type, navOffset, offset); } } } } } catch (Exception e) { BootActivator.log(e); } return Collections.emptyList(); }
/** Determine the value type for a give propertyName. */ protected Type getValueType(String propertyName) { try { PropertyInfo prop = getIndex().get(propertyName); if (prop != null) { return TypeParser.parse(prop.getType()); } else { prop = findLongestValidProperty(getIndex(), propertyName); if (prop != null) { Document doc = new Document(propertyName); PropertyNavigator navigator = new PropertyNavigator(doc, null, typeUtil, new Region(0, doc.getLength())); return navigator.navigate(prop.getId().length(), TypeParser.parse(prop.getType())); } } } catch (Exception e) { BootActivator.log(e); } return null; }