// Path: core/fr.opensagres.eclipse.jsbuild.core/src/fr/opensagres/eclipse/jsbuild/core/IJSBuildFileNode.java
// public interface IJSBuildFileNode {
// 
// 	/**
// 	 * Returns the node name.
// 	 * 
// 	 * @return the node name.
// 	 */
// 	String getName();
// 
// 	/**
// 	 * Returns the label of the task.
// 	 * 
// 	 * @return the label of the task.
// 	 */
// 	String getLabel();
// 
// 	/**
// 	 * Returns true if the node have children and false otherwise.
// 	 * 
// 	 * @return true if the node have children and false otherwise.
// 	 */
// 	boolean hasChildren();
// 
// 	/**
// 	 * Returns the parent node.
// 	 * 
// 	 * @return the parent node.
// 	 */
// 	IJSBuildFileNode getParentNode();
// 
// 	/**
// 	 * Returns the tasks children.
// 	 * 
// 	 * @return the tasks children.
// 	 * @throws CoreException
// 	 */
// 	Collection<ITask> getChildNodes();
// 
// 	/**
// 	 * Returns the owner build file.
// 	 * 
// 	 * @return the owner build file.
// 	 */
// 	IJSBuildFile getBuildFile();
// 
// 	/**
// 	 * Returns the factory id {@link IJSBuildFileFactory} which have created
// 	 * this instance.
// 	 * 
// 	 * @return the factory id {@link IJSBuildFileFactory} which have created
// 	 *         this instance.
// 	 */
// 	String getFactoryId();
// 
// 	/**
// 	 * Returns the location of the node and null otherwise.
// 	 * @param document 
// 	 * 
// 	 * @return the location of the node and null otherwise.
// 	 */
// 	Location getLocation(String text);
// }
// 
// Path: core/fr.opensagres.eclipse.jsbuild.core/src/fr/opensagres/eclipse/jsbuild/core/Location.java
// public class Location {
// 
// 	private final int start;
// 	private final int length;
// 
// 	public Location(int start, int length) {
// 		this.start = start;
// 		this.length = length;
// 	}
// 
// 	public int getStart() {
// 		return start;
// 	}
// 
// 	public int getLength() {
// 		return length;
// 	}
// 
// }


import java.text.MessageFormat;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.text.IDocument;
import org.eclipse.ui.IEditorDescriptor;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorRegistry;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.ui.texteditor.ITextEditor;
import fr.opensagres.eclipse.jsbuild.core.IJSBuildFileNode;
import fr.opensagres.eclipse.jsbuild.core.Location;

			IJSBuildFileNode element) {
		revealInEditor(editorPart, element, null);
	}

	public static void revealInEditor(IEditorPart editorPart,
			IJSBuildFileNode element, IWorkbenchPage page) {
		if (element == null)
			return;

		ITextEditor textEditor = null;
		if (editorPart instanceof ITextEditor)
			textEditor = (ITextEditor) editorPart;
		else if (editorPart instanceof IAdaptable)
			textEditor = (ITextEditor) editorPart.getAdapter(ITextEditor.class);
		if (textEditor != null) {
			IDocument document = textEditor.getDocumentProvider().getDocument(
					editorPart.getEditorInput());
			Location location = element.getLocation(document != null ? document
					.get() : null);
			if (location != null) {
				int start = location.getStart();
				if (start > 0) {
					int length = location.getLength();
					textEditor.selectAndReveal(start, length);
					if (page != null) {
						page.activate(editorPart);
					}
				}
			}
		} else {

// Path: core/fr.opensagres.eclipse.jsbuild.core/src/fr/opensagres/eclipse/jsbuild/core/IJSBuildFileNode.java
// public interface IJSBuildFileNode {
// 
// 	/**
// 	 * Returns the node name.
// 	 * 
// 	 * @return the node name.
// 	 */
// 	String getName();
// 
// 	/**
// 	 * Returns the label of the task.
// 	 * 
// 	 * @return the label of the task.
// 	 */
// 	String getLabel();
// 
// 	/**
// 	 * Returns true if the node have children and false otherwise.
// 	 * 
// 	 * @return true if the node have children and false otherwise.
// 	 */
// 	boolean hasChildren();
// 
// 	/**
// 	 * Returns the parent node.
// 	 * 
// 	 * @return the parent node.
// 	 */
// 	IJSBuildFileNode getParentNode();
// 
// 	/**
// 	 * Returns the tasks children.
// 	 * 
// 	 * @return the tasks children.
// 	 * @throws CoreException
// 	 */
// 	Collection<ITask> getChildNodes();
// 
// 	/**
// 	 * Returns the owner build file.
// 	 * 
// 	 * @return the owner build file.
// 	 */
// 	IJSBuildFile getBuildFile();
// 
// 	/**
// 	 * Returns the factory id {@link IJSBuildFileFactory} which have created
// 	 * this instance.
// 	 * 
// 	 * @return the factory id {@link IJSBuildFileFactory} which have created
// 	 *         this instance.
// 	 */
// 	String getFactoryId();
// 
// 	/**
// 	 * Returns the location of the node and null otherwise.
// 	 * @param document 
// 	 * 
// 	 * @return the location of the node and null otherwise.
// 	 */
// 	Location getLocation(String text);
// }
// 
// Path: core/fr.opensagres.eclipse.jsbuild.core/src/fr/opensagres/eclipse/jsbuild/core/Location.java
// public class Location {
// 
// 	private final int start;
// 	private final int length;
// 
// 	public Location(int start, int length) {
// 		this.start = start;
// 		this.length = length;
// 	}
// 
// 	public int getStart() {
// 		return start;
// 	}
// 
// 	public int getLength() {
// 		return length;
// 	}
// 
// }


// Path: core/fr.opensagres.eclipse.jsbuild.ui/src/fr/opensagres/eclipse/jsbuild/internal/ui/EditorUtility.java
import java.text.MessageFormat;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.text.IDocument;
import org.eclipse.ui.IEditorDescriptor;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorRegistry;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.ui.texteditor.ITextEditor;
import fr.opensagres.eclipse.jsbuild.core.IJSBuildFileNode;
import fr.opensagres.eclipse.jsbuild.core.Location;

			IJSBuildFileNode element) {
		revealInEditor(editorPart, element, null);
	}

	public static void revealInEditor(IEditorPart editorPart,
			IJSBuildFileNode element, IWorkbenchPage page) {
		if (element == null)
			return;

		ITextEditor textEditor = null;
		if (editorPart instanceof ITextEditor)
			textEditor = (ITextEditor) editorPart;
		else if (editorPart instanceof IAdaptable)
			textEditor = (ITextEditor) editorPart.getAdapter(ITextEditor.class);
		if (textEditor != null) {
			IDocument document = textEditor.getDocumentProvider().getDocument(
					editorPart.getEditorInput());
			Location location = element.getLocation(document != null ? document
					.get() : null);
			if (location != null) {
				int start = location.getStart();
				if (start > 0) {
					int length = location.getLength();
					textEditor.selectAndReveal(start, length);
					if (page != null) {
						page.activate(editorPart);
					}
				}
			}
		} else {

			Location location = element.getLocation(null);
