// Path: grunt/tern.eclipse.ide.grunt/src/tern/eclipse/ide/grunt/internal/query/TernGruntTaskQuery.java
// public class TernGruntTaskQuery extends TernQuery {
// 
// 	public TernGruntTaskQuery(String name) {
// 		super("grunt-task");
// 		super.add("name", name);
// 	}
// 
// 	public static Location getLocation(ITask task, String text) {
// 		IFile gruntFile = task.getBuildFile().getBuildFileResource();
// 		String taskName = task.getName();
// 		return getLocation(gruntFile, taskName, text);
// 	}
// 
// 	public static Location getLocation(IFile gruntFile, String taskName,
// 			String text) {
// 		try {
// 			IIDETernProject ternProject = TernCorePlugin
// 					.getTernProject(gruntFile.getProject());
// 			TernGruntTaskQuery query = new TernGruntTaskQuery(taskName);
// 			ITernFile ternFile = text != null ? new TernTextFile(gruntFile,
// 					text) : ternProject.getFile(gruntFile);
// 			query.setFile(ternFile.getFileName());
// 			LocationCollector collector = new LocationCollector();
// 			ternProject.request(query, ternFile, collector);
// 			return collector.getLocation();
// 		} catch (Exception e) {
// 			Logger.logException(e);
// 		}
// 		return null;
// 	}
// 
// 	private static class LocationCollector implements ITernDefinitionCollector {
// 
// 		private Location location;
// 
// 		@Override
// 		public void setDefinition(String filename, Long start, Long end) {
// 			if (start != null) {
// 				int s = start.intValue();
// 				int length = end != null ? end.intValue() - s : 0;
// 				location = new Location(s, length);
// 			}
// 		}
// 
// 		public Location getLocation() {
// 			return location;
// 		}
// 	}
// 
// }
// 
// Path: core/fr.opensagres.eclipse.jsbuild.core/src/fr/opensagres/eclipse/jsbuild/core/ITask.java
// public interface ITask extends IJSBuildFileNode {
// 
// 	ITask[] EMPTY_TASK = new ITask[0];
// 
// 	/**
// 	 * Returns true if this task is the default task and false otherwise.
// 	 * 
// 	 * @return true if this task is the default task and false otherwise.
// 	 */
// 	boolean isDefault();
// 
// }
// 
// 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.core/src/fr/opensagres/eclipse/jsbuild/core/SimpleTask.java
// public class SimpleTask extends AbstractTask {
// 
// 	public SimpleTask(String name, IJSBuildFileNode parent) {
// 		super(name, parent);
// 	}
// 
// 	@Override
// 	public Collection<ITask> getChildNodes() {
// 		return Collections.emptyList();
// 	}
// 
// 	@Override
// 	public boolean isDefault() {
// 		return false;
// 	}
// }
// 
// Path: grunt/fr.opensagres.eclipse.jsbuild.grunt.core/src/fr/opensagres/eclipse/jsbuild/grunt/core/IGruntTarget.java
// public interface IGruntTarget extends ITask {
// 
// }


import tern.eclipse.ide.grunt.internal.query.TernGruntTaskQuery;
import fr.opensagres.eclipse.jsbuild.core.ITask;
import fr.opensagres.eclipse.jsbuild.core.Location;
import fr.opensagres.eclipse.jsbuild.core.SimpleTask;
import fr.opensagres.eclipse.jsbuild.grunt.core.IGruntTarget;

/**
 *  Copyright (c) 2013-2014 Angelo ZERR.
 *  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:
 *  Angelo Zerr <angelo.zerr@gmail.com> - initial API and implementation
 */
package tern.eclipse.ide.grunt.internal;


/**
 * Grunt target implementation.
 *
 */
public class GruntTarget extends SimpleTask implements IGruntTarget {

	private final String targetName;
	private final String targetLabel;

	public GruntTarget(String name, ITask parent) {
		super(name, parent);
		this.targetName = new StringBuilder(parent.getName()).append(":")
				.append(name).toString();
		this.targetLabel = name;
	}

	@Override
	public String getName() {
		return targetName;
	}

	@Override
	public String getLabel() {
		return targetLabel;
	}

