|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| NoJavadocAvailable.java | - | 25% | 20% | 22.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.javadoc; | |
| 38 | ||
| 39 | import java.io.File; | |
| 40 | import java.io.IOException; | |
| 41 | import edu.rice.cs.drjava.model.DJError; | |
| 42 | import edu.rice.cs.drjava.model.GlobalModel; | |
| 43 | import edu.rice.cs.drjava.model.OpenDefinitionsDocument; | |
| 44 | import edu.rice.cs.drjava.model.FileSaveSelector; | |
| 45 | import edu.rice.cs.drjava.model.compiler.CompilerErrorModel; | |
| 46 | import edu.rice.cs.util.DirectorySelector; | |
| 47 | ||
| 48 | /** Javadoc model to use when javadoc is unavailable. | |
| 49 | * @version $Id: NoJavadocAvailable.java 5175 2010-01-20 08:46:32Z mgricken $ | |
| 50 | */ | |
| 51 | public class NoJavadocAvailable implements JavadocModel { | |
| 52 | ||
| 53 | private final JavadocEventNotifier _notifier = new JavadocEventNotifier(); | |
| 54 | private final CompilerErrorModel _javadocErrorModel; | |
| 55 | ||
| 56 | 2826 | public NoJavadocAvailable(GlobalModel model) { |
| 57 | 2826 | DJError e = new DJError("The javadoc feature is not available.", false); |
| 58 | 2826 | _javadocErrorModel = new CompilerErrorModel(new DJError[]{e}, model); |
| 59 | } | |
| 60 | ||
| 61 | 314 | public boolean isAvailable() { return false; } |
| 62 | ||
| 63 | ||
| 64 | /** Add a JavadocListener to the model. | |
| 65 | * @param listener a listener that reacts to Javadoc events | |
| 66 | */ | |
| 67 | 0 | public void addListener(JavadocListener listener) { _notifier.addListener(listener); } |
| 68 | ||
| 69 | /** Remove a JavadocListener from the model. If the listener is not instaled, this method has no effect. | |
| 70 | * @param listener a listener that reacts to Javadoc events | |
| 71 | */ | |
| 72 | 0 | public void removeListener(JavadocListener listener) { _notifier.removeListener(listener); } |
| 73 | ||
| 74 | /** Removes all JavadocListeners from this model. */ | |
| 75 | 0 | public void removeAllListeners() { _notifier.removeAllListeners(); } |
| 76 | ||
| 77 | ||
| 78 | /** Accessor for the Javadoc error model. */ | |
| 79 | 0 | public CompilerErrorModel getJavadocErrorModel() { return _javadocErrorModel; } |
| 80 | ||
| 81 | /** Clears all current Javadoc errors. */ | |
| 82 | 0 | public void resetJavadocErrors() { /* ignore */ } |
| 83 | ||
| 84 | /** Suggests a default location for generating Javadoc, based on the given document's source root. (Appends | |
| 85 | * JavadocModel.SUGGESTED_DIR_NAME to the sourceroot.) | |
| 86 | * @param doc Document with the source root to use as the default. | |
| 87 | * @return Suggested destination directory, or null if none could be | |
| 88 | * determined. | |
| 89 | */ | |
| 90 | 0 | public File suggestJavadocDestination(OpenDefinitionsDocument doc) { return null; } |
| 91 | ||
| 92 | /** Javadocs all open documents, after ensuring that all are saved. | |
| 93 | * The user provides a destination, and the gm provides the package info. | |
| 94 | * | |
| 95 | * @param select a command object for selecting a directory and warning a user | |
| 96 | * about bad input | |
| 97 | * @param saver a command object for saving a document (if it moved/changed) | |
| 98 | * | |
| 99 | * @throws IOException if there is a problem manipulating files | |
| 100 | */ | |
| 101 | 0 | public void javadocAll(DirectorySelector select, FileSaveSelector saver) throws IOException { |
| 102 | 0 | _notifier.javadocStarted(); |
| 103 | 0 | _notifier.javadocEnded(false, null, true); |
| 104 | } | |
| 105 | ||
| 106 | /** Generates Javadoc for the given document only, after ensuring it is saved. Saves the output to a temporary | |
| 107 | * directory, which is provided in the javadocEnded event on the provided listener. | |
| 108 | * @param doc Document to generate Javadoc for | |
| 109 | * @param saver a command object for saving the document (if it moved/changed) | |
| 110 | * @throws IOException if there is a problem manipulating files | |
| 111 | */ | |
| 112 | 0 | public void javadocDocument(OpenDefinitionsDocument doc, FileSaveSelector saver) throws IOException { |
| 113 | 0 | _notifier.javadocStarted(); |
| 114 | 0 | _notifier.javadocEnded(false, null, true); |
| 115 | } | |
| 116 | ||
| 117 | } |
|
||||||||||