package jp.sourceforge.projects.ee2e.core.cdt;
import jp.sourceforge.projects.ee2e.core.*;
import jp.sourceforge.projects.ee2e.core.cf.*;
import jp.sourceforge.projects.ee2e.core.editors.*;

/**
 * To change this generated comment edit the template variable "typecomment":
 * Window&gt;Preferences&gt;Java&gt;Templates.
 * To enable and disable the creation of type comments go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation.
 *
 * @author Toshikazu Ando [ ando@park.ruru.ne.jp ]
 */
public class EE2ECFC extends EE2ECF implements EE2ECFOterhDistributors {
	public EE2ECFC() {
		super();
	}
	/**
	 * @see jp.sourceforge.projects.ee2e.core.cdt.editors.EE2ECF#getFactoryName()
	 */
	public String getFactoryName() {
		return "c";
	}

	/**
	 * @see jp.sourceforge.projects.ee2e.core.cdt.editors.EE2ECFOterhDistributors#isUseable(String)
	 */
	public boolean isUseable(String fileName) {
		EE2EDebug.printf(5, "EE2ECFC#isUseable");

		int dotLoc = fileName.indexOf('.');
		String ext;
		if (dotLoc != -1) {
			ext = fileName.substring(dotLoc + 1);
		} else {
			return false;
		}
		if (ext.equalsIgnoreCase("c")
			|| ext.equalsIgnoreCase("cc")
			|| ext.equalsIgnoreCase("cpp")
			|| ext.equalsIgnoreCase("cxx")
			|| ext.equalsIgnoreCase("h")
			|| ext.equalsIgnoreCase("c2")
			|| ext.equalsIgnoreCase("ih") // corba
			|| ext.equalsIgnoreCase("hh") // corba
			|| ext.equalsIgnoreCase("ic")) { // corba
			return true;
		}
		return false;
	}

	/**
	 * @see jp.sourceforge.projects.ee2e.core.cdt.editors.EE2ECFOterhDistributors#getEE2ECF()
	 */
	public EE2ECF getEE2ECF() {
		return this;
	}

	/**
	 * @see jp.sourceforge.projects.ee2e.core.cdt.editors.EE2ECF#tabIndentAction()
	 */
	public EE2EIndentBehavior indentAction() {
		if (jb == null) {
			int indentLen = this.getSize();
			jb = new EE2EIndentJava(indentLen);
		}
		return jb;
	}
	private EE2EIndentJava jb;

	/**
	 * @see jp.sourceforge.projects.ee2e.core.cdt.editors.EE2ECF#tabFormatAction()
	 */
	public EE2EIndentBehavior tabFormatAction() {
        return new EE2EIndentCppFormat(this.getSize());
	}

	/**
	 * @see jp.sourceforge.projects.ee2e.core.cdt.editors.EE2ECF#commentRegion()
	 */
	public EE2EMenuBehavior commentRegion() {
		return new EE2ESharpFormat();
	}

	/**
	 * @see jp.sourceforge.projects.ee2e.core.cdt.editors.EE2ECF#unCommentRegion()
	 */
	public EE2EMenuBehavior unCommentRegion() {
		return new EE2ECppMiniFormat();
	}
	/**
	 * @see jp.sourceforge.projects.ee2e.core.cdt.editors.EE2ECF#urlJump()
	 */
	public EE2EMenuBehavior urlJump() {
		return null;
	}
}
