Package tk.eclipse.plugin.htmleditor.assist

Examples of tk.eclipse.plugin.htmleditor.assist.TagInfo


          DTDItem item = element.getContent();
          boolean hasBody = true;
          if(item instanceof DTDEmpty){
            hasBody = false;
          }
          TagInfo tagInfo = new TagInfo(name,hasBody);
          Iterator ite = element.attributes.keySet().iterator();
         
          // set child tags
          if(item instanceof DTDSequence){
            DTDSequence seq = (DTDSequence)item;
            setChildTagName(tagInfo,seq.getItem());
          } else if(item instanceof DTDMixed){
            // #PCDATA
          }
         
          while(ite.hasNext()){
            String attrName = (String)ite.next();
            DTDAttribute attr = element.getAttribute(attrName);
           
            DTDDecl decl = attr.getDecl();
            boolean required = false;
            if(decl == DTDDecl.REQUIRED){
              required = true;
            }
           
            AttributeInfo attrInfo = new AttributeInfo(attrName,true,AttributeInfo.NONE,required);
            tagInfo.addAttributeInfo(attrInfo);
           
            Object attrType = attr.getType();
            if(attrType instanceof DTDEnumeration){
              DTDEnumeration dtdEnum = (DTDEnumeration)attrType;
              String[] items = dtdEnum.getItems();
View Full Code Here


     
    }
  }
 
  private void parseXSDElement(List tagList, XSElementDeclaration element){
    TagInfo tagInfo = new TagInfo(element.getName(),true);
    if(tagList.contains(tagInfo)){
      return;
    }
    tagList.add(tagInfo);
   
    XSTypeDefinition type = element.getTypeDefinition();
    if(type instanceof XSComplexTypeDefinition){
      XSParticle particle = ((XSComplexTypeDefinition)type).getParticle();
      if(particle!=null){
        XSTerm term = particle.getTerm();
        if(term instanceof XSElementDeclaration){
          parseXSDElement(tagList,(XSElementDeclaration)term);
          tagInfo.addChildTagName(((XSElementDeclaration)term).getName());
        }
        if(term instanceof XSModelGroup){
          parseXSModelGroup(tagInfo, tagList, (XSModelGroup)term);
        }
      }
      XSObjectList attrs = ((XSComplexTypeDefinition)type).getAttributeUses();
      for(int i=0;i<attrs.getLength();i++){
        XSAttributeUse attrUse = (XSAttributeUse)attrs.item(i);
        XSAttributeDeclaration attr = attrUse.getAttrDeclaration();
        AttributeInfo attrInfo = new AttributeInfo(attr.getName(),true,AttributeInfo.NONE,attrUse.getRequired());
        tagInfo.addAttributeInfo(attrInfo);
      }
     
    }
  }
View Full Code Here

      if(prefix==null || prefix.equals("")){
        list.addAll((List)this.nsTagListMap.get(uri));
      } else {
        List nsTagList = (List)this.nsTagListMap.get(uri);
        for(int i=0;i<nsTagList.size();i++){
          TagInfo tagInfo = (TagInfo)nsTagList.get(i);
          list.add(createPrefixTagInfo(tagInfo,prefix));
        }
      }
    }
      return list;
View Full Code Here

 
  /**
   * Adds prefix to TagInfo.
   */
  private TagInfo createPrefixTagInfo(TagInfo tagInfo,String prefix){
    TagInfo newTagInfo = new TagInfo(prefix + ":" + tagInfo.getTagName(),tagInfo.hasBody());
    AttributeInfo[] attrInfos = tagInfo.getAttributeInfo();
    for(int i=0;i<attrInfos.length;i++){
      AttributeInfo newAttrInfo = new AttributeInfo(
          prefix + ":" + attrInfos[i].getAttributeName(),
          true,
          AttributeInfo.NONE,
          attrInfos[i].isRequired());
      newTagInfo.addAttributeInfo(newAttrInfo);
    }
    String[] children = tagInfo.getChildTagNames();
    for(int i=0;i<children.length;i++){
      newTagInfo.addChildTagName(prefix + ":" + children[i]);
    }
    return newTagInfo;
  }
View Full Code Here

  private static final Pattern REQUIRED  = Pattern.compile("required\\s*=\\s*\"(.+?)\"");
 
  public static TagInfo parseTagFile(String prefix, File file) throws Exception {
   
    String fileName = file.getName();
    TagInfo tag = new TagInfo(prefix + ":" + fileName.substring(0, fileName.lastIndexOf('.')), true);
   
    byte[] buf = HTMLUtil.readStream(new FileInputStream(file));
    Matcher matcher = ATTRIBUTE.matcher(new String(buf));
    while (matcher.find()) {
      String content = matcher.group(1);
      String name = getAttribute(content, NAME);
      boolean required = getBooleanValue(getAttribute(content, REQUIRED));
     
      tag.addAttributeInfo(new AttributeInfo(name, true, AttributeInfo.NONE, required));
    }
   
    return tag;
  }
