-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initialize DTD document model (see #106)
- Loading branch information
1 parent
71226a9
commit ce0240b
Showing
16 changed files
with
579 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...src/main/java/org/eclipse/lsp4xml/extensions/contentmodel/model/ContentModelProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/** | ||
* Copyright (c) 2018 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.lsp4xml.extensions.contentmodel.model; | ||
|
||
import org.eclipse.lsp4xml.dom.XMLDocument; | ||
|
||
/** | ||
* Content model provider API. | ||
* | ||
*/ | ||
public interface ContentModelProvider { | ||
|
||
/** | ||
* Returns the content model provider by using standard association | ||
* (xsi:schemaLocation, xsi:noNamespaceSchemaLocation, doctype) an dnull | ||
* otherwise. | ||
* | ||
* @param document | ||
* @return the content model provider by using standard association | ||
* (xsi:schemaLocation, xsi:noNamespaceSchemaLocation, doctype) an dnull | ||
* otherwise. | ||
*/ | ||
boolean adaptFor(XMLDocument document); | ||
|
||
boolean adaptFor(String uri); | ||
|
||
String getSystemId(XMLDocument xmlDocument, String namespaceURI); | ||
|
||
CMDocument createCMDocument(String key); | ||
} |
45 changes: 45 additions & 0 deletions
45
org.eclipse.lsp4xml/src/main/java/org/eclipse/lsp4xml/extensions/dtd/DTDPlugin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** | ||
* Copyright (c) 2018 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.lsp4xml.extensions.dtd; | ||
|
||
import org.eclipse.lsp4j.InitializeParams; | ||
import org.eclipse.lsp4xml.extensions.contentmodel.model.ContentModelManager; | ||
import org.eclipse.lsp4xml.extensions.contentmodel.model.ContentModelProvider; | ||
import org.eclipse.lsp4xml.extensions.dtd.contentmodel.DTDContentModelProvider; | ||
import org.eclipse.lsp4xml.services.extensions.IXMLExtension; | ||
import org.eclipse.lsp4xml.services.extensions.XMLExtensionsRegistry; | ||
import org.eclipse.lsp4xml.services.extensions.save.ISaveContext; | ||
|
||
/** | ||
* DTD plugin. | ||
*/ | ||
public class DTDPlugin implements IXMLExtension { | ||
|
||
public DTDPlugin() { | ||
} | ||
|
||
@Override | ||
public void doSave(ISaveContext context) { | ||
|
||
} | ||
|
||
@Override | ||
public void start(InitializeParams params, XMLExtensionsRegistry registry) { | ||
// register DTD content model provider | ||
ContentModelProvider modelProvider = new DTDContentModelProvider(registry.getResolverExtensionManager()); | ||
ContentModelManager modelManager = registry.getComponent(ContentModelManager.class); | ||
modelManager.registerModelProvider(modelProvider); | ||
} | ||
|
||
@Override | ||
public void stop(XMLExtensionsRegistry registry) { | ||
} | ||
} |
Oops, something went wrong.