|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| NoCompilerAvailable.java | - | 6.7% | 12.5% | 9.7% |
|
||||||||||||||
| 1 | /*BEGIN_COPYRIGHT_BLOCK | |
| 2 | * | |
| 3 | * Copyright (c) 2001-2010, JavaPLT group at Rice University (drjava@rice.edu) | |
| 4 | * All rights reserved. | |
| 5 | * | |
| 6 | * Redistribution and use in source and binary forms, with or without | |
| 7 | * modification, are permitted provided that the following conditions are met: | |
| 8 | * * Redistributions of source code must retain the above copyright | |
| 9 | * notice, this list of conditions and the following disclaimer. | |
| 10 | * * Redistributions in binary form must reproduce the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer in the | |
| 12 | * documentation and/or other materials provided with the distribution. | |
| 13 | * * Neither the names of DrJava, the JavaPLT group, Rice University, nor the | |
| 14 | * names of its contributors may be used to endorse or promote products | |
| 15 | * derived from this software without specific prior written permission. | |
| 16 | * | |
| 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 18 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 19 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 20 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | |
| 21 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
| 22 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 23 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
| 24 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
| 25 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | |
| 26 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
| 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 28 | * | |
| 29 | * This software is Open Source Initiative approved Open Source Software. | |
| 30 | * Open Source Initative Approved is a trademark of the Open Source Initiative. | |
| 31 | * | |
| 32 | * This file is part of DrJava. Download the current version of this project | |
| 33 | * from http://www.drjava.org/ or http://sourceforge.net/projects/drjava/ | |
| 34 | * | |
| 35 | * END_COPYRIGHT_BLOCK*/ | |
| 36 | ||
| 37 | package edu.rice.cs.drjava.model.compiler; | |
| 38 | ||
| 39 | import java.io.File; | |
| 40 | import java.util.List; | |
| 41 | import java.util.Arrays; | |
| 42 | import java.util.Set; | |
| 43 | import edu.rice.cs.drjava.DrJava; | |
| 44 | import edu.rice.cs.drjava.model.DJError; | |
| 45 | import edu.rice.cs.drjava.model.DrJavaFileUtils; | |
| 46 | import edu.rice.cs.drjava.config.OptionConstants; | |
| 47 | import edu.rice.cs.plt.reflect.JavaVersion; | |
| 48 | ||
| 49 | import javax.swing.filechooser.FileFilter; | |
| 50 | import edu.rice.cs.drjava.ui.SmartSourceFilter; | |
| 51 | ||
| 52 | /** A CompilerInterface implementation for signifying that no compiler is available. | |
| 53 | * @version $Id: NoCompilerAvailable.java 5395 2010-09-21 15:26:15Z mgricken $ | |
| 54 | */ | |
| 55 | public class NoCompilerAvailable implements CompilerInterface { | |
| 56 | public static final CompilerInterface ONLY = new NoCompilerAvailable(); | |
| 57 | private static final String MESSAGE = "No compiler is available."; | |
| 58 | ||
| 59 | 21 | private NoCompilerAvailable() { } |
| 60 | ||
| 61 | 1413 | public boolean isAvailable() { return false; } |
| 62 | ||
| 63 | 0 | public List<? extends DJError> compile(List<? extends File> files, List<? extends File> classPath, |
| 64 | List<? extends File> sourcePath, File destination, | |
| 65 | List<? extends File> bootClassPath, String sourceVersion, | |
| 66 | boolean showWarnings) { | |
| 67 | 0 | return Arrays.asList(new DJError(MESSAGE, false)); |
| 68 | } | |
| 69 | ||
| 70 | 0 | public JavaVersion version() { return JavaVersion.UNRECOGNIZED; } |
| 71 | ||
| 72 | 0 | public String getName() { return "(no compiler available)"; } |
| 73 | ||
| 74 | 0 | public String getDescription() { return getName(); } |
| 75 | ||
| 76 | /** The toString() of this class is displayed in the "Compiler" drop down on the compiler tab. | |
| 77 | * @return "None" | |
| 78 | */ | |
| 79 | 0 | @Override |
| 80 | 0 | public String toString() { return "None"; } |
| 81 | ||
| 82 | 0 | public List<File> additionalBootClassPathForInteractions() { return Arrays.<File>asList(); } |
| 83 | ||
| 84 | /** Transform the command line to be interpreted into something the Interactions JVM can use. | |
| 85 | * This replaces "java MyClass a b c" with Java code to call MyClass.main(new String[]{"a","b","c"}). | |
| 86 | * "import MyClass" is not handled here. | |
| 87 | * transformCommands should support at least "run", "java" and "applet". | |
| 88 | * @param interactionsString unprocessed command line | |
| 89 | * @return command line with commands transformed */ | |
| 90 | 0 | public String transformCommands(String interactionsString) { return interactionsString; } |
| 91 | ||
| 92 | /** Always false | |
| 93 | * @return true if the specified file is a source file for this compiler. */ | |
| 94 | 0 | public boolean isSourceFileForThisCompiler(File f) { return false; } |
| 95 | ||
| 96 | /** Return the set of source file extensions that this compiler supports. | |
| 97 | * @return the set of source file extensions that this compiler supports. */ | |
| 98 | 0 | public Set<String> getSourceFileExtensions() { return DrJavaFileUtils.getSourceFileExtensions(); } |
| 99 | ||
| 100 | /** Return the suggested file extension that will be appended to a file without extension. | |
| 101 | * @return the suggested file extension */ | |
| 102 | 0 | public String getSuggestedFileExtension() { |
| 103 | 0 | return DrJavaFileUtils.getSuggestedFileExtension(); |
| 104 | } | |
| 105 | ||
| 106 | /** Return a file filter that can be used to open files this compiler supports. | |
| 107 | * @return file filter for appropriate source files for this compiler */ | |
| 108 | 0 | public FileFilter getFileFilter() { return new SmartSourceFilter(); } |
| 109 | ||
| 110 | /** Return the extension of the files that should be opened with the "Open Folder..." command. | |
| 111 | * @return file extension for the "Open Folder..." command for this compiler. */ | |
| 112 | 0 | public String getOpenAllFilesInFolderExtension() { |
| 113 | 0 | return OptionConstants.LANGUAGE_LEVEL_EXTENSIONS[DrJava.getConfig().getSetting(OptionConstants.LANGUAGE_LEVEL)]; |
| 114 | } | |
| 115 | ||
| 116 | /** Return true if this compiler can be used in conjunction with the language level facility. | |
| 117 | * @return true if language levels can be used. */ | |
| 118 | 0 | public boolean supportsLanguageLevels() { return true; } |
| 119 | ||
| 120 | /** Return the set of keywords that should be highlighted in the specified file. | |
| 121 | * @param f file for which to return the keywords | |
| 122 | * @return the set of keywords that should be highlighted in the specified file. */ | |
| 123 | 0 | public Set<String> getKeywordsForFile(File f) { return JavacCompiler.JAVA_KEYWORDS; } |
| 124 | } |
|
||||||||||