View Full Code Here

   * @return TagInfo
   */
  protected TagInfo getTagInfo(String name){
    List tagList = getTagList();
    for(int i=0;i<tagList.size();i++){
      TagInfo info = (TagInfo)tagList.get(i);
      if(info.getTagName().equals(name)){
        return info;
      }
    }
    return null;
  }
View Full Code Here

  private List cunstomTagList = new ArrayList();
  private HashMap namespace = new HashMap();
 
  public JSPAssistProcessor(){
    // JSP actions
    TagInfo useBean = new TagInfo("jsp:useBean",true);
    useBean.addAttributeInfo(new AttributeInfo("id",true));
    useBean.addAttributeInfo(new AttributeInfo("scope",true,SCOPE));
    useBean.addAttributeInfo(new AttributeInfo("class",true));
    tagList.add(useBean);
   
    TagInfo setProperty = new TagInfo("jsp:setProperty",false);
    setProperty.addAttributeInfo(new AttributeInfo("name",true));
    setProperty.addAttributeInfo(new AttributeInfo("param",true));
    setProperty.addAttributeInfo(new AttributeInfo("property",true));
    tagList.add(setProperty);
   
    TagInfo include = new TagInfo("jsp:include",false);
    include.addAttributeInfo(new AttributeInfo("page",true));
    tagList.add(include);
   
    TagInfo forward = new TagInfo("jsp:forward",true);
    forward.addAttributeInfo(new AttributeInfo("page",true));
    tagList.add(forward);
   
    TagInfo param = new TagInfo("jsp:param",false);
    param.addAttributeInfo(new AttributeInfo("name",true));
    param.addAttributeInfo(new AttributeInfo("value",true));
    tagList.add(param);
   
    TagInfo attribute = new TagInfo("jsp:attribute",true);
    attribute.addAttributeInfo(new AttributeInfo("name",true));
    tagList.add(attribute);
   
    TagInfo body = new TagInfo("jsp:body",true);
    tagList.add(body);
   
    TagInfo element = new TagInfo("jsp:element",true);
    element.addAttributeInfo(new AttributeInfo("name",true));
    tagList.add(element);
   
    TagInfo text = new TagInfo("jsp:text",true);
    tagList.add(text);
   
    // JSP directives
    tagList.add(new TextInfo("<%  %>", 3));
    tagList.add(new TextInfo("<%=  %>", 4));
View Full Code Here

  }
 
  protected TagInfo getTagInfo(String name) {
    List tagList = getTagList();
    for(int i=0;i<tagList.size();i++){
      TagInfo info = (TagInfo)tagList.get(i);
      if(info.getTagName()!=null){
        if(name.equals(info.getTagName().toLowerCase())){
          return info;
        }
      }
    }
    return null;
View Full Code Here

              reader.setEntityResolver(new TLDResolver());
              reader.setContentHandler(handler);
              reader.parse(new InputSource(new FileInputStream(new File(openFile))));
              List tagInfoList = handler.getResult();
              for(int i=0;i<tagInfoList.size();i++){
                TagInfo info = (TagInfo)tagInfoList.get(i);
                TableItem item = new TableItem(table,SWT.NULL);
                StringBuffer sb = new StringBuffer();
                sb.append("<").append(info.getTagName());
                AttributeInfo[] attrs = info.getRequiredAttributeInfo();
                for(int j=0;j<attrs.length;j++){
                  sb.append(" ").append(attrs[j].getAttributeName()).append("=\"\"");
                }
                if(info.hasBody()){
                  sb.append("></").append(info.getTagName()).append(">");
                } else {
                  sb.append("/>");
                }
                item.setText(new String[]{info.getTagName(),sb.toString()});
              }
            } catch(Exception ex){
              HTMLPlugin.openAlertDialog(ex.getMessage());
            }
          }
View Full Code Here

    prevTag = qName;
  }
 
  public void endElement(String uri, String localName, String qName) throws SAXException {
    if(qName.equals("tag")){
      TagInfo info = new TagInfo(tagName.toString(),hasBody);
      for(int i=0;i<attributes.size();i++){
        String attrName = (String)attributes.get(i);
        boolean required = false;
        if(this.attrRequiredMap.get(attrName)!=null){
          required = true;
        }
        AttributeInfo attrInfo = new AttributeInfo(attrName,true,AttributeInfo.NONE,required);
        if(attrDescMap.get(attrName)!=null){
          attrInfo.setDescription(wrap((String)attrDescMap.get(attrName)));
        }
        info.addAttributeInfo(attrInfo);
      }
      if(tagDesc.length() > 0){
        info.setDescription(wrap(tagDesc.toString()));
      }
      result.add(info);
      mode = 0;
      prevTag = null;
      hasBody = true;
View Full Code Here

TOP

Related Classes of tk.eclipse.plugin.htmleditor.assist.TagInfo

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.