Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2000, 2009 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 Contributors: IBM Corporation - initial API and implementation /
package org.eclipse.jdt.internal.core.util;
import  org.eclipse.core.resources.IFile;
import  org.eclipse.core.runtime.CoreException;
An ICompilationUnit that retrieves its contents using an IFile
public class ResourceCompilationUnit extends CompilationUnit {
	private IFile file;
	public ResourceCompilationUnit(IFile fileURI location) {
		super(null/*no contents*/location == null ? file.getFullPath().toString() : location.getPath(), null/*encoding is used only when retrieving the contents*/);
		this. = file;
	public char[] getContents() {
		if (this. != null)
			return this.;   // answer the cached source
		// otherwise retrieve it
		try {
catch (CoreException e) {
New to GrepCode? Check out our FAQ X