package org.eclipse.angularjs.internal.core.documentModel.handler;

import org.eclipse.angularjs.internal.core.documentModel.encoding.FMDocumentCharsetDetector;
import org.eclipse.angularjs.internal.core.documentModel.loader.AngularDocumentLoader;
import org.eclipse.angularjs.internal.core.documentModel.loader.AngularModelLoader;
import org.eclipse.angularjs.internal.core.documentModel.provisional.contenttype.ContentTypeIdForAngular;
import org.eclipse.wst.sse.core.internal.document.IDocumentCharsetDetector;
import org.eclipse.wst.sse.core.internal.document.IDocumentLoader;
import org.eclipse.wst.sse.core.internal.ltk.modelhandler.AbstractModelHandler;
import org.eclipse.wst.sse.core.internal.provisional.IModelLoader;

public class AngularModelHandler extends AbstractModelHandler {

	/**
	 * Needs to match what's in plugin registry. In fact, can be overwritten at
	 * run time with what's in registry! (so should never be 'final')
	 */
	private static String ModelHandlerID = "org.eclipse.angularjs.core.documentModel.handler"; //$NON-NLS-1$

	public AngularModelHandler() {
		super();
		setId(ModelHandlerID);
		setAssociatedContentTypeId(ContentTypeIdForAngular.ContentTypeID_Angular);
	}

	public IModelLoader getModelLoader() {
		return new AngularModelLoader();
	}

	public IDocumentCharsetDetector getEncodingDetector() {
		return new FMDocumentCharsetDetector();
	}

	public IDocumentLoader getDocumentLoader() {
		return new AngularDocumentLoader();
	}
}

@@ -1,8 +1,555 @@
+/*******************************************************************************%0A * Copyright (c) 2014 Angelo ZERR.%0A * All rights reserved. This program and the accompanying materials%0A * are made available under the terms of the Eclipse Public License v1.0%0A * which accompanies this distribution, and is available at%0A * http://www.eclipse.org/legal/epl-v10.html%0A * %0A * Contributors:      %0A *     Angelo Zerr %3Cangelo.zerr@gmail.com%3E - initial API and implementation%0A *******************************************************************************/%0A
 package 
@@ -606,19 +606,17 @@
 handler;
-%0D%0A%0D
+%0A
 %0Aimport 
@@ -692,33 +692,32 @@
 CharsetDetector;
-%0D
 %0Aimport org.ecli
@@ -779,33 +779,32 @@
 rDocumentLoader;
-%0D
 %0Aimport org.ecli
@@ -867,25 +867,24 @@
 ModelLoader;
-%0D
 %0Aimport org.
@@ -977,17 +977,92 @@
 Angular;
-%0D
+%0Aimport org.eclipse.wst.html.core.internal.modelhandler.ModelHandlerForHTML;
 %0Aimport 
@@ -1129,17 +1129,16 @@
 etector;
-%0D
 %0Aimport 
@@ -1196,17 +1196,16 @@
 tLoader;
-%0D
 %0Aimport 
@@ -1242,117 +1242,235 @@
 nal.
-ltk.modelhandler.AbstractModelHandler;%0D%0Aimport org.eclipse.wst.sse.core.internal.provisional.IModelLoader;%0D%0A%0D
+provisional.IModelLoader;%0A%0A/**%0A * Angular Model Handler. This handler extends %7B@link ModelHandlerForHTML%7D%0A * because AdapterFactoryProviderForJSDT#isFor needs this implementation to%0A * manage JS completion in HTML file.%0A * %0A */
 %0Apub
@@ -1511,16 +1511,8 @@
 nds 
-Abstract
 Mode
@@ -1523,19 +1523,23 @@
 dler
- %7B%0D%0A%0D
+ForHTML %7B%0A
 %0A%09/**
-%0D
 %0A%09 *
@@ -1611,17 +1611,16 @@
 itten at
-%0D
 %0A%09 * run
@@ -1682,15 +1682,13 @@
 al')
-%0D
 %0A%09 */
-%0D
 %0A%09pr
@@ -1789,19 +1789,17 @@
 N-NLS-1$
-%0D%0A%0D
+%0A
 %0A%09public
@@ -1822,17 +1822,16 @@
 dler() %7B
-%0D
 %0A%09%09super
@@ -1833,17 +1833,16 @@
 super();
-%0D
 %0A%09%09setId
@@ -1858,17 +1858,16 @@
 dlerID);
-%0D
 %0A%09%09setAs
@@ -1935,23 +1935,31 @@
 ngular);
-%0D
 %0A%09%7D
-%0D%0A%0D
+%0A%0A%09@Override
 %0A%09public
@@ -1982,33 +1982,32 @@
 tModelLoader() %7B
-%0D
 %0A%09%09return new An
@@ -2021,31 +2021,39 @@
 delLoader();
-%0D
 %0A%09%7D
-%0D%0A%0D
+%0A%0A%09@Override
 %0A%09public IDo
@@ -2093,25 +2093,24 @@
 Detector() %7B
-%0D
 %0A%09%09return ne
@@ -2143,15 +2143,23 @@
 r();
-%0D
 %0A%09%7D
-%0D%0A%0D
+%0A%0A%09@Override
 %0A%09pu
@@ -2200,17 +2200,16 @@
 ader() %7B
-%0D
 %0A%09%09retur
@@ -2242,13 +2242,10 @@
 r();
-%0D
 %0A%09%7D
-%0D
 %0A%7D
-%0D
 %0A

Fix NPE with JS completion in HTML file.