本文整理汇总了Java中com.intellij.xml.Html5SchemaProvider类的典型用法代码示例。如果您正苦于以下问题:Java Html5SchemaProvider类的具体用法?Java Html5SchemaProvider怎么用?Java Html5SchemaProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Html5SchemaProvider类属于com.intellij.xml包,在下文中一共展示了Html5SchemaProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: DefaultHtmlDoctypeInitialConfigurator
import com.intellij.xml.Html5SchemaProvider; //导入依赖的package包/类
public DefaultHtmlDoctypeInitialConfigurator(ProjectManager projectManager,
PropertiesComponent propertiesComponent) {
if (!propertiesComponent.getBoolean("DefaultHtmlDoctype.MigrateToHtml5")) {
propertiesComponent.setValue("DefaultHtmlDoctype.MigrateToHtml5", true);
ExternalResourceManagerEx.getInstanceEx()
.setDefaultHtmlDoctype(Html5SchemaProvider.getHtml5SchemaLocation(), projectManager.getDefaultProject());
}
// sometimes VFS fails to pick up updated schema contents and we need to force refresh
if (StringUtilRt.parseInt(propertiesComponent.getValue("DefaultHtmlDoctype.Refreshed"), 0) < VERSION) {
propertiesComponent.setValue("DefaultHtmlDoctype.Refreshed", Integer.toString(VERSION));
final String schemaUrl = VfsUtilCore.pathToUrl(Html5SchemaProvider.getHtml5SchemaLocation());
final VirtualFile schemaFile = VirtualFileManager.getInstance().findFileByUrl(schemaUrl);
if (schemaFile != null) {
schemaFile.getParent().refresh(false, true);
}
}
}
示例2: resetFromDoctype
import com.intellij.xml.Html5SchemaProvider; //导入依赖的package包/类
public void resetFromDoctype(final String doctype) {
if (doctype == null || doctype.isEmpty() || doctype.equals(XmlUtil.XHTML4_SCHEMA_LOCATION)) {
myHtml4RadioButton.setSelected(true);
myDoctypeTextField.setEnabled(false);
}
else if (doctype.equals(Html5SchemaProvider.getHtml5SchemaLocation())) {
myHtml5RadioButton.setSelected(true);
myDoctypeTextField.setEnabled(false);
}
else {
myOtherRadioButton.setSelected(true);
myDoctypeTextField.setEnabled(true);
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
try {
myDoctypeTextField.setText(doctype);
}
catch (Exception e) {
throw new RuntimeException(e);
}
}
});
}
}
示例3: getDtdUri
import com.intellij.xml.Html5SchemaProvider; //导入依赖的package包/类
@Nullable
public static String getDtdUri(XmlDoctype doctype)
{
if(doctype != null)
{
String docType = doctype.getDtdUri();
if(docType == null)
{
final String publicId = doctype.getPublicId();
if(PsiTreeUtil.getParentOfType(doctype, XmlDocument.class) instanceof HtmlDocumentImpl && publicId != null && publicId.contains("-//W3C//DTD "))
{
return guessDtdByPublicId(publicId);
}
else if(HtmlUtil.isHtml5Doctype(doctype))
{
docType = doctype.getLanguage() instanceof HTMLLanguage ? Html5SchemaProvider.getHtml5SchemaLocation() : Html5SchemaProvider.getXhtml5SchemaLocation();
}
}
return docType;
}
return null;
}
示例4: getDefaultHtmlDoctype
import com.intellij.xml.Html5SchemaProvider; //导入依赖的package包/类
@Override
@NotNull
public String getDefaultHtmlDoctype(@NotNull Project project)
{
final String doctype = getProjectResources(project).myDefaultHtmlDoctype;
if(XmlUtil.XHTML_URI.equals(doctype))
{
return XmlUtil.XHTML4_SCHEMA_LOCATION;
}
else if(HTML5_DOCTYPE_ELEMENT.equals(doctype))
{
return Html5SchemaProvider.getHtml5SchemaLocation();
}
else
{
return doctype;
}
}
示例5: getDefaultHtmlDoctype
import com.intellij.xml.Html5SchemaProvider; //导入依赖的package包/类
@Override
@NotNull
public String getDefaultHtmlDoctype(@NotNull Project project) {
final String doctype = getProjectResources(project).myDefaultHtmlDoctype;
if (XmlUtil.XHTML_URI.equals(doctype)) {
return XmlUtil.XHTML4_SCHEMA_LOCATION;
}
else if (HTML5_DOCTYPE_ELEMENT.equals(doctype)) {
return Html5SchemaProvider.getHtml5SchemaLocation();
}
else {
return doctype;
}
}
示例6: setDefaultHtmlDoctype
import com.intellij.xml.Html5SchemaProvider; //导入依赖的package包/类
private void setDefaultHtmlDoctype(String defaultHtmlDoctype) {
incModificationCount();
if (Html5SchemaProvider.getHtml5SchemaLocation().equals(defaultHtmlDoctype)) {
myDefaultHtmlDoctype = HTML5_DOCTYPE_ELEMENT;
}
else {
myDefaultHtmlDoctype = defaultHtmlDoctype;
}
fireExternalResourceChanged();
}
示例7: isHtml5Document
import com.intellij.xml.Html5SchemaProvider; //导入依赖的package包/类
public static boolean isHtml5Document(XmlDocument doc) {
if (doc == null) {
return false;
}
XmlProlog prolog = doc.getProlog();
XmlDoctype doctype = prolog != null ? prolog.getDoctype() : null;
if (!isHtmlTagContainingFile(doc)) {
return false;
}
final PsiFile htmlFile = doc.getContainingFile();
final String htmlFileFullName;
if (htmlFile != null) {
final VirtualFile vFile = htmlFile.getVirtualFile();
if (vFile != null) {
htmlFileFullName = vFile.getPath();
}
else {
htmlFileFullName = htmlFile.getName();
}
}
else {
htmlFileFullName = "unknown";
}
if (doctype == null) {
LOG.debug("DOCTYPE for " + htmlFileFullName + " is null");
return Html5SchemaProvider.getHtml5SchemaLocation()
.equals(ExternalResourceManagerEx.getInstanceEx().getDefaultHtmlDoctype(doc.getProject()));
}
final boolean html5Doctype = isHtml5Doctype(doctype);
final String doctypeDescription = "text: " + doctype.getText() +
", dtdUri: " + doctype.getDtdUri() +
", publicId: " + doctype.getPublicId() +
", markupDecl: " + doctype.getMarkupDecl();
LOG.debug("DOCTYPE for " + htmlFileFullName + "; " + doctypeDescription + "; HTML5: " + html5Doctype);
return html5Doctype;
}
示例8: tagHasHtml5Schema
import com.intellij.xml.Html5SchemaProvider; //导入依赖的package包/类
public static boolean tagHasHtml5Schema(@NotNull XmlTag context) {
XmlElementDescriptor descriptor = context.getDescriptor();
if (descriptor != null) {
XmlNSDescriptor nsDescriptor = descriptor.getNSDescriptor();
XmlFile descriptorFile = nsDescriptor != null ? nsDescriptor.getDescriptorFile() : null;
String descriptorPath = descriptorFile != null ? descriptorFile.getVirtualFile().getPath() : null;
return Comparing.equal(Html5SchemaProvider.getHtml5SchemaLocation(), descriptorPath) ||
Comparing.equal(Html5SchemaProvider.getXhtml5SchemaLocation(), descriptorPath);
}
return false;
}
示例9: getDoctype
import com.intellij.xml.Html5SchemaProvider; //导入依赖的package包/类
@NotNull
private String getDoctype() {
if (myHtml4RadioButton.isSelected()) {
return XmlUtil.XHTML4_SCHEMA_LOCATION;
}
if (myHtml5RadioButton.isSelected()) {
return Html5SchemaProvider.getHtml5SchemaLocation();
}
return myDoctypeTextField.getText();
}
示例10: reset
import com.intellij.xml.Html5SchemaProvider; //导入依赖的package包/类
@Override
public void reset() {
final String doctype = ExternalResourceManagerEx.getInstanceEx().getDefaultHtmlDoctype(myProject);
if (doctype.isEmpty() || doctype.equals(XmlUtil.XHTML4_SCHEMA_LOCATION)) {
myHtml4RadioButton.setSelected(true);
myDoctypeTextField.setEnabled(false);
}
else if (doctype.equals(Html5SchemaProvider.getHtml5SchemaLocation())) {
myHtml5RadioButton.setSelected(true);
myDoctypeTextField.setEnabled(false);
}
else {
myOtherRadioButton.setSelected(true);
myDoctypeTextField.setEnabled(true);
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
try {
myDoctypeTextField.setText(doctype);
}
catch (Exception e) {
throw new RuntimeException(e);
}
}
});
}
if (ExternalResourceManagerEx.getInstanceEx().getXmlSchemaVersion(myProject) == ExternalResourceManagerEx.XMLSchemaVersion.XMLSchema_1_0) {
myXMLSchema10JBRadioButton.setSelected(true);
}
else {
myXMLSchema11JBRadioButton.setSelected(true);
}
}
示例11: setDefaultHtmlDoctype
import com.intellij.xml.Html5SchemaProvider; //导入依赖的package包/类
private void setDefaultHtmlDoctype(String defaultHtmlDoctype) {
myModificationCount++;
if (Html5SchemaProvider.getHtml5SchemaLocation().equals(defaultHtmlDoctype)) {
myDefaultHtmlDoctype = HTML5_DOCTYPE_ELEMENT;
}
else {
myDefaultHtmlDoctype = defaultHtmlDoctype;
}
fireExternalResourceChanged();
}
示例12: getDoctype
import com.intellij.xml.Html5SchemaProvider; //导入依赖的package包/类
@NotNull
public String getDoctype() {
if (myHtml4RadioButton.isSelected()) {
return XmlUtil.XHTML_URI;
}
if (myHtml5RadioButton.isSelected()) {
return Html5SchemaProvider.getHtml5SchemaLocation();
}
return myDoctypeTextField.getText();
}
示例13: DefaultHtmlDoctypeInitialConfigurator
import com.intellij.xml.Html5SchemaProvider; //导入依赖的package包/类
public DefaultHtmlDoctypeInitialConfigurator(ProjectManager projectManager,
PropertiesComponent propertiesComponent) {
if (!propertiesComponent.getBoolean("DefaultHtmlDoctype.MigrateToHtml5", false)) {
propertiesComponent.setValue("DefaultHtmlDoctype.MigrateToHtml5", Boolean.TRUE.toString());
ExternalResourceManagerEx.getInstanceEx()
.setDefaultHtmlDoctype(Html5SchemaProvider.getHtml5SchemaLocation(), projectManager.getDefaultProject());
}
}
示例14: tagHasHtml5Schema
import com.intellij.xml.Html5SchemaProvider; //导入依赖的package包/类
public static boolean tagHasHtml5Schema(@NotNull XmlTag context)
{
XmlElementDescriptor descriptor = context.getDescriptor();
if(descriptor != null)
{
XmlNSDescriptor nsDescriptor = descriptor.getNSDescriptor();
XmlFile descriptorFile = nsDescriptor != null ? nsDescriptor.getDescriptorFile() : null;
String descriptorPath = descriptorFile != null ? descriptorFile.getVirtualFile().getPath() : null;
return Comparing.equal(Html5SchemaProvider.getHtml5SchemaLocation(), descriptorPath) || Comparing.equal(Html5SchemaProvider.getXhtml5SchemaLocation(), descriptorPath);
}
return false;
}
示例15: setDefaultHtmlDoctype
import com.intellij.xml.Html5SchemaProvider; //导入依赖的package包/类
private void setDefaultHtmlDoctype(String defaultHtmlDoctype)
{
incModificationCount();
if(Html5SchemaProvider.getHtml5SchemaLocation().equals(defaultHtmlDoctype))
{
myDefaultHtmlDoctype = HTML5_DOCTYPE_ELEMENT;
}
else
{
myDefaultHtmlDoctype = defaultHtmlDoctype;
}
fireExternalResourceChanged();
}