//TODO: for scopes such as FORM, URL and ATTRIBUTES, we need to do something different, since we will go and search for them tags that are CFPARAM
boolean isScope = false;
//if the variable exists
if(variableParserItem != null){
TagItem chosenTag = (TagItem)variableParserItem.getTagItem();
// System.out.println("Found Chosen Tag" + chosenTag);
//Lets check we have a pre-defined scope for this type
System.out.println(chosenTag.getClass().getName());
if(chosenTag != null && (chosenTag instanceof TagItem || chosenTag instanceof CfmlTagItem)){
TagItem leTag = (TagItem)chosenTag;
String tagname = leTag.getName();
if(tagname.equalsIgnoreCase("cfquery")){
isScope = true;
// we now look for either result or name
//TODO: tokenise SELECT something, something FROM so we have those proposals too!
//foo.subString(foo.indexOf("."))
if(varName.equalsIgnoreCase(leTag.getAttributeValue("result"))){
scopeProposals = ((ISyntaxDictionary)this.sourceDict).getFilteredScopeVars("CFQUERY");
}else{
//Go and get the proposals for this item, which is one set for the items, and another for the columns
//TODO: Add icons to this. so maybe we do a generic scope thing that adds scopeProposals with icons
scopeProposals = ((ISyntaxDictionary)this.sourceDict).getFilteredScopeVars("QUERY");
//Get the contents of the SQL and parse them
//get the end of leTag
int sqlStart = leTag.getEndPosition() + 1;
int sqlEnd = leTag.getMatchingItem().getStartPosition();
String docText = doc.get();
String sql = docText.substring(sqlStart, sqlEnd);
scopeProposals.addAll(parseSQL(sql));
}
} //end cfquery
else if(tagname.equalsIgnoreCase("cfdirectory")){
isScope = true;
scopeProposals = ((ISyntaxDictionary)this.sourceDict).getFilteredScopeVars("CFDIRECTORY");
}
else if(tagname.equalsIgnoreCase("cfftp")){
isScope = true;
if(varName.equalsIgnoreCase(leTag.getAttributeValue("result"))){
scopeProposals = ((ISyntaxDictionary)this.sourceDict).getFilteredScopeVars("CFFTP");
}
else{
scopeProposals = ((ISyntaxDictionary)this.sourceDict).getFilteredScopeVars("CFFTPList");
}