use of org.eclipse.wst.sse.core.internal.ltk.modelhandler.EmbeddedTypeHandler in project webtools.sourceediting by eclipse.
the class TestModelEmbeddedContentType method testStructuredModelEmbeddedXML.
public void testStructuredModelEmbeddedXML() throws IOException {
// First make (empty) structuredDocument
IModelManager modelManager = StructuredModelManager.getModelManager();
IStructuredModel model = modelManager.createUnManagedStructuredModelFor(ContentTypeIdForXML.ContentTypeID_XML);
assertTrue("model could not be created!", model != null);
// XML should NOT have an embedded type
Document doc = ((IDOMModel) model).getDocument();
EmbeddedTypeHandler embeddedHandler = (EmbeddedTypeHandler) ((INodeNotifier) doc).getAdapterFor(EmbeddedTypeHandler.class);
assertTrue("embededHanlder should be null for XML", embeddedHandler == null);
}
use of org.eclipse.wst.sse.core.internal.ltk.modelhandler.EmbeddedTypeHandler in project webtools.sourceediting by eclipse.
the class EmbeddedTypeRegistryReader method readRegistry.
/**
* We simply require an 'add' method, of what ever it is we are to read
* into
*/
void readRegistry(Set set) {
IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
IExtensionPoint point = extensionRegistry.getExtensionPoint(PLUGIN_ID, EXTENSION_POINT_ID);
if (point != null) {
IConfigurationElement[] elements = point.getConfigurationElements();
for (int i = 0; i < elements.length; i++) {
EmbeddedTypeHandler embeddedContentType = readElement(elements[i]);
// element
if (embeddedContentType != null) {
set.add(embeddedContentType);
}
}
}
}
use of org.eclipse.wst.sse.core.internal.ltk.modelhandler.EmbeddedTypeHandler in project webtools.sourceediting by eclipse.
the class ModelHandlerUtility method getEmbeddedContentTypeFor.
public static EmbeddedTypeHandler getEmbeddedContentTypeFor(String string) {
EmbeddedTypeHandler instance = null;
instance = EmbeddedTypeRegistryImpl.getInstance().getTypeFor(string);
return instance;
}
use of org.eclipse.wst.sse.core.internal.ltk.modelhandler.EmbeddedTypeHandler in project webtools.sourceediting by eclipse.
the class JSPModelLoader method reinitialize.
public IStructuredModel reinitialize(IStructuredModel model) {
EmbeddedTypeHandler oldHandler = null;
EmbeddedTypeHandler newHandler = null;
Object reinitStateData = model.getReinitializeStateData();
if (reinitStateData instanceof EmbeddedTypeStateData) {
EmbeddedTypeStateData oldStateData = (EmbeddedTypeStateData) reinitStateData;
oldHandler = oldStateData.getOldHandler();
newHandler = oldStateData.getNewHandler();
// note. We should already have the new handler in the model's
// (documents) adapters,
// so need need to use the old one to undo the old state data
reInitializeEmbeddedType(model, oldHandler, newHandler);
} else {
// for language ... we someday MIGHT have to do something
// here, but for now, we don't have any model-side language
// sensitive adapters.
}
return super.reinitialize(model);
}
use of org.eclipse.wst.sse.core.internal.ltk.modelhandler.EmbeddedTypeHandler in project webtools.sourceediting by eclipse.
the class JSPModelLoader method initEmbeddedType.
/**
* As part of the model cloning process, ensure that the new model has the
* same embedded content type handler as the old model, and that it is
* properly initialized
*/
protected void initEmbeddedType(IStructuredModel oldModel, IStructuredModel newModel) {
EmbeddedTypeHandler existingEmbeddedType = getEmbeddedType(oldModel);
if (existingEmbeddedType == null) {
initEmbeddedTypePre(newModel, newModel.getStructuredDocument());
initEmbeddedTypePost(newModel);
} else {
EmbeddedTypeHandler newEmbeddedContentType = existingEmbeddedType.newInstance();
// initEmbeddedType(newModel);
initCloneOfEmbeddedType(newModel, existingEmbeddedType, newEmbeddedContentType);
setLanguageInPageDirective(newModel);
}
}
Aggregations