// Path: com.github.jarlakxen.scala.sbt/src/com/github/jarlakxen/scala/sbt/listener/SbtProjectFilesChangeListener.java
// public class SbtProjectFilesChangeListener implements IResourceChangeListener {
// 
// 	private static final List<String> SBT_PROJECT_FILES = asList("build.sbt", "project/plugins.sbt", "project/build.properties", "project/Build.scala");
// 	
// 	public static void register() {
// 		ResourcesPlugin.getWorkspace().addResourceChangeListener(new SbtProjectFilesChangeListener(), IResourceChangeEvent.POST_CHANGE);
// 	}
// 
// 	private SbtProjectFilesChangeListener() {
// 	}
// 
// 	@Override
// 	public void resourceChanged(IResourceChangeEvent event) {
// 		List<IProject> projects = getProjects(event.getDelta());
// 		
// 		for(IProject project : projects){
// 			new UpdateProjectJob(project).schedule();
// 		}
// 	}
// 
// 	private List<IProject> getProjects(IResourceDelta delta) {
// 		final List<IProject> projects = new ArrayList<IProject>();
// 		try {
// 			delta.accept(new IResourceDeltaVisitor() {
// 				public boolean visit(IResourceDelta delta) throws CoreException {
// 					// only interested in changed resources (not added or
// 					// removed)
// 					if (delta.getKind() != IResourceDelta.CHANGED) {
// 						return true;
// 					}
// 					// only interested in content changes
// 					if ((delta.getFlags() & IResourceDelta.CONTENT) == 0) {
// 						return true;
// 					}
// 
// 					IResource resource = delta.getResource();
// 					if (resource.getType() == IResource.FILE && isProjectFile(resource) && !projects.contains(resource.getProject())) {
// 						projects.add(resource.getProject());
// 					}
// 					return true;
// 
// 				}
// 			});
// 		} catch (CoreException ex) {
// 			UIUtil.showErrorDialog(ex.toString());
// 			SbtPlugin.logException(ex);
// 		}
// 		return projects;
// 	}
// 	
// 	private boolean isProjectFile(IResource resource){
// 		String resourcePath =  resource.getProjectRelativePath().toString();
// 		for(String projectFile : SBT_PROJECT_FILES){
// 			if(projectFile.equals(resourcePath)){
// 				return true;
// 			}
// 		}
// 		return false;
// 	}
// 
// }


import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
import com.github.jarlakxen.scala.sbt.listener.SbtProjectFilesChangeListener;
import scala.tools.eclipse.ScalaPlugin;

package com.github.jarlakxen.scala.sbt;




/**
 * The activator class controls the plug-in life cycle
 * 
 * @author Naoki Takezoe
 */
public class SbtPlugin extends AbstractUIPlugin {

	public static final String[] PROJECT_NATURES_IDS = new String[] { 
		ScalaPlugin.plugin().natureId(), 
		"org.eclipse.jdt.core.javanature",
		SbtPlugin.NATURE_ID 
	};

	/** The plug-in ID */
	public static final String PLUGIN_ID = "com.github.jarlakxen.scala.sbt"; //$NON-NLS-1$

	/** The nature ID */
	public static final String NATURE_ID = PLUGIN_ID + ".SbtProjectNature"; //$NON-NLS-1$

	// The shared instance
	private static SbtPlugin plugin;

	public static final String ICON_SETTING_KEY = "/icons/setting_key.gif";
	public static final String ICON_SETTING_VALUE = "/icons/setting_value.gif";

	/**
	 * The constructor
	 */
	public SbtPlugin() {
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
	 * )
	 */
	public void start(BundleContext context) throws Exception {
		super.start(context);
		plugin = this;

// Path: com.github.jarlakxen.scala.sbt/src/com/github/jarlakxen/scala/sbt/listener/SbtProjectFilesChangeListener.java
// public class SbtProjectFilesChangeListener implements IResourceChangeListener {
// 
// 	private static final List<String> SBT_PROJECT_FILES = asList("build.sbt", "project/plugins.sbt", "project/build.properties", "project/Build.scala");
// 	
// 	public static void register() {
// 		ResourcesPlugin.getWorkspace().addResourceChangeListener(new SbtProjectFilesChangeListener(), IResourceChangeEvent.POST_CHANGE);
// 	}
// 
// 	private SbtProjectFilesChangeListener() {
// 	}
// 
// 	@Override
// 	public void resourceChanged(IResourceChangeEvent event) {
// 		List<IProject> projects = getProjects(event.getDelta());
// 		
// 		for(IProject project : projects){
// 			new UpdateProjectJob(project).schedule();
// 		}
// 	}
// 
// 	private List<IProject> getProjects(IResourceDelta delta) {
// 		final List<IProject> projects = new ArrayList<IProject>();
// 		try {
// 			delta.accept(new IResourceDeltaVisitor() {
// 				public boolean visit(IResourceDelta delta) throws CoreException {
// 					// only interested in changed resources (not added or
// 					// removed)
// 					if (delta.getKind() != IResourceDelta.CHANGED) {
// 						return true;
// 					}
// 					// only interested in content changes
// 					if ((delta.getFlags() & IResourceDelta.CONTENT) == 0) {
// 						return true;
// 					}
// 
// 					IResource resource = delta.getResource();
// 					if (resource.getType() == IResource.FILE && isProjectFile(resource) && !projects.contains(resource.getProject())) {
// 						projects.add(resource.getProject());
// 					}
// 					return true;
// 
// 				}
// 			});
// 		} catch (CoreException ex) {
// 			UIUtil.showErrorDialog(ex.toString());
// 			SbtPlugin.logException(ex);
// 		}
// 		return projects;
// 	}
// 	
// 	private boolean isProjectFile(IResource resource){
// 		String resourcePath =  resource.getProjectRelativePath().toString();
// 		for(String projectFile : SBT_PROJECT_FILES){
// 			if(projectFile.equals(resourcePath)){
// 				return true;
// 			}
// 		}
// 		return false;
// 	}
// 
// }


// Path: com.github.jarlakxen.scala.sbt/src/com/github/jarlakxen/scala/sbt/SbtPlugin.java
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
import com.github.jarlakxen.scala.sbt.listener.SbtProjectFilesChangeListener;
import scala.tools.eclipse.ScalaPlugin;

package com.github.jarlakxen.scala.sbt;




/**
 * The activator class controls the plug-in life cycle
 * 
 * @author Naoki Takezoe
 */
public class SbtPlugin extends AbstractUIPlugin {

	public static final String[] PROJECT_NATURES_IDS = new String[] { 
		ScalaPlugin.plugin().natureId(), 
		"org.eclipse.jdt.core.javanature",
		SbtPlugin.NATURE_ID 
	};

	/** The plug-in ID */
	public static final String PLUGIN_ID = "com.github.jarlakxen.scala.sbt"; //$NON-NLS-1$

	/** The nature ID */
	public static final String NATURE_ID = PLUGIN_ID + ".SbtProjectNature"; //$NON-NLS-1$

	// The shared instance
	private static SbtPlugin plugin;

	public static final String ICON_SETTING_KEY = "/icons/setting_key.gif";
	public static final String ICON_SETTING_VALUE = "/icons/setting_value.gif";

	/**
	 * The constructor
	 */
	public SbtPlugin() {
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
	 * )
	 */
	public void start(BundleContext context) throws Exception {
		super.start(context);
		plugin = this;

		SbtProjectFilesChangeListener.register();
