Package org.cfeclipse.cfml.dictionary

Examples of org.cfeclipse.cfml.dictionary.Function


    Set<Parameter> params = null;
      if (state.getDataSoFar().toLowerCase().matches(".*?arguments\\.[\\w]*$")) {
      CFDocument doc = ((ICFDocument) state.getIDocument()).getCFDocument();
      // get a reference to the containing function
      CfmlTagItem cti = getPreviousFunctionTag(state);
      Function func = doc.getFunctionByName(cti.getAttributeValue("name"));
      if (func != null) {
        params =  func.getParameters();     
        return prepareProposals(state, params);
      } else {
        return null;
      }
      } else {
      try {
        if (state.getIDocument().getPartition(state.getOffset()).getType().equals(CFPartitionScanner.CF_SCRIPT)) {
          CFDocument doc = ((ICFDocument) state.getIDocument()).getCFDocument();
          CFNodeList funknodes = doc.getDocumentRoot().selectNodes(
              "//ASTFunctionDeclaration[#startpos<" + state.getOffset() + "]");
          if (funknodes.size() > 0) {
            FunctionInfo funknode = (FunctionInfo) funknodes.get(funknodes.size() - 1);
            Function func = doc.getFunctionByName(funknode.getFunctionName());
            if (func != null) {
              params = func.getParameters();
              return prepareProposals(state, params);
            } else {
              return null;
            }
          }
View Full Code Here


    if(object instanceof TagItem){
      Tag tag = ((TagItem)object).getTag();
      this.fillAttributes(tag.getParameters());
    }
    else if(object instanceof FunctionItem){
      Function func = ((FunctionItem)object).getFunction();
      this.fillAttributes(func.getParameters());
   
    }
   
  }
View Full Code Here

        Iterator i = fst.iterator();
        int x = 0;
        while(i.hasNext())
        {
          //System.out.println(x);
          Function fun = syntax.getFunction((String)i.next());
            //(Function)i.next();

            String usage = fun.toString();
            //System.err.println(usage);
           
            result[x] = new ContextInformation(
              CFPluginImages.get(CFPluginImages.ICON_FUNC),
              //info,
View Full Code Here

     
      int z=0;
      Iterator i = st.iterator();
      while(i.hasNext())
      {
        Function fun = (Function)i.next();
       
        //the toLowerCase is because of the createobject hack, we need
        //to either make a setting in prefs for upper/lower or find a
        //better way to handle the createobject case
        String name = fun.getName().toLowerCase();
        //now remove chars so when they hit enter it wont write the whole
        //word just the part they havent typed
        if(name.length() > 0)
        {
          name = name.substring(currentlen, name.length());
          //System.out.println("makeSetToProposal" + "in::" + name);
        }
       
        //the tag len and icon
        int insertlen = 0;
        Image img = null;
        //if there is anyof the function name left add a closing(
        insertlen = name.length();
        if (name.length() > 0) {
          name += "(";
          insertlen = name.length();
        }
        //default to the tag len and icon
        name += ")";
        img = CFPluginImages.get(CFPluginImages.ICON_FUNC);
       
        result[z] = new CompletionProposal(
          name,
          offset,
          0,
          insertlen,
          img,
          fun.toString(),
          null,
          fun.getHelp()
        );
        z++;
      }
      return result;
    }
View Full Code Here

          params = new LinkedHashSet();
          CFDocument doc = ((ICFDocument) state.getIDocument()).getCFDocument();
        functions = doc.getFunctions();
        Iterator it = functions.iterator();
        while (it.hasNext()) {
          Function function = (Function) it.next();
          System.out.println(function.getName().split("\\(")[0]);
          if (function.getName().split("\\(")[0].equals(this.functionName) && function.getParameters() != null) {
            Iterator funkParams = function.getParameters().iterator();
            while (funkParams.hasNext()) {
              params.add((Parameter) funkParams.next());
            }
          }
          }
        if (params.size() == 0) {
          String allData = state.getDataSoFar();
          if (allData.endsWith(".") || allData.endsWith("(")) {
            allData = allData.substring(0, allData.length() - 1);
          }
          variableName = "";

          StringBuffer buf = new StringBuffer();
          for (int i = allData.length() - 1; i >= 0; i--) {
            if (!Character.isJavaIdentifierPart(allData.charAt(i))) {
              for (int j = i - 1; j >= 0; j--) {
                if (!Character.isJavaIdentifierPart(allData.charAt(j))) {
                  break;
                }
                buf.insert(0, allData.charAt(j));
              }
              break;
            }
          }
          variableName = buf.toString();
          String CFCName = AssistUtils.getCFCName(this.variableName, state);
          IFile foundCFC = AssistUtils.findCFC(CFCName);
          functions = AssistUtils.getFunctions(foundCFC, state.getOffset());
          if (functions != null) {
            it = functions.iterator();
            while (it.hasNext()) {
              Function function = (Function) it.next();
              if (function.getName().split("\\(")[0].equals(this.functionName) && function.getParameters() != null) {
                Iterator funkParams = function.getParameters().iterator();
                while (funkParams.hasNext()) {
                  params.add((Parameter) funkParams.next());
                }
              }
            }
View Full Code Here

          if(!wordIsTag)
          {
           
            if(dictionary.functionExists(wordFound))
            { 
              Function fun = dictionary.getFunction(wordFound);
              //message = ((SyntaxDictionaryInterface)dictionary).getFunctionUsage(wordFound);
              message = " " + fun.getHelp();
            }
            //CFSyntaxDictionary.getFunctionUsage(wordFound);
          }
          else
          {
View Full Code Here

                  //System.out.println("Tag " + thisItem.getAttributes().getNamedItem("label").getNodeValue() +" not found in dictionary");
                 
                }
            }
            else {
              Function thisfunction = cfdic.getFunction(thisItem.getAttributes().getNamedItem("label").getNodeValue());
             
              if(thisfunction != null){
                FunctionItem tag = new FunctionItem(thisfunction);
                tag.setDictionary(cfdic);
                catItem.addChild(tag);
View Full Code Here

    }
   
    //Get all the functions from the dictionary and add them
    Iterator funcIter = cfdic.getAllFunctions().iterator();
    while(funcIter.hasNext()){
      Function currFunc = (Function)funcIter.next();
      FunctionItem func = new FunctionItem(currFunc);
      func.setDictionary(cfdic);
      functions.addChild(func);
     
     
View Full Code Here

    while (i.hasNext()) {
      TagItem currItem = (TagItem) i.next();
      String funcName = currItem.getAttributeValue("name", "unnamed");
      String funcReturn = currItem.getAttributeValue("returntype", "any");

      Function function = new Function(funcName, funcReturn, Byte.parseByte("8"));
      // System.out.println(currItem.getItemData());
      if (currItem.hasChildren() && currItem.getFirstChild().getName().equals("cfargument")) {
        Iterator childNodes = currItem.getChildNodes().iterator();
        DocItem childNode;
        while (childNodes.hasNext()) {
          childNode = (DocItem) childNodes.next();
          if (childNode.getName().equals("cfargument")) {
            matcher = pattern.matcher(childNode.getItemData());
            while (matcher.find()) {
              String value = matcher.group(2).replaceAll("'", "").replaceAll("\"", "");
              if (matcher.group(1).toLowerCase().equals("name")) {
                name = value;
              }
              if (matcher.group(1).toLowerCase().equals("type")) {
                type = value;
              }
              if (matcher.group(1).toLowerCase().equals("required")) {
                required = value;
              }
              if (matcher.group(1).toLowerCase().equals("default")) {
                defaultvalue = value;
              }
            }
            Parameter newParam = new Parameter(name, type, Boolean.valueOf(required), defaultvalue);
            name = type = required = defaultvalue = "";
            function.addParameter(newParam);
          }

        }
      }
      functions.add(function);
    }
    i = scriptNodes.iterator();
    while (i.hasNext()) {
      FunctionInfo currItem = (FunctionInfo) i.next();
      String funcName = currItem.getFunctionName();
      String funcReturn = currItem.getReturnType();
      Function function = new Function(funcName, funcReturn, Byte.parseByte("8"));
      // System.out.println(currItem.getItemData());
      List args = currItem.getParameters();
      Iterator j = args.iterator();
      while (j.hasNext()) {
        Map<String, String> parameterAttribs = (Map) j.next();
        name = parameterAttribs.get("name");
        type = parameterAttribs.get("type");
        required = parameterAttribs.get("required");
        defaultvalue = parameterAttribs.get("default");
        Parameter newParam = new Parameter(name, type, Boolean.valueOf(required), defaultvalue);
        name = type = required = defaultvalue = "";
        function.addParameter(newParam);
      }
      functions.add(function);
    }
    return functions;
  }
View Full Code Here

TOP

Related Classes of org.cfeclipse.cfml.dictionary.Function

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.