Package com.google.gxp.compiler.alerts

Examples of com.google.gxp.compiler.alerts.SourcePosition


   * specific alerts.
   */
  public final void assertIllegalTypeDetected(String prefix, String suffix) throws Exception {
    for (TestType testType : TEST_TYPES) {
      compile(prefix + CharEscapers.xmlEscaper().escape(testType.getType()) + suffix);
      SourcePosition errorPos = pos(2, 1);
      for (OutputLanguage outputLanguage : testType.getIllegalIn()) {
        assertAlert(new IllegalTypeError(errorPos, outputLanguage.getDisplay(), testType.getType()));
      }
      assertNoUnexpectedAlerts();
    }
View Full Code Here


  public void testCall_nonEmptyNonContainer() throws Exception {
    String startCall = "<my:" + getTemplateBaseName() + ">";
    String endCall = "</my:" + getTemplateBaseName() + ">";
    compile(startCall + "stuff inside" + endCall);
    SourcePosition errorPos = pos(2, endCall.length());
    assertAlert(new BadNodePlacementError(errorPos, "text",
                                          "inside " + startCall));
    assertNoUnexpectedAlerts();
  }
View Full Code Here

    inputStream.close();
    return eventHandler.getSchema();
  }

  public static Schema getSchema(FileRef input, AlertSink alertSink) {
    SourcePosition pos = new SourcePosition(input);
    try {
      return Preconditions.checkNotNull(INSTANCE.parse(input));
    } catch (SAXException saxException) {
      alertSink.add(new SaxAlert(pos, Severity.ERROR, saxException));
      return null;
View Full Code Here

     */
    private SourcePosition getSourcePosition() {
      // Lines and columns start at 1. A value of 0 means we don't know, so in
      // that case just use the whole file as the position.
      if ((lineNumber > 0) && (columnNumber > 0)) {
        return new SourcePosition(source, lineNumber, columnNumber);
      } else {
        return new SourcePosition(source);
      }
    }
View Full Code Here

  private Schema addNonMarkupSchema(String name, String contentType, Schema msgSchema,
                                    String cppType, String cppAppender, String cppImport,
                                    String javaType, String javaAppender, String javaImport,
                                    String javaScriptType, String javaScriptImport,
                                    String scalaType, String scalaAppender, String scalaImport) {
    Schema schema = new Schema(new SourcePosition(name), "<schema>",
                               name, "", contentType, false, contentType, null,
                               cppType, cppAppender, ImmutableList.of(cppImport),
                               javaType, javaAppender, ImmutableList.of(javaImport),
                               javaScriptType, ImmutableList.of(javaScriptImport),
                               scalaType, scalaAppender, ImmutableList.of(scalaImport),
View Full Code Here

  /**
   * Creates a {@code SourcePosition} for the file that you most recently
   * compiled.
   */
  protected final SourcePosition pos() {
    return new SourcePosition(getSource());
  }
View Full Code Here

  /**
   * Creates a {@code SourcePosition} for the file that you most recently
   * compiled with the specified line and column.
   */
  protected final SourcePosition pos(int line, int column) {
    return new SourcePosition(getSource(), line, column);
  }
View Full Code Here

TOP

Related Classes of com.google.gxp.compiler.alerts.SourcePosition

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.