// Path: org.eclipse.ec4e/src/main/java/org/eclipse/ec4e/EditorConfigPlugin.java
// public class EditorConfigPlugin extends AbstractUIPlugin {
// 
// 	// The plug-in ID
// 	public static final String PLUGIN_ID = "org.eclipse.ec4e"; //$NON-NLS-1$
// 
// 	// The shared instance
// 	private static EditorConfigPlugin plugin;
// 
// 	/**
// 	 * The constructor
// 	 */
// 	public EditorConfigPlugin() {
// 	}
// 
// 	@Override
// 	public void start(BundleContext context) throws Exception {
// 		super.start(context);
// 		plugin = this;
// 		IDEEditorConfigManager.getInstance().init();
// 	}
// 
// 	@Override
// 	public void stop(BundleContext context) throws Exception {
// 		IDEEditorConfigManager.getInstance().dispose();
// 		plugin = null;
// 		super.stop(context);
// 	}
// 
// 	/**
// 	 * Returns the shared instance
// 	 *
// 	 * @return the shared instance
// 	 */
// 	public static EditorConfigPlugin getDefault() {
// 		return plugin;
// 	}
// 
// 	/**
// 	 * Utility method to log errors.
// 	 *
// 	 * @param thr
// 	 *            The exception through which we noticed the error
// 	 */
// 	public static void logError(final Throwable thr) {
// 		getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, 0, thr.getMessage(), thr));
// 	}
// 
// 	/**
// 	 * Utility method to log errors.
// 	 *
// 	 * @param message
// 	 *            User comprehensible message
// 	 * @param thr
// 	 *            The exception through which we noticed the error
// 	 */
// 	public static void logError(final String message, final Throwable thr) {
// 		getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, 0, message, thr));
// 	}
// 
// 	@Override
// 	protected void initializeImageRegistry(ImageRegistry registry) {
// 		EditorConfigImages.initalize(registry);
// 	}
// }
// 
// Path: org.eclipse.ec4e/src/main/java/org/eclipse/ec4e/internal/EditorConfigMessages.java
// public class EditorConfigMessages extends NLS {
// 
// 	private static final String BUNDLE_NAME = "org.eclipse.ec4e.internal.EditorConfigMessages"; //$NON-NLS-1$
// 
// 	// Buttons
// 	public static String Browse_button;
// 
// 	// Wizards
// 	public static String NewEditorConfigWizard_windowTitle;
// 	public static String NewEditorConfigFileWizardPage_title;
// 	public static String NewEditorConfigFileWizardPage_description;
// 	public static String NewEditorConfigFileWizardPage_folderText_Label;
// 	public static String NewEditorConfigFileWizardPage_containerSelectionDialog_title;
// 	public static String NewEditorConfigFileWizardPage_folder_required_error;
// 	public static String NewEditorConfigFileWizardPage_folder_noexists_error;
// 	public static String NewEditorConfigFileWizardPage_project_noaccessible_error;
// 	public static String NewEditorConfigFileWizardPage_folder_already_editorconfig_error;
// 
// 	// Search
// 	public static String EditorConfigSearchQuery_label;
// 	public static String EditorConfigSearchQuery_singularReference;
// 	public static String EditorConfigSearchQuery_pluralReferences;
// 
// 	static {
// 		NLS.initializeMessages(BUNDLE_NAME, EditorConfigMessages.class);
// 	}
// 
// }


