Package org.cfeclipse.cfml.parser.docitems

Examples of org.cfeclipse.cfml.parser.docitems.CfmlTagItem


    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;
View Full Code Here


   * @return
   */
  private CfmlTagItem getPreviousFunctionTag(IAssistState state) {

    CFDocument doc = ((ICFDocument) state.getIDocument()).getCFDocument();   
    CfmlTagItem closestItem = null;
   
    // there might be a parse error with the document itself, which nullifies this
    if(doc == null) {
      return null;
    }
   
    try {
      CFNodeList matchingNodes = doc.getDocumentRoot().selectNodes(
        "//cffunction"
      );
      int lineFound = 0;

      Iterator i = matchingNodes.iterator();
      while (i.hasNext()) {
        DocItem node = (DocItem) i.next();
        if (node instanceof CfmlTagItem) {
          CfmlTagItem currItem = (CfmlTagItem) node;
          if (lineFound == 0 ||
              (currItem.getEndPosition() < state.getOffset() && currItem.getLineNumber() > lineFound)) {
            lineFound = currItem.getLineNumber();
            closestItem = (CfmlTagItem) node;
          }
        }
      }
         
View Full Code Here

       
        CFNodeList args = function.selectNodes("//cfargument");
        Iterator argiter = args.iterator();
        while (argiter.hasNext())
        {
            CfmlTagItem argTag = (CfmlTagItem) argiter.next();
            ArgumentNode argNode = new ArgumentNode(argTag);
            argNode.setParent(this);
            this.addChild(argNode);
        }
    }
View Full Code Here

    Iterator it = nodes.iterator();
    while (it.hasNext()) {
      Object o = it.next();
      if (o instanceof CfmlTagItem && ((CfmlTagItem) o).matchingItem != null) {
        CfmlTagItem tag = (CfmlTagItem) o;

        int start = tag.getStartPosition();
        int length = tag.matchingItem.getEndPosition() - start;
        try {
          int startLine = doc.getLineOfOffset(start);
          int endLine = doc.getLineOfOffset(start + length);
          start = doc.getLineOffset(startLine);
View Full Code Here

        if (m.find() && m.group(1).equalsIgnoreCase(variableName)) {
          cfcName = m.group(2);
          break;
        }
      } else if (cfItem instanceof CfmlTagItem) {
        CfmlTagItem cfsetTag = (CfmlTagItem) cfItem;
        if (!((CfmlTagItem) cfItem).getName().equalsIgnoreCase("cfset")) {
          continue;
        }
        String tagText = ((CfmlTagItem) cfItem).getItemData();
        Map<String, String> varMap = parseCfSetText(tagText);
View Full Code Here

    CFMLEditor thisEdit = (CFMLEditor) activeEditor;
    IDocument doc = thisEdit.getDocumentProvider().getDocument(thisEdit.getEditorInput());
    ISelection sel = thisEdit.getSelectionProvider().getSelection();
    DocItem docItem = thisEdit.getSelectionCursorListener().getSelectedTag();
    if (docItem != null && docItem instanceof CfmlTagItem) {
      CfmlTagItem tagItem = (CfmlTagItem) docItem;

      int tagStart = tagItem.getStartPosition();
      int tagEnd = tagItem.getEndPosition();
      TextSelection selection;
      int startPos = tagItem.getStartPosition();
      int endPos = tagItem.getEndPosition();
      int start = 0;
      int length = 0;
      if(tagItem.matchingItem != null) {       
        if (tagItem.matchingItem.getStartPosition() < tagItem.getStartPosition()) {
          start = tagItem.matchingItem.getStartPosition();
          length = tagItem.getEndPosition() - tagItem.matchingItem.getStartPosition() + 1;
        } else {
          start = tagItem.getStartPosition();
          length = tagItem.matchingItem.getEndPosition() - tagItem.getStartPosition() + 1;
        }
      } else {
        if (tagItem.matchingItem != null && tagItem.matchingItem.getStartPosition() <= startPos
            && tagItem.matchingItem.getEndPosition() >= startPos) {
          start = tagItem.matchingItem.getStartPosition();
          length = tagItem.matchingItem.getEndPosition() - tagItem.matchingItem.getStartPosition() + 1;
        } else {
          start = tagItem.getStartPosition();
          length = tagItem.getEndPosition() - tagItem.getStartPosition() + 1;
        }       
      }
      // thisEdit.selectAndReveal(tagStart,tagEnd-tagStart+1);
      selection = new TextSelection(start, length);
      ISelectionProvider selectionProvider = thisEdit.getSelectionProvider();
      selectionProvider.setSelection(selection);

      /*
       * Get the actual textual content of the tag
       */
      String tagText = "";
      try {

        tagText = doc.get(selection.getOffset(), selection.getLength());
      } catch (BadLocationException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
      }

      /*
       * Get the attributes as a map TODO: I am not sure if map's keep the
       * ordering... need to check this
       */
      Map attributeMap = CFDocUtils.parseStartTag(tagItem.getName(), tagText);

      /*
       * Now open the TagEditDialog, we know the tag name (as a string)
       * and the tag attributes (as a map) So, we go and get the tag from
       * the dictionary
       */
      Tag tagToEdit = DictionaryManager.getDictionary("CF_DICTIONARY").getTag(tagItem.getName());

      /*
       * Setup the tageditor dialog
       */
      TagEditDialog tagview = new TagEditDialog(shell, tagToEdit);
View Full Code Here

        CFNodeList circuitscripts = rootItem.selectNodes("//cfscript");
        if(circuitscripts != null){
          Iterator scriptIter = circuitscripts.iterator();
         
          while(scriptIter.hasNext()){
            CfmlTagItem tag = (CfmlTagItem)scriptIter.next();
            //Get the full contents,
            String tagContents = circuitFile.substring(tag.getStartPosition(), tag.getEndPosition());
            cleanCircuits.append(tagContents);
           
          }
        }
       
        //Now add all the cfset items
        CFNodeList circuitsets = rootItem.selectNodes("//cfset");
        if(circuitsets != null){
          Iterator setIter = circuitsets.iterator();
         
          while(setIter.hasNext()){
            CfmlTagItem tag = (CfmlTagItem)setIter.next();
            //Get the full contents,
            String tagContents =  tag.getItemData();
            cleanCircuits.append(tagContents);
           
          }
        }
        //Now that we have them all cleaned up we can parse it and return the array list
View Full Code Here

          DocItem rootItem = swtichDoc.getDocumentRoot();
          CFNodeList switchItems = rootItem.selectNodes("//cfcase");
          Iterator switchIter = switchItems.iterator();
         
          while(switchIter.hasNext()){
            CfmlTagItem tag = (CfmlTagItem)switchIter.next();
            if(tag != null){
              FBXFuseAction fuseaction = new FBXFuseAction(tag.getAttributeValue("value"));
              fuseaction.setSwichFile(switchFile);
              ArrayList fuses = getFuses(tag, fuseaction);
              fuseaction.setChildren(fuses);
              fuseaction.setCircuit(circuit);
              fuseaction.setTagStart(tag.getStartPosition());
              fuseaction.setTagEnd(tag.getMatchingItem().getEndPosition());
              fuseactions.add(fuseaction);
            }
          }
        }
      } catch(Exception e){
View Full Code Here

      Iterator nodeIter = nodes.iterator();
     
      while(nodeIter.hasNext()){
        Object childObj = nodeIter.next();
        if(childObj instanceof CfmlTagItem){
          CfmlTagItem childTag = (CfmlTagItem)childObj;
          if(childTag.getName().equals("cfinclude")){
           
            FBXFuse fuse = new FBXFuse(childTag.getAttributeValue("template"));
            fuse.setFusetype(fuse.getName().substring(0,3));
            fuse.setParent(fuseaction);
            fuse.setSwitchFile(fuseaction.getSwichFile());
            fuses.add(fuse);
           
          } else if (childTag.getName().equals("cfmodule")){
           
            FBXFuse fuse = new FBXFuse(childTag.getAttributeValue("template"));
            fuse.setFusetype(fuse.getName().substring(0,3));
            fuse.setIsModule(true);
            fuse.setParent(fuseaction);
            fuse.setSwitchFile(fuseaction.getSwichFile());
            fuses.add(fuse);
View Full Code Here

    org.cfeclipse.cfml.parser.docitems.DocItem docRoot = cfd.getDocumentRoot();
    CFNodeList nodes = docRoot.selectNodes("//cfcomponent");   
   
    // Check if this document is a CFC (contains a <cfcomponent> tag)
    if(nodes.size() > 0) {
      CfmlTagItem tag = (CfmlTagItem)nodes.get(0);
     
      // If the CFC has a tester argument, return that as the test case
      String t = tag.getAttributeValue("tester");
      if(t != null) {
        return t;
      }
     
      // If the CFC extends a TestCase, return the current document's name
      String sc = tag.getAttributeValue("extends");
      if(sc != null) {
        if(sc.matches(".*\\.TestCase.*")) {
          return CFUnitTestCase.getResourceFullName( icfd.getResource() );
        }
      }
View Full Code Here

TOP

Related Classes of org.cfeclipse.cfml.parser.docitems.CfmlTagItem

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.