001// Copyright 2005-2006 Ferdinand Prantl <prantl@users.sourceforge.net> 002// Copyright 2001-2004 The Apache Software Foundation 003// All rights reserved. 004// 005// Licensed under the Apache License, Version 2.0 (the "License"); 006// you may not use this file except in compliance with the License. 007// You may obtain a copy of the License at 008// 009// http://www.apache.org/licenses/LICENSE-2.0 010// 011// Unless required by applicable law or agreed to in writing, software 012// distributed under the License is distributed on an "AS IS" BASIS, 013// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014// See the License for the specific language governing permissions and 015// limitations under the License. 016// 017// See http://ant-eclipse.sourceforge.net for the most recent version 018// and more information. 019 020package prantl.ant.eclipse; 021 022import org.apache.tools.ant.BuildException; 023import org.apache.tools.ant.types.Reference; 024 025/** 026 * Describes an element <tt>classpathentry</tt> under the element classpath, 027 * specifically the kind "src". Presets the value "" for the attribute <tt>path</tt> to 028 * include all sources in the base directory by default. An instance of this element will 029 * be created automatically with the default settings if none present. 030 * 031 * @since Ant-Eclipse 1.0 032 * @author Ferdinand Prantl <prantl@users.sourceforge.net> 033 */ 034public class ClassPathEntrySourceElement extends ClassPathEntryPathElement { 035 036 private String excluding = null; 037 038 private String output = null; 039 040 private boolean explicit = false; 041 042 /** 043 * Creates a new instance of the classpathentry-src element. 044 * 045 * @since Ant-Eclipse 1.0 046 */ 047 public ClassPathEntrySourceElement() { 048 super.setPath(""); 049 } 050 051 /** 052 * Returns a list of project-relative paths to be excluded from the source path 053 * delimited by vertical lines ('|') or <tt>null</tt> if it has not been set, which 054 * means do not exlude anything. 055 * 056 * @return A list of project-relative paths delimited by vertical lines ('|') to 057 * exclude or <tt>null</tt> if not having been set. 058 */ 059 public String getExcluding() { 060 return excluding; 061 } 062 063 /** 064 * Sets the list of project-relative paths to be excluded from the source path 065 * delimited by vertical lines ('|'). 066 * 067 * @param value 068 * The list of project-relative paths to be excluded from the sourcepath. 069 * @since Ant-Eclipse 1.0 070 */ 071 public void setExcluding(String value) { 072 excluding = value; 073 } 074 075 /** 076 * Returns a source-specific output directory to compile the Java classes there or 077 * <tt>null</tt> if it has not been set, which means to use the common one. 078 * 079 * @return A source-specific output directory or <tt>null</tt> if not having been 080 * set. 081 */ 082 public String getOutput() { 083 return output; 084 } 085 086 /** 087 * Sets the source-specific output directory to compile the Java classes there. 088 * 089 * @param value 090 * The source-specific output directory. 091 * @since Ant-Eclipse 1.0 092 */ 093 public void setOutput(String value) { 094 output = value; 095 } 096 097 /** 098 * Sets the path of the classpathentry element. 099 * 100 * @param value 101 * A kind-of-element specific path value. 102 * @throws BuildException 103 * If an attribute <tt>pathref</tt> has been set. 104 * @since Ant-Eclipse 1.0 105 */ 106 public void setPath(String value) { 107 explicit = true; 108 super.setPath(value); 109 } 110 111 /** 112 * Sets the reference to a path of the classpathentry element. Additionally resets the 113 * eventually present attribute <tt>path</tt> if it was set to the current directory 114 * by default. 115 * 116 * @param value 117 * A reference to the kind-of-element specific path value. 118 * @throws BuildException 119 * If an attribute <tt>pathref</tt> has been set. 120 * @since Ant-Eclipse 1.0 121 */ 122 public void setPathRef(Reference value) { 123 if (!explicit) 124 setPath(null); 125 super.setPathRef(value); 126 } 127 128}