Package de.java2html.javasource

Examples of de.java2html.javasource.JavaSource


      view.activate();
     
    } else if (source == viewJSource) {
     
      //Parse the raw text to a JavaSource object
      JavaSource jsource = null;
      try {
        String className = clazz.getCanonicalName();
        className = className.replace('.', '/');
        String sourcePath = WebappHelper.getSourcePath()+"/"+className +".java";
        jsource = new JavaSourceParser().parse(new File(sourcePath));
View Full Code Here


   * @param cl
   * @return
   * @throws IOException
   */
  public static MediaResource showjavaSource(String cl) throws IOException {
    JavaSource jsource = null;
    cl = cl.replace('.', '/');
    String javaSourcePath  = WebappHelper.getSourcePath()+"/"+cl+".java";
    File file = new File(javaSourcePath);
    if (!file.exists()) {
      javaSourcePath = WebappHelper.getBrasatoSourcePath()+"/"+cl+".java";
View Full Code Here

     *
     * @return the duplicate source code fragment
     */
    public String getFormattedSourceCode() {
        try {
            JavaSource source = new JavaSourceParser().parse(new StringReader(sourceCode));
            JavaSource2HTMLConverter converter = new JavaSource2HTMLConverter();
            StringWriter writer = new StringWriter();
            JavaSourceConversionOptions options = JavaSourceConversionOptions.getDefault();
            options.setShowLineNumbers(false);
            options.setAddLineAnchors(false);
View Full Code Here

            inputStream = classLoader.getResourceAsStream(fileName);
            if (inputStream == null) return "Unable to load file: " + fileName;

            final StringWriter writer = new StringWriter();
            final JavaSource javaSource = new JavaSourceParser().parse(inputStream);
            final JavaSource2HTMLConverter converter = new JavaSource2HTMLConverter();
            converter.convert(javaSource, JavaSourceConversionOptions.getDefault(), writer);

            return writer.toString();
View Full Code Here

     * @return the source as an HTML string
     * @throws IOException
     *             if the source code could not be read
     */
    public final String highlightSource(final InputStream file) throws IOException {
        JavaSource source = new JavaSourceParser().parse(
                new InputStreamReader(file, EncodingValidator.defaultCharset(defaultEncoding)));

        JavaSource2HTMLConverter converter = new JavaSource2HTMLConverter();
        StringWriter writer = new StringWriter();
        JavaSourceConversionOptions options = JavaSourceConversionOptions.getDefault();
View Full Code Here

TOP

Related Classes of de.java2html.javasource.JavaSource

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.