// Path: org.eclipse.a.wst.html.webresources.ui/src/org/eclipse/wst/html/webresources/internal/ui/WebResourcesUIPlugin.java
// public class WebResourcesUIPlugin extends AbstractUIPlugin {
// 
// 	// The plug-in ID
// 	public static final String PLUGIN_ID = "org.eclipse.a.wst.html.webresources.ui"; //$NON-NLS-1$
// 
// 	// The shared instance
// 	private static WebResourcesUIPlugin plugin;
// 
// 	/**
// 	 * The constructor
// 	 */
// 	public WebResourcesUIPlugin() {
// 	}
// 
// 	/*
// 	 * (non-Javadoc)
// 	 * 
// 	 * @see
// 	 * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
// 	 * )
// 	 */
// 	public void start(BundleContext context) throws Exception {
// 		super.start(context);
// 		setPlugin(this);
// 	}
// 
// 	/*
// 	 * (non-Javadoc)
// 	 * 
// 	 * @see
// 	 * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
// 	 * )
// 	 */
// 	public void stop(BundleContext context) throws Exception {
// 		ImageResource.dispose();
// 		setPlugin(null);
// 		super.stop(context);
// 	}
// 
// 	/**
// 	 * Returns the shared instance
// 	 * 
// 	 * @return the shared instance
// 	 */
// 	public static WebResourcesUIPlugin getDefault() {
// 		return plugin;
// 	}
// 	
// 	/**
// 	 * Logs the given <code>Throwable</code>.
// 	 * 
// 	 * @param t the <code>Throwable</code>
// 	 */
// 	public static void log(Throwable t) {
// 		plugin.getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, t.getMessage(), t));
// 	}
// 
// 	public static IWorkbenchWindow getActiveWorkbenchWindow() {
// 		return getDefault().getWorkbench().getActiveWorkbenchWindow();
// 	}
// 
// 	public static Shell getActiveWorkbenchShell() {
// 		IWorkbenchWindow window = getActiveWorkbenchWindow();
// 		if (window != null) {
// 			return window.getShell();
// 		}
// 		return null;
// 	}
// 
// 	/**
// 	 * @return Returns the active workbench window's currrent page.
// 	 */
// 	public static IWorkbenchPage getActivePage() {
// 		return getActiveWorkbenchWindow().getActivePage();
// 	}
// 
// 	public static void setPlugin(WebResourcesUIPlugin plugin) {
// 		WebResourcesUIPlugin.plugin = plugin;
// 	}
// 
// }


import java.io.File;
import org.eclipse.core.filebuffers.FileBuffers;
import org.eclipse.core.filebuffers.ITextFileBufferManager;
import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.text.IDocument;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.wst.html.webresources.internal.ui.WebResourcesUIPlugin;

/**
 *  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 org.eclipse.wst.html.webresources.internal.ui.utils;



/**
 * Editor utilities.
 *
 */
public class EditorUtils {

	private EditorUtils() {}

	public static IEditorPart openInEditor(IFile file, int start, int length,
			boolean activate) {
		IEditorPart editor = null;

// Path: org.eclipse.a.wst.html.webresources.ui/src/org/eclipse/wst/html/webresources/internal/ui/WebResourcesUIPlugin.java
// public class WebResourcesUIPlugin extends AbstractUIPlugin {
// 
// 	// The plug-in ID
// 	public static final String PLUGIN_ID = "org.eclipse.a.wst.html.webresources.ui"; //$NON-NLS-1$
// 
// 	// The shared instance
// 	private static WebResourcesUIPlugin plugin;
// 
// 	/**
// 	 * The constructor
// 	 */
// 	public WebResourcesUIPlugin() {
// 	}
// 
// 	/*
// 	 * (non-Javadoc)
// 	 * 
// 	 * @see
// 	 * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
// 	 * )
// 	 */
// 	public void start(BundleContext context) throws Exception {
// 		super.start(context);
// 		setPlugin(this);
// 	}
// 
// 	/*
// 	 * (non-Javadoc)
// 	 * 
// 	 * @see
// 	 * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
// 	 * )
// 	 */
// 	public void stop(BundleContext context) throws Exception {
// 		ImageResource.dispose();
// 		setPlugin(null);
// 		super.stop(context);
// 	}
// 
// 	/**
// 	 * Returns the shared instance
// 	 * 
// 	 * @return the shared instance
// 	 */
// 	public static WebResourcesUIPlugin getDefault() {
// 		return plugin;
// 	}
// 	
// 	/**
// 	 * Logs the given <code>Throwable</code>.
// 	 * 
// 	 * @param t the <code>Throwable</code>
// 	 */
// 	public static void log(Throwable t) {
// 		plugin.getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, t.getMessage(), t));
// 	}
// 
// 	public static IWorkbenchWindow getActiveWorkbenchWindow() {
// 		return getDefault().getWorkbench().getActiveWorkbenchWindow();
// 	}
// 
// 	public static Shell getActiveWorkbenchShell() {
// 		IWorkbenchWindow window = getActiveWorkbenchWindow();
// 		if (window != null) {
// 			return window.getShell();
// 		}
// 		return null;
// 	}
// 
// 	/**
// 	 * @return Returns the active workbench window's currrent page.
// 	 */
// 	public static IWorkbenchPage getActivePage() {
// 		return getActiveWorkbenchWindow().getActivePage();
// 	}
// 
// 	public static void setPlugin(WebResourcesUIPlugin plugin) {
// 		WebResourcesUIPlugin.plugin = plugin;
// 	}
// 
// }


// Path: org.eclipse.a.wst.html.webresources.ui/src/org/eclipse/wst/html/webresources/internal/ui/utils/EditorUtils.java
import java.io.File;
import org.eclipse.core.filebuffers.FileBuffers;
import org.eclipse.core.filebuffers.ITextFileBufferManager;
import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.text.IDocument;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.wst.html.webresources.internal.ui.WebResourcesUIPlugin;

/**
 *  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 org.eclipse.wst.html.webresources.internal.ui.utils;



/**
 * Editor utilities.
 *
 */
public class EditorUtils {

	private EditorUtils() {}

	public static IEditorPart openInEditor(IFile file, int start, int length,
			boolean activate) {
		IEditorPart editor = null;

		IWorkbenchPage page = WebResourcesUIPlugin.getActivePage();
