package org.ant4eclipse.ant.platform.core.task; import java.io.File; import org.ant4eclipse.ant.platform.core.EclipseProjectComponent; import org.ant4eclipse.ant.platform.core.delegate.EclipseProjectDelegate; import org.ant4eclipse.lib.platform.model.resource.EclipseProject; import org.ant4eclipse.lib.platform.model.resource.Workspace; import org.ant4eclipse.lib.platform.model.resource.role.ProjectRole; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Reference; public abstract class AbstractAnt4EclipseFileSet extends AbstractAnt4EclipseResourceCollection implements EclipseProjectComponent { /** 'ant-provided' attributes **/ /** the ant attribute 'useDefaultExcludes' */ private boolean _useDefaultExcludes = true; /** the ant attribute 'caseSensitive' */ private boolean _caseSensitive = false; /** 'derived' attributes **/ /** the eclipse project delegate */ private EclipseProjectDelegate _eclipseProjectDelegate; /** * <p> * Creates a new instance of type {@link PdeProjectFileSet}. * </p> * * @param project * the ant project */ public AbstractAnt4EclipseFileSet(Project project) { super(project); // create the project delegate this._eclipseProjectDelegate = new EclipseProjectDelegate(this); } /** * {@inheritDoc} */ @Override public void setRefid(Reference ref) { if (isWorkspaceDirectorySet() || isProjectNameSet()) { throw tooManyAttributes(); } super.setRefid(ref); } /** * <p> * Sets whether default exclusions should be used or not. * </p> * * @param useDefaultExcludes * <code>boolean</code>. */ public synchronized void setDefaultexcludes(boolean useDefaultExcludes) { if (isReference()) { throw tooManyAttributes(); } this._useDefaultExcludes = useDefaultExcludes; } /** * <p> * Whether default exclusions should be used or not. * </p> * * @return the default exclusions value. */ public synchronized boolean getDefaultexcludes() { return isReference() ? getRef(getProject()).getDefaultexcludes() : this._useDefaultExcludes; } /** * <p> * Sets case sensitivity of the file system. * </p> * * @param caseSensitive * <code>boolean</code>. */ public synchronized void setCaseSensitive(boolean caseSensitive) { if (isReference()) { throw tooManyAttributes(); } this._caseSensitive = caseSensitive; } /** * <p> * Find out if the file set is case sensitive. * </p> * * @return <code>boolean</code> indicating whether the file set is case sensitive. */ public synchronized boolean isCaseSensitive() { return isReference() ? getRef(getProject()).isCaseSensitive() : this._caseSensitive; } /** * {@inheritDoc} */ public void ensureRole(Class<? extends ProjectRole> projectRoleClass) { this._eclipseProjectDelegate.ensureRole(projectRoleClass); } /** * {@inheritDoc} */ public EclipseProject getEclipseProject() throws BuildException { return this._eclipseProjectDelegate.getEclipseProject(); } /** * {@inheritDoc} */ public final Workspace getWorkspace() { return this._eclipseProjectDelegate.getWorkspace(); } /** * {@inheritDoc} */ public final File getWorkspaceDirectory() { return this._eclipseProjectDelegate.getWorkspaceDirectory(); } /** * {@inheritDoc} */ public final boolean isProjectNameSet() { return this._eclipseProjectDelegate.isProjectNameSet(); } /** * {@inheritDoc} */ public final boolean isWorkspaceDirectorySet() { return this._eclipseProjectDelegate.isWorkspaceDirectorySet(); } /** * {@inheritDoc} */ public final void requireWorkspaceAndProjectNameSet() { this._eclipseProjectDelegate.requireWorkspaceAndProjectNameSet(); } /** * {@inheritDoc} */ public String getWorkspaceId() { return this._eclipseProjectDelegate.getWorkspaceId(); } /** * {@inheritDoc} */ public boolean isWorkspaceIdSet() { return this._eclipseProjectDelegate.isWorkspaceIdSet(); } /** * {@inheritDoc} */ public void requireWorkspaceDirectoryOrWorkspaceIdSet() { this._eclipseProjectDelegate.requireWorkspaceDirectoryOrWorkspaceIdSet(); } /** * {@inheritDoc} */ public void setWorkspaceId(String identifier) { this._eclipseProjectDelegate.setWorkspaceId(identifier); } /** * {@inheritDoc} */ @Deprecated public void setProject(File projectPath) { this._eclipseProjectDelegate.setProject(projectPath); } /** * {@inheritDoc} */ public final void setProjectName(String projectName) { this._eclipseProjectDelegate.setProjectName(projectName); } /** * {@inheritDoc} */ @Deprecated public final void setWorkspace(String workspace) { this._eclipseProjectDelegate.setWorkspace(workspace); } /** * {@inheritDoc} */ public final void setWorkspaceDirectory(String workspaceDirectory) { this._eclipseProjectDelegate.setWorkspaceDirectory(workspaceDirectory); } }