Examples of IDOMElement


Examples of org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement

    page.getControl().setLayoutData(data);
  }

  @Override
  public void setInput(IWorkbenchPart part, ISelection selection) {
    IDOMElement newEle = (IDOMElement) DesignerPropertyTool.getElement(
        part, selection);

    if (_element != newEle && page != null) {
      super.setInput(part, selection);
      page.selectionChanged(part, selection);
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement

        // nothing to do.
        break;
    }
    if (rgn != null) {
      if (errorNode instanceof IDOMAttr) {
        IDOMElement ownerElement = (IDOMElement) ((IDOMAttr) errorNode).getOwnerElement();
        if (ownerElement != null) {
          //if editor closed during validation this could be null
          IStructuredDocumentRegion firstRegion = ownerElement.getFirstStructuredDocumentRegion();
          if(firstRegion != null) {
            int regionStartOffset = firstRegion.getStartOffset(rgn);
            int regionLength = rgn.getTextLength();
            return new Segment(regionStartOffset, regionLength);
          }
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement

  }

  /**
   */
  private static void addStyleSheet(Element node, List result) {
    IDOMElement element = (IDOMElement) node;
    String tagName = element.getTagName();
    if (tagName == null) {
      return;
    }
    boolean isContainer = false;

    if (element.isCommentTag()) {
      Node parent = element.getParentNode();
      if (parent == element.getOwnerDocument()) {
        // This condition is too severe, actually do not work for JSF
        // template.
        // But above (! globalTag() && isContainer()) cover JSF template
        // + tpl template
        isContainer = true;
      } else if (parent.getNodeType() == Node.ELEMENT_NODE) {
        tagName = ((Element) parent).getTagName();
        if (tagName != null
            && tagName
                .equalsIgnoreCase(HTML40Namespace.ElementName.HEAD)) {
          isContainer = true;
        }
      }
    } else {
      INodeNotifier notifier = element;

      // (lium) Increase performance: since this method is called tooooo
      // many times,
      // and getAdapterFor() is slow, so add a check on the tagName to
      // filter
      // those stylesheet stuff first.
      if (IHTMLConstants.TAG_LINK.equalsIgnoreCase(tagName)
          || IHTMLConstants.TAG_STYLE.equalsIgnoreCase(tagName)) {
        INodeAdapter adapter = notifier
            .getAdapterFor(IStyleSheetAdapter.class);
        if (adapter instanceof IStyleSheetAdapter) {
                    // XXX: see bug 171740.  This is a (hopefully) temporary
                    // workaround that avoids having the call to getSheet throw an NPE
                    IStyleSheetAdapter sheetAdapter = (IStyleSheetAdapter) adapter;
                    if (sheetAdapter.getElement() != null
                            && "text/css".equals(sheetAdapter.getElement().getAttribute(HTML40Namespace.ATTR_NAME_TYPE))) //$NON-NLS-1$

                    {
              StyleSheet sheet = ((IStyleSheetAdapter) adapter)
                  .getSheet();
                       
                        if (sheet != null)
                        {
                            result.add(sheet);
                        }
                    }
        }
      }

      isContainer = true;
    }
    if (isContainer) {
      for (Node child = element.getFirstChild(); child != null; child = child
          .getNextSibling()) {
        if (child.getNodeType() != Node.ELEMENT_NODE)
          continue;
        addStyleSheet((Element) child, result);
      }
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement

  }

  /**
   */
  private void addStyleSheet(Element node) {
    IDOMElement element = (IDOMElement) node;
    String tagName = element.getTagName();
    if (tagName == null)
      return;
    boolean isContainer = false;
    if (tagName.equalsIgnoreCase(HTML40Namespace.ElementName.HTML) || tagName.equalsIgnoreCase(HTML40Namespace.ElementName.HEAD) || tagName.equalsIgnoreCase(HTML40Namespace.ElementName.NOSCRIPT) || tagName.equalsIgnoreCase(HTML40Namespace.ElementName.BASE) || tagName.equalsIgnoreCase(JSP11Namespace.ElementName.ROOT) || (!element.isGlobalTag() && element.isContainer())) {
      isContainer = true;
    }
    else if (element.isCommentTag()) {
      Node parent = element.getParentNode();
      if (parent == element.getOwnerDocument()) {
        // This condition is too severe, actually do not work for JSF template.
        // But above (! globalTag() && isContainer()) cover JSF template + tpl template
        isContainer = true;
      }
      else if (parent.getNodeType() == Node.ELEMENT_NODE) {
        tagName = ((Element) parent).getTagName();
        if (tagName != null && tagName.equalsIgnoreCase(HTML40Namespace.ElementName.HEAD)) {
          isContainer = true;
        }
      }
    }

    else {
      String localName = element.getLocalName();
      if (localName != null && localName.equalsIgnoreCase(HTML40Namespace.ElementName.HTML)) {
        // taglib html tag
        isContainer = true;
      }
      else {
        INodeNotifier notifier = element;
        INodeAdapter adapter = notifier.getAdapterFor(IStyleSheetAdapter.class);
        if (adapter != null && adapter instanceof IStyleSheetAdapter) {
          this.styleAdapters.addElement(adapter);
        }
      }
    }
    if (isContainer) {
      INodeNotifier notifier = element;
      if (notifier.getExistingAdapter(IStyleSheetListAdapter.class) == null) {
        notifier.addAdapter(this);
      }
      for (Node child = element.getFirstChild(); child != null; child = child.getNextSibling()) {
        if (child.getNodeType() != Node.ELEMENT_NODE)
          continue;
        addStyleSheet((Element) child);
      }
    }
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement

    if (node == null)
      return;
   
    switch(node.getNodeType()) {
      case Node.ELEMENT_NODE: {
        IDOMElement element = (IDOMElement) node;
        String tagName = element.getTagName();
        if (tagName == null)
          return;

        if (eventType == INodeNotifier.CHANGE) {
          if (tagName.equalsIgnoreCase(HTML40Namespace.ElementName.BASE)) {
            refreshAdapters();
          }
        }
        else {
          if (tagName.equalsIgnoreCase(HTML40Namespace.ElementName.HTML) || tagName.equalsIgnoreCase(HTML40Namespace.ElementName.HEAD) || tagName.equalsIgnoreCase(HTML40Namespace.ElementName.STYLE) || tagName.equalsIgnoreCase(HTML40Namespace.ElementName.LINK) || tagName.equalsIgnoreCase(HTML40Namespace.ElementName.NOSCRIPT) || tagName.equalsIgnoreCase(JSP11Namespace.ElementName.ROOT) || element.isCommentTag() || (!element.isGlobalTag() && element.isContainer())) {
            childReplaced();
          }
          else if (tagName.equalsIgnoreCase(HTML40Namespace.ElementName.BASE)) {
            refreshAdapters();
          }
          else {
            String localName = element.getLocalName();
            if (localName != null && localName.equalsIgnoreCase(HTML40Namespace.ElementName.HTML)) {
              // taglib html tag
              childReplaced();
            }
          }
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement

          return false;
      }
      return true;
    }
    else if (parent.getNodeType() == Node.ELEMENT_NODE) {
      IDOMElement element = (IDOMElement) parent;
      // do not insert break before missing end tag
      if (next == null && element.getEndStructuredDocumentRegion() == null)
        return false;

      // insert line break under non-HTML elements including JSP
      // elements
      if (element.getPrefix() != null)
        return true;

      CMElementDeclaration decl = getElementDeclaration(element);
      if (decl != null) {
        if (decl.getContentType() == CMElementDeclaration.ELEMENT)
          return true;
                // causes all closing tags to wrap to a new line
                boolean allowsText = decl.getContentType() == CMElementDeclaration.MIXED
                        || decl.getContentType() == CMElementDeclaration.PCDATA;
                if (allowsNewlineAfter(allowsText, node, element))
                    return true;
        String tagName = element.getTagName();
        // special for direct children under BODY
        if (tagName != null && tagName.equalsIgnoreCase(BODY_NAME))
          return true;
      }
    }

    if (node.getNodeType() == Node.ELEMENT_NODE) {
      IDOMElement element = (IDOMElement) node;
      CMElementDeclaration decl = getElementDeclaration(element);
      if (canInsertBreakAfter(decl)) {
        // spcial for BR
        return canFormatChild(parent);
      }
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement

      if (prev == null)
        return false;
      return true;
    }
    else if (parent.getNodeType() == Node.ELEMENT_NODE) {
      IDOMElement element = (IDOMElement) parent;
      // do not insert break after missing start tag
      if (prev == null && element.getStartStructuredDocumentRegion() == null)
        return false;

      // insert line break under non-HTML elements including JSP
      // elements
      if (element.getPrefix() != null)
        return true;

      CMElementDeclaration decl = getElementDeclaration(element);
      if (decl != null) {
          return allowNewlineBefore(node, element);
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement

          break;
        // ignore omitted tag
        if (((IDOMNode) parent).getStartStructuredDocumentRegion() == null)
          continue;

        IDOMElement element = (IDOMElement) parent;
        if (element.getPrefix() != null) {
          String localName = element.getLocalName();
          // special for html:html
          if (localName != null && !localName.equals(HTML_NAME)) {
            buffer.append(indent);
          }
          continue;
        }
        else {
          String localName = element.getLocalName();
          if (HTML_NAME.equalsIgnoreCase(localName) || HEAD_NAME.equalsIgnoreCase(localName))
            break;
        }

        CMElementDeclaration decl = getElementDeclaration(element);
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement

  }

  protected INodeAdapter createAdapter(INodeNotifier target) {
    PageDirectiveWatcher result = null;
    if (target instanceof IDOMElement) {
      IDOMElement xmlElement = (IDOMElement) target;
      if (xmlElement.getNodeType() == Node.ELEMENT_NODE) {
        String nodeName = xmlElement.getNodeName();
        if (nodeName.equals("jsp:directive.page")) { //$NON-NLS-1$
          result = new PageDirectiveWatcherImpl(xmlElement);
        }

      }
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement

  }

  public static boolean isForeign(Element target) {
    if (!(target instanceof IDOMElement))
      return true;
    IDOMElement element = (IDOMElement) target;
    return !element.isGlobalTag();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.