	@Override

// Path: grunt/tern.eclipse.ide.grunt/src/tern/eclipse/ide/grunt/internal/query/TernGruntTaskQuery.java
// public class TernGruntTaskQuery extends TernQuery {
// 
// 	public TernGruntTaskQuery(String name) {
// 		super("grunt-task");
// 		super.add("name", name);
// 	}
// 
// 	public static Location getLocation(ITask task, String text) {
// 		IFile gruntFile = task.getBuildFile().getBuildFileResource();
// 		String taskName = task.getName();
// 		return getLocation(gruntFile, taskName, text);
// 	}
// 
// 	public static Location getLocation(IFile gruntFile, String taskName,
// 			String text) {
// 		try {
// 			IIDETernProject ternProject = TernCorePlugin
// 					.getTernProject(gruntFile.getProject());
// 			TernGruntTaskQuery query = new TernGruntTaskQuery(taskName);
// 			ITernFile ternFile = text != null ? new TernTextFile(gruntFile,
// 					text) : ternProject.getFile(gruntFile);
// 			query.setFile(ternFile.getFileName());
// 			LocationCollector collector = new LocationCollector();
// 			ternProject.request(query, ternFile, collector);
// 			return collector.getLocation();
// 		} catch (Exception e) {
// 			Logger.logException(e);
// 		}
// 		return null;
// 	}
// 
// 	private static class LocationCollector implements ITernDefinitionCollector {
// 
// 		private Location location;
// 
// 		@Override
// 		public void setDefinition(String filename, Long start, Long end) {
// 			if (start != null) {
// 				int s = start.intValue();
// 				int length = end != null ? end.intValue() - s : 0;
// 				location = new Location(s, length);
// 			}
// 		}
// 
// 		public Location getLocation() {
// 			return location;
// 		}
// 	}
// 
// }
// 
// Path: core/fr.opensagres.eclipse.jsbuild.core/src/fr/opensagres/eclipse/jsbuild/core/ITask.java
// public interface ITask extends IJSBuildFileNode {
// 
// 	ITask[] EMPTY_TASK = new ITask[0];
// 
// 	/**
// 	 * Returns true if this task is the default task and false otherwise.
// 	 * 
// 	 * @return true if this task is the default task and false otherwise.
// 	 */
// 	boolean isDefault();
// 
// }
// 
// 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.core/src/fr/opensagres/eclipse/jsbuild/core/SimpleTask.java
// public class SimpleTask extends AbstractTask {
// 
// 	public SimpleTask(String name, IJSBuildFileNode parent) {
// 		super(name, parent);
// 	}
// 
// 	@Override
// 	public Collection<ITask> getChildNodes() {
// 		return Collections.emptyList();
// 	}
// 
// 	@Override
// 	public boolean isDefault() {
// 		return false;
// 	}
// }
// 
// Path: grunt/fr.opensagres.eclipse.jsbuild.grunt.core/src/fr/opensagres/eclipse/jsbuild/grunt/core/IGruntTarget.java
// public interface IGruntTarget extends ITask {
// 
// }


// Path: grunt/tern.eclipse.ide.grunt/src/tern/eclipse/ide/grunt/internal/GruntTarget.java
import tern.eclipse.ide.grunt.internal.query.TernGruntTaskQuery;
import fr.opensagres.eclipse.jsbuild.core.ITask;
import fr.opensagres.eclipse.jsbuild.core.Location;
import fr.opensagres.eclipse.jsbuild.core.SimpleTask;
import fr.opensagres.eclipse.jsbuild.grunt.core.IGruntTarget;

/**
 *  Copyright (c) 2013-2014 Angelo ZERR.
 *  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:
 *  Angelo Zerr <angelo.zerr@gmail.com> - initial API and implementation
 */
package tern.eclipse.ide.grunt.internal;


/**
 * Grunt target implementation.
 *
 */
public class GruntTarget extends SimpleTask implements IGruntTarget {

	private final String targetName;
	private final String targetLabel;

	public GruntTarget(String name, ITask parent) {
		super(name, parent);
		this.targetName = new StringBuilder(parent.getName()).append(":")
				.append(name).toString();
		this.targetLabel = name;
	}

	@Override
	public String getName() {
		return targetName;
	}

	@Override
	public String getLabel() {
		return targetLabel;
	}

	@Override

	public Location getLocation(String text) {
