Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2000, 2006 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html Contributors: IBM Corporation - initial API and implementation /
 
 package org.eclipse.ant.internal.ui.launchConfigurations;
 
 import java.io.File;
 import java.util.List;
 
A classpath entry that contains a set of archives for a particular ANT_HOME.

Since:
3.0
 
 	
 	public static final String TYPE_ID = "org.eclipse.ant.ui.classpathentry.antHome"//$NON-NLS-1$
 	
Local path on disk where Ant Home is located or null to indicate the use of the default Ant Home.
 
 	private String antHomeLocation = null;

Creates an AntHome entry for the default AntHome installation.
 
 	public AntHomeClasspathEntry() {
 		 = null;
 	}

Constructs an AntHome entry for the Ant installed at the specified root directory.

Parameters:
antHome path in the local file system to an Ant installation
 
 	public AntHomeClasspathEntry(String antHome) {
 		 = antHome;
 	}
 		
 	/* (non-Javadoc)
 	 * @see org.eclipse.jdt.internal.launching.AbstractRuntimeClasspathEntry#buildMemento(org.w3c.dom.Document, org.w3c.dom.Element)
 	 */
 	protected void buildMemento(Document documentElement mementothrows CoreException {
 		if ( == null) {
 			memento.setAttribute("default""true");  //$NON-NLS-1$//$NON-NLS-2$
 		} else {
 			memento.setAttribute("antHome"new Path().toString()); //$NON-NLS-1$
 		}
 	}
 	/* (non-Javadoc)
 	 * @see org.eclipse.jdt.internal.launching.IRuntimeClasspathEntry2#initializeFrom(org.w3c.dom.Element)
 	 */
 	public void initializeFrom(Element mementothrows CoreException {
 		String antHome = memento.getAttribute("antHome"); //$NON-NLS-1$
 		if (antHome != null && (antHome.length() > 0)) {
 			IPath path = new Path(antHome);
 		} else {
 			 = null;
 		}
 	}
 	/* (non-Javadoc)
 	 * @see org.eclipse.jdt.launching.IRuntimeClasspathEntry2#getTypeId()
 	 */
 	public String getTypeId() {
 		return ;
 	}
 	/* (non-Javadoc)
 	 * @see org.eclipse.jdt.launching.IRuntimeClasspathEntry2#getRuntimeClasspathEntries(org.eclipse.debug.core.ILaunchConfiguration)
 	 */
 		List libs = new ArrayList(40);
 		AntCorePreferences preferences = AntCorePlugin.getPlugin().getPreferences();
 		if ( == null) {
 			IAntClasspathEntry[] entries = preferences.getAntHomeClasspathEntries();
			for (int i = 0; i < entries.lengthi++) {
				IAntClasspathEntry entry = entries[i];
				libs.add(JavaRuntime.newStringVariableClasspathEntry(entry.getLabel()));
			}
else {
			IPath libDir = new Path().append("lib"); //$NON-NLS-1$
			String[] fileNames = lib.list();
			for (int i = 0; i < fileNames.lengthi++) {
				String name = fileNames[i];
				IPath path = new Path(name);
				String fileExtension = path.getFileExtension();
				if ("jar".equalsIgnoreCase(fileExtension)) { //$NON-NLS-1$
					libs.add(JavaRuntime.newArchiveRuntimeClasspathEntry(libDir.append(path)));
				}
			}
		}
	}
	public File resolveAntHome() throws CoreException {
		if ( == null) { //using the default ant home
			return null;
		}
		IPath libDirnew Path().append("lib"); //$NON-NLS-1$
		File liblibDir.toFile();
		File parentDirlib.getParentFile();
		if (parentDir == null || !parentDir.exists()) {
		}
		if (!lib.exists() || !lib.isDirectory()) {
		}
		return lib;
	}
	/* (non-Javadoc)
	 * @see org.eclipse.jdt.launching.IRuntimeClasspathEntry2#getName()
	 */
	public String getName() {
		if ( == null) {
		}
	}
	/* (non-Javadoc)
	 * @see org.eclipse.jdt.launching.IRuntimeClasspathEntry#getType()
	 */
	public int getType() {
	}
	/* (non-Javadoc)
	 * @see org.eclipse.jdt.launching.IRuntimeClasspathEntry2#isComposite()
	 */
	public boolean isComposite() {
		return true;
	}
	/* (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	public boolean equals(Object obj) {
		return obj instanceof AntHomeClasspathEntry &&
	}

Return whether s1 is equivalent to s2.

Parameters:
s1
s2
Returns:
whether s1 is equivalent to s2
	private boolean equalsOrNull(String s1String s2) {
		if (s1 == null || s2 == null) {
			return s1 == s2;
		return s1.equalsIgnoreCase(s2);
	}
	/* (non-Javadoc)
	 * @see java.lang.Object#hashCode()
	 */
	public int hashCode() {
		return getClass().hashCode();
	}	

Sets the ant home to use.

Parameters:
path path to toor of an ant home installation
	protected void setAntHome(String path) {
	}

Returns the ant home location

Returns:
path to root ant installation directory
	public String getAntHome() {
		if ( == null) {
			return AntCorePlugin.getPlugin().getPreferences().getAntHome();
		}
	}
New to GrepCode? Check out our FAQ X