当前位置: 首页>>代码示例>>Java>>正文


Java XMLLanguage.INSTANCE属性代码示例

本文整理汇总了Java中com.intellij.lang.xml.XMLLanguage.INSTANCE属性的典型用法代码示例。如果您正苦于以下问题:Java XMLLanguage.INSTANCE属性的具体用法?Java XMLLanguage.INSTANCE怎么用?Java XMLLanguage.INSTANCE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.intellij.lang.xml.XMLLanguage的用法示例。


在下文中一共展示了XMLLanguage.INSTANCE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findInfoProvider

@Nullable
public static BreadcrumbsInfoProvider findInfoProvider(@Nullable FileViewProvider viewProvider) {
  BreadcrumbsInfoProvider provider = null;
  if (viewProvider != null) {
    final WebEditorOptions webEditorOptions = WebEditorOptions.getInstance();
    final Language baseLang = viewProvider.getBaseLanguage();
    provider = getInfoProvider(baseLang);
    if (!webEditorOptions.isBreadcrumbsEnabledInXml() && baseLang == XMLLanguage.INSTANCE) return null;
    if (!webEditorOptions.isBreadcrumbsEnabled() && baseLang != XMLLanguage.INSTANCE) return null;
    if (provider == null) {
      for (final Language language : viewProvider.getLanguages()) {
        provider = getInfoProvider(language);
        if (provider != null) {
          break;
        }
      }
    }
  }
  return provider;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:BreadcrumbsXmlWrapper.java

示例2: initComponent

@SuppressWarnings({ "StringEquality" })
    public void initComponent() {
      final Language xmlLang = XMLLanguage.INSTANCE;

//            intentionManager.addAction(new DeleteUnusedParameterFix());
//            intentionManager.addAction(new DeleteUnusedVariableFix());

      final XsltFormattingModelBuilder builder = new XsltFormattingModelBuilder(LanguageFormatting.INSTANCE.forLanguage(xmlLang));
      LanguageFormatting.INSTANCE.addExplicitExtension(xmlLang, builder);

      try {
        // TODO: put this into com.intellij.refactoring.actions.IntroduceParameterAction, just like IntroduceVariableAction
        ActionManager.getInstance().getAction("IntroduceParameter").setInjectedContext(true);
      } catch (Exception e) {
        Logger.getInstance(XsltConfigImpl.class.getName()).error(e);
      }
    }
 
开发者ID:consulo,项目名称:consulo-xslt,代码行数:17,代码来源:XsltConfigImpl.java

示例3: initTabs

@Override
protected void initTabs(CodeStyleSettings settings) {
  addIndentOptionsTab(settings);
  addTab(new CodeStyleXmlPanel(settings));
  addTab(new XmlArrangementPanel(settings));

  for (CodeStyleSettingsProvider provider : Extensions.getExtensions(CodeStyleSettingsProvider.EXTENSION_POINT_NAME)) {
    if (provider.getLanguage() == XMLLanguage.INSTANCE && !provider.hasSettingsPage()) {
      createTab(provider);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:XmlCodeStyleMainPanel.java

示例4: getElementInfo

@Override
@NotNull
public String getElementInfo(@NotNull final PsiElement e) {
  final XmlTag tag = (XmlTag)e;
  final StringBuilder sb = new StringBuilder();

  sb.append(tag.getName());

  final boolean addHtmlInfo = e.getContainingFile().getLanguage() != XMLLanguage.INSTANCE;

  if (addHtmlInfo) {
    final String id_value = tag.getAttributeValue(HtmlUtil.ID_ATTRIBUTE_NAME);
    if (null != id_value) {
      sb.append("#").append(id_value);
    }

    final String class_value = tag.getAttributeValue(HtmlUtil.CLASS_ATTRIBUTE_NAME);
    if (null != class_value) {
      final StringTokenizer tokenizer = new StringTokenizer(class_value, " ");
      while (tokenizer.hasMoreTokens()) {
        sb.append(".").append(tokenizer.nextToken());
      }
    }
  }

  return sb.toString();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:XmlLanguageBreadcrumbsInfoProvider.java

示例5: getDebuggableUrls

@NotNull
public static Collection<Url> getDebuggableUrls(@Nullable PsiElement context) {
  try {
    OpenInBrowserRequest request = context == null ? null : OpenInBrowserRequest.create(context);
    return request == null || request.getFile().getViewProvider().getBaseLanguage() == XMLLanguage.INSTANCE ? Collections.<Url>emptyList() : getUrls(getProvider(request), request);
  }
  catch (WebBrowserUrlProvider.BrowserException ignored) {
    return Collections.emptyList();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:WebBrowserServiceImpl.java

示例6: detectConflicts

private static MultiMap<PsiElement, String> detectConflicts(UsageInfo[] usages) {
  final List<PsiElement> nonXmlUsages = new ArrayList<PsiElement>();
  final List<PsiElement> unsupportedUsages = new ArrayList<PsiElement>();
  final List<PsiElement> unambiguousUsages = new ArrayList<PsiElement>();

  for (UsageInfo usage : usages) {
    final PsiElement element = usage.getElement();
    if (element == null) continue;

    if (element.getLanguage() != XMLLanguage.INSTANCE) {
      nonXmlUsages.add(element);
      continue;
    }
    final XmlTag tag = PsiTreeUtil.getParentOfType(element, XmlTag.class);
    final LayoutUsageData usageData = tag != null
                                      ? AndroidInlineUtil.getLayoutUsageData(tag)
                                      : null;
    if (usageData == null) {
      unsupportedUsages.add(element);
      continue;
    }

    if (usageData.getReference().computeTargetElements().length > 1) {
      unambiguousUsages.add(element);
    }
  }
  return AndroidInlineUtil.buildConflicts(nonXmlUsages, unambiguousUsages, unsupportedUsages,
                                          Collections.<PsiElement>emptyList());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:AndroidInlineLayoutProcessor.java

示例7: AndroidXmlCodeStylePanel

AndroidXmlCodeStylePanel(CodeStyleSettings currentSettings, CodeStyleSettings settings) {
  super(XMLLanguage.INSTANCE, currentSettings, settings);
  myPanel = new JPanel(new BorderLayout());
  myPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
  JPanel centerPanel = new JPanel(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 0, true, false));
  myPanel.add(centerPanel, BorderLayout.CENTER);
  myUseCustomSettings = new JBCheckBox("Use custom formatting settings for Android XML files");
  myPanel.add(myUseCustomSettings, BorderLayout.NORTH);

  myCodeStylePanels = new ArrayList<MyFileSpecificPanel>();

  myCodeStylePanels.add(new ManifestCodeStylePanel());
  myCodeStylePanels.add(new LayoutCodeStylePanel());
  myCodeStylePanels.add(new ValueResourcesCodeStylePanel());
  myCodeStylePanels.add(new OtherCodeStylePanel());

  myFileSpecificCodeStylesPanel = new JPanel(new GridLayout((myCodeStylePanels.size() + 1) / 2, 2, 15, 0));
  centerPanel.add(myFileSpecificCodeStylesPanel);

  myUseCustomSettings.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      UIUtil.setEnabled(myFileSpecificCodeStylesPanel, myUseCustomSettings.isSelected(), true);
    }
  });

  for (MyFileSpecificPanel panel : myCodeStylePanels) {
    final JPanel titledPanel = new JPanel(new BorderLayout());
    titledPanel.setBorder(IdeBorderFactory.createTitledBorder(panel.getTitle()));
    titledPanel.add(panel, BorderLayout.CENTER);
    myFileSpecificCodeStylesPanel.add(titledPanel);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:AndroidXmlCodeStylePanel.java

示例8: isEngagedToFormat

public boolean isEngagedToFormat(PsiElement context) {
  final PsiFile file = context.getContainingFile();
  if (file == null) {
    return false;
  } else if (file.getFileType() == XmlFileType.INSTANCE
          && file.getLanguage() == XMLLanguage.INSTANCE) {

    return XsltSupport.isXsltFile(file);
  }
  return false;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:11,代码来源:XsltFormattingModelBuilder.java

示例9: advance

public void advance() {
  final IElementType tokenType = myDelegate.getTokenType();

  if (tokenType == XmlElementType.XML_COMMENT_CHARACTERS) {
    scanWordsInToken(UsageSearchContext.IN_COMMENTS, false, false);
    advanceTodoItemCountsInToken();
  } else if (tokenType == XmlElementType.XML_ATTRIBUTE_VALUE_TOKEN ||
      tokenType == XmlElementType.XML_NAME ||
      tokenType == XmlElementType.XML_TAG_NAME
     ) {
    scanWordsInToken(UsageSearchContext.IN_PLAIN_TEXT | UsageSearchContext.IN_FOREIGN_LANGUAGES, tokenType == XmlElementType.XML_ATTRIBUTE_VALUE_TOKEN,
                     false);
  } else if (tokenType.getLanguage() != XMLLanguage.INSTANCE &&
    tokenType.getLanguage() != Language.ANY         
  ) {
    boolean inComments = CacheUtil.isInComments(tokenType);
    scanWordsInToken((inComments)?UsageSearchContext.IN_COMMENTS:UsageSearchContext.IN_PLAIN_TEXT | UsageSearchContext.IN_FOREIGN_LANGUAGES, true,
                     false);
    
    if (inComments) advanceTodoItemCountsInToken();
  }
  else if (!XmlFilterLexer.ourNoWordsTokenSet.contains(tokenType)) {
    scanWordsInToken(UsageSearchContext.IN_PLAIN_TEXT, false, false);
  }

  myDelegate.advance();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:27,代码来源:XHtmlFilterLexer.java

示例10: generateDoc

@Override
public String generateDoc(PsiElement element, @Nullable PsiElement originalElement) {
  if (originalElement == null) return null;
  if (originalElement.getLanguage() == XMLLanguage.INSTANCE || DevKitInspectionBase.isPluginXml(originalElement.getContainingFile())) {
    final PsiElement context = element.getContext();
    String fqn = null;
    if (originalElement instanceof XmlToken && ((XmlToken)originalElement).getTokenType() == XmlTokenType.XML_NAME) {
      PsiElement attr;
      PsiElement tag;
      if (context != null
          && (attr = context.getParent()) instanceof XmlAttribute
          && (tag = attr.getParent()) instanceof XmlTag) {
        final String interfaceFqn = ((XmlTag)tag).getAttributeValue("interface");
        final String beanClassFqn = ((XmlTag)tag).getAttributeValue("beanClass");
        fqn = interfaceFqn == null ? beanClassFqn : interfaceFqn;
      }
    }

    if (fqn != null) {
      final Project project = element.getProject();
      final PsiClass psiClass = JavaPsiFacade.getInstance(project).findClass(fqn, GlobalSearchScope.allScope(project));
      if (psiClass != null) {
        return new JavaDocumentationProvider().generateExternalJavadoc(psiClass);
      }
    }

  }
  return null;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:29,代码来源:ExtensionPointQuickDocProvider.java

示例11: getLanguage

private static Language getLanguage(PsiElement element) {
  Language lang = element.getLanguage();
  if (lang == XMLLanguage.INSTANCE) {
    PsiElement parent = element.getParent();
    lang = parent.getLanguage();
  }
  return lang;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:8,代码来源:XmlSurroundWithRangeAdjuster.java

示例12: isTagWithEmptyEndNotAllowed

static boolean isTagWithEmptyEndNotAllowed(final XmlTag tag) {
  String tagName = tag.getName();
  if (tag instanceof HtmlTag) tagName = tagName.toLowerCase();

  Language language = tag.getLanguage();
  return ourTagsWithEmptyEndsNotAllowed.contains(tagName) && language != XMLLanguage.INSTANCE ||
         language == HTMLLanguage.INSTANCE && !HtmlUtil.isSingleHtmlTagL(tagName) && tagName.indexOf(':') == -1;
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:8,代码来源:CheckEmptyTagInspection.java

示例13: useMyFormatter

protected boolean useMyFormatter(final Language myLanguage, final Language childLanguage, final PsiElement childPsi) {
  if (myLanguage == childLanguage ||
      childLanguage == HTMLLanguage.INSTANCE ||
      childLanguage == XHTMLLanguage.INSTANCE ||
      childLanguage == XMLLanguage.INSTANCE) {
    return true;
  }
  final FormattingModelBuilder childFormatter = LanguageFormatting.INSTANCE.forLanguage(childLanguage);
  return childFormatter == null ||
         childFormatter instanceof DelegatingFormattingModelBuilder &&
         ((DelegatingFormattingModelBuilder)childFormatter).dontFormatMyModel();
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:12,代码来源:AbstractXmlBlock.java

示例14: HybrisXmlFileType

private HybrisXmlFileType() {
    super(XMLLanguage.INSTANCE);
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:3,代码来源:HybrisXmlFileType.java

示例15: MdFileType

private MdFileType() {
    super(XMLLanguage.INSTANCE);
}
 
开发者ID:hykes,项目名称:CodeGen,代码行数:3,代码来源:MdFileType.java


注:本文中的com.intellij.lang.xml.XMLLanguage.INSTANCE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。