import org.ec4j.core.model.Section;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceProxy;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Status;
import org.eclipse.ec4e.EditorConfigPlugin;
import org.eclipse.ec4e.internal.EditorConfigMessages;
import org.eclipse.osgi.util.NLS;
import org.eclipse.search.internal.ui.text.FileMatch;
import org.eclipse.search.internal.ui.text.FileSearchQuery;
import org.eclipse.search.ui.ISearchQuery;
import org.eclipse.search.ui.ISearchResult;
import org.eclipse.search.ui.text.AbstractTextSearchResult;
import org.eclipse.search.ui.text.Match;

		textResult.removeAll();

		try {

			IContainer dir = configFile.getParent();
			dir.accept(new AbstractSectionPatternVisitor(section) {

				@Override
				protected void collect(IResourceProxy proxy) {
					Match match = new FileMatch((IFile) proxy.requestResource());
					result.addMatch(match);
				}
			}, IResource.NONE);

			return Status.OK_STATUS;
		} catch (Exception ex) {
			return new Status(IStatus.ERROR, EditorConfigPlugin.PLUGIN_ID, ex.getMessage(), ex);
		}
	}

	@Override
	public ISearchResult getSearchResult() {
		if (result == null) {
			result = new EditorConfigSearchResult(this);
		}
		return result;
	}

	@Override
	public String getLabel() {

// Path: org.eclipse.ec4e/src/main/java/org/eclipse/ec4e/EditorConfigPlugin.java
// public class EditorConfigPlugin extends AbstractUIPlugin {
// 
// 	// The plug-in ID
// 	public static final String PLUGIN_ID = "org.eclipse.ec4e"; //$NON-NLS-1$
// 
// 	// The shared instance
// 	private static EditorConfigPlugin plugin;
// 
// 	/**
// 	 * The constructor
// 	 */
// 	public EditorConfigPlugin() {
// 	}
// 
// 	@Override
// 	public void start(BundleContext context) throws Exception {
// 		super.start(context);
// 		plugin = this;
// 		IDEEditorConfigManager.getInstance().init();
// 	}
// 
// 	@Override
// 	public void stop(BundleContext context) throws Exception {
// 		IDEEditorConfigManager.getInstance().dispose();
// 		plugin = null;
// 		super.stop(context);
// 	}
// 
// 	/**
// 	 * Returns the shared instance
// 	 *
// 	 * @return the shared instance
// 	 */
// 	public static EditorConfigPlugin getDefault() {
// 		return plugin;
// 	}
// 
// 	/**
// 	 * Utility method to log errors.
// 	 *
// 	 * @param thr
// 	 *            The exception through which we noticed the error
// 	 */
// 	public static void logError(final Throwable thr) {
// 		getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, 0, thr.getMessage(), thr));
// 	}
// 
// 	/**
// 	 * Utility method to log errors.
// 	 *
// 	 * @param message
// 	 *            User comprehensible message
// 	 * @param thr
// 	 *            The exception through which we noticed the error
// 	 */
// 	public static void logError(final String message, final Throwable thr) {
// 		getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, 0, message, thr));
// 	}
// 
// 	@Override
// 	protected void initializeImageRegistry(ImageRegistry registry) {
// 		EditorConfigImages.initalize(registry);
// 	}
// }
// 
// Path: org.eclipse.ec4e/src/main/java/org/eclipse/ec4e/internal/EditorConfigMessages.java
// public class EditorConfigMessages extends NLS {
// 
// 	private static final String BUNDLE_NAME = "org.eclipse.ec4e.internal.EditorConfigMessages"; //$NON-NLS-1$
// 
// 	// Buttons
// 	public static String Browse_button;
// 
// 	// Wizards
// 	public static String NewEditorConfigWizard_windowTitle;
// 	public static String NewEditorConfigFileWizardPage_title;
// 	public static String NewEditorConfigFileWizardPage_description;
// 	public static String NewEditorConfigFileWizardPage_folderText_Label;
// 	public static String NewEditorConfigFileWizardPage_containerSelectionDialog_title;
// 	public static String NewEditorConfigFileWizardPage_folder_required_error;
// 	public static String NewEditorConfigFileWizardPage_folder_noexists_error;
// 	public static String NewEditorConfigFileWizardPage_project_noaccessible_error;
// 	public static String NewEditorConfigFileWizardPage_folder_already_editorconfig_error;
// 
// 	// Search
// 	public static String EditorConfigSearchQuery_label;
// 	public static String EditorConfigSearchQuery_singularReference;
// 	public static String EditorConfigSearchQuery_pluralReferences;
// 
// 	static {
// 		NLS.initializeMessages(BUNDLE_NAME, EditorConfigMessages.class);
// 	}
// 
// }


// Path: org.eclipse.ec4e/src/main/java/org/eclipse/ec4e/search/EditorConfigSearchQuery.java
import org.ec4j.core.model.Section;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceProxy;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Status;
import org.eclipse.ec4e.EditorConfigPlugin;
import org.eclipse.ec4e.internal.EditorConfigMessages;
import org.eclipse.osgi.util.NLS;
import org.eclipse.search.internal.ui.text.FileMatch;
import org.eclipse.search.internal.ui.text.FileSearchQuery;
import org.eclipse.search.ui.ISearchQuery;
import org.eclipse.search.ui.ISearchResult;
import org.eclipse.search.ui.text.AbstractTextSearchResult;
import org.eclipse.search.ui.text.Match;

		textResult.removeAll();

		try {

			IContainer dir = configFile.getParent();
			dir.accept(new AbstractSectionPatternVisitor(section) {

				@Override
				protected void collect(IResourceProxy proxy) {
					Match match = new FileMatch((IFile) proxy.requestResource());
					result.addMatch(match);
				}
			}, IResource.NONE);

			return Status.OK_STATUS;
		} catch (Exception ex) {
			return new Status(IStatus.ERROR, EditorConfigPlugin.PLUGIN_ID, ex.getMessage(), ex);
		}
	}

	@Override
	public ISearchResult getSearchResult() {
		if (result == null) {
			result = new EditorConfigSearchResult(this);
		}
		return result;
	}

	@Override
	public String getLabel() {

		return EditorConfigMessages.EditorConfigSearchQuery_label;
