1 /******************************************************************************* 2 * Copyright (c) 2000, 2006 IBM Corporation and others. 3 * All rights reserved. This program and the accompanying materials 4 * are made available under the terms of the Eclipse Public License v1.0 5 * which accompanies this distribution, and is available at 6 * http://www.eclipse.org/legal/epl-v10.html 7 * 8 * Contributors: 9 * IBM Corporation - initial API and implementation 10 *******************************************************************************/ 11 package org.eclipse.jdt.core.jdom; 12 13 /** 14 * Represents a Java compilation unit (source file with one of the 15 * {@link org.eclipse.jdt.core.JavaCore#getJavaLikeExtensions() 16 * Java-like extensions}). 17 * The corresponding syntactic unit is CompilationUnit (JLS2 7.3). 18 * Allowable child types for a compilation unit are <code>IDOMPackage</code>, <code>IDOMImport</code>, 19 * and <code>IDOMType</code>. 20 * <p> 21 * This interface is not intended to be implemented by clients. 22 * </p> 23 * @deprecated The JDOM was made obsolete by the addition in 2.0 of the more 24 * powerful, fine-grained DOM/AST API found in the 25 * org.eclipse.jdt.core.dom package. 26 */ 27 public interface IDOMCompilationUnit extends IDOMNode { 28 /** 29 * Returns the header comment for this compilation unit. The header comment 30 * appears before the first declaration in a compilation unit. 31 * The syntax for a comment corresponds to Comments (JLS2 3.7), <b>including</b> 32 * comment delimiters. 33 * 34 * @return the header comment for this compilation unit, or <code>null</code> if 35 * no header comment is present 36 */ 37 public String getHeader(); 38 /** 39 * The <code>IDOMCompilationNode</code> refinement of this <code>IDOMNode</code> 40 * method returns the name of this compilation unit. 41 * 42 * <p>The name of a compilation unit is the name of the first top-level public type 43 * defined in the compilation unit, suffixed with one of the 44 * {@link org.eclipse.jdt.core.JavaCore#getJavaLikeExtensions() 45 * Java-like extensions}. For example, if the first 46 * top-level public type defined in this compilation unit has the name "Hanoi", 47 * then name of this compilation unit is "Hanoi.java".</p> 48 * 49 * <p>In the absence of a public top-level type, the name of the first top-level 50 * type is used. In the absence of any type, the name of the compilation unit 51 * is <code>null</code>.</p> 52 * 53 * @return the name of this compilation unit, or <code>null</code> if none 54 */ 55 public String getName(); 56 /** 57 * Sets the header comment for this compilation unit. The header comment 58 * appears before the first declaration in a compilation unit. 59 * The syntax for a comment corresponds to Comments (JLS2 3.7), <b>including</b> 60 * comment delimiters. 61 * 62 * @param comment the header comment for this compilation unit, or <code>null</code> if 63 * indicating no header comment 64 */ 65 public void setHeader(String comment); 66 /** 67 * The <code>IDOMCompilationNode</code> refinement of this <code>IDOMNode</code> 68 * method has no effect (the name is computed from the types declared within it). 69 * 70 * @param name the given name 71 */ 72 public void setName(String name); 73 } 74