antprompt.java

来自「SRI international 发布的OAA框架软件」· Java 代码 · 共 69 行

JAVA
69
字号
/*
#=========================================================================
# Copyright 2003 SRI International.  All rights reserved.
#
# The material contained in this file is confidential and proprietary to SRI
# International and may not be reproduced, published, or disclosed to others
# without authorization from SRI International.
#
# DISCLAIMER OF WARRANTIES
#
# SRI International MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE
# SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT
# LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
# PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SRI International SHALL NOT BE
# LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
# OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES
#=========================================================================
  Author : shardt
  Date: Sep 25, 2003
*/
package com.sri.oaa2.tools.oaatest;
import org.apache.tools.ant.*;

/** An ANT task used for user-assisted testing. Display a dialog telling the tester what
 * to do next. This is really just a stub for com.sri.calo.oaatest.Prompt, but in a
 * separate class to avoid circular build dependencies.
 * <br/>
 * &lt;taskdef name="prompt" classname="antprompt.Prompt" classpath="somedir/antprompt.jar;otherdir/oaatest.jar" / &gt; <br/>
 * Then the ant build file can use &lt;prompt message="some message"&gt; and &lt;prompt&gt;Some other message.&lt;/prompt&gt;.  
 */  
public class AntPrompt extends Task {
  public AntPrompt() {
  }
  
  public void addText(String s) throws BuildException {
    _setMessage(s);
  }
  
  public void setMessage(String s) throws BuildException {
    _setMessage(s);
  }
  
  public void execute() throws BuildException {
  /*
    try {
      Class.forName(promptClass);
    }
    catch (ClassNotFoundException e) {
      throw new BuildException("Could not find " + promptClass + 
        ".  oaatest.jar must be built before using this ANT file.");
    }
    com.sri.oaa2.tools.oaatest.Prompt.prompt(message);
  */
    Prompt.prompt(message);
  }
  
  private void _setMessage(String s) throws BuildException {
    if (message != null) {
      throw new BuildException(ERR_DUPLICATE_MESSAGE);
    }
    message = s;
  }
  
  private String message;

  //  static final String promptClass = "com.sri.oaa2.tools.oaatest.Prompt";
  static final String ERR_DUPLICATE_MESSAGE = "<prompt> can have \"message\" attribute or text contents, but not both.";
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?