Package com.google.collide.client.code.autocomplete.html.HtmlAutocompleteProposals

Examples of com.google.collide.client.code.autocomplete.html.HtmlAutocompleteProposals.HtmlProposalWithContext


        throw new IllegalStateException(
            "Unexpected mode: " + proposal.getSyntaxType().getName());
      }
    }

    HtmlProposalWithContext htmlProposal = (HtmlProposalWithContext) proposal;
    AutocompleteProposal selectedProposal = proposal.getItem();
    String triggeringString = proposal.getContext().getTriggeringString();
    String selectedName = selectedProposal.getName();

    switch (htmlProposal.getType()) {
      case ELEMENT:
        if (htmlAttributes.isSelfClosedTag(selectedName)) {
          return new DefaultAutocompleteResult(
              selectedName + ELEMENT_SELF_CLOSE, triggeringString,
              selectedName.length());
        }
        return new DefaultAutocompleteResult(
            selectedName + ELEMENT_SEPARATOR_CLOSE + ELEMENT_SEPARATOR_OPEN_FINISHTAG
                + selectedName + ELEMENT_SEPARATOR_CLOSE, triggeringString,
            selectedName.length() + ELEMENT_SEPARATOR_CLOSE.length());

      case ATTRIBUTE:
        return new DefaultAutocompleteResult(
            selectedName + ATTRIBUTE_SEPARATOR_OPEN + ATTRIBUTE_SEPARATOR_CLOSE,
            triggeringString, selectedName.length() + ATTRIBUTE_SEPARATOR_OPEN.length());

      default:
        throw new IllegalStateException(
            "Invocation of this method in not allowed for type " + htmlProposal.getType());
    }
  }
View Full Code Here

TOP

Related Classes of com.google.collide.client.code.autocomplete.html.HtmlAutocompleteProposals.HtmlProposalWithContext

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.