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


Java JsonLanguage类代码示例

本文整理汇总了Java中com.intellij.json.JsonLanguage的典型用法代码示例。如果您正苦于以下问题:Java JsonLanguage类的具体用法?Java JsonLanguage怎么用?Java JsonLanguage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: createSpacingBuilder

import com.intellij.json.JsonLanguage; //导入依赖的package包/类
static SpacingBuilder createSpacingBuilder(CodeStyleSettings settings) {
  final JsonCodeStyleSettings jsonSettings = settings.getCustomSettings(JsonCodeStyleSettings.class);
  final CommonCodeStyleSettings commonSettings = settings.getCommonSettings(JsonLanguage.INSTANCE);

  final int spacesBeforeComma = commonSettings.SPACE_BEFORE_COMMA ? 1 : 0;
  final int spacesBeforeColon = jsonSettings.SPACE_BEFORE_COLON ? 1 : 0;
  final int spacesAfterColon = jsonSettings.SPACE_AFTER_COLON ? 1 : 0;

  return new SpacingBuilder(settings, JsonLanguage.INSTANCE)
    .before(COLON).spacing(spacesBeforeColon, spacesBeforeColon, 0, false, 0)
    .after(COLON).spacing(spacesAfterColon, spacesAfterColon, 0, false, 0)
    .withinPair(L_BRACKET, R_BRACKET).spaceIf(commonSettings.SPACE_WITHIN_BRACKETS, true)
    .withinPair(L_CURLY, R_CURLY).spaceIf(commonSettings.SPACE_WITHIN_BRACES, true)
    .before(COMMA).spacing(spacesBeforeComma, spacesBeforeComma, 0, false, 0)
    .after(COMMA).spaceIf(commonSettings.SPACE_AFTER_COMMA);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:JsonFormattingBuilderModel.java

示例2: JsonCodeStylePanel

import com.intellij.json.JsonLanguage; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public JsonCodeStylePanel(@NotNull CodeStyleSettings settings) {
  super(JsonLanguage.INSTANCE, null, settings);
  addPanelToWatch(myPanel);
  installPreviewPanel(myPreviewPanel);

  // Initialize combo box with property value alignment types
  for (PropertyAlignment alignment : PropertyAlignment.values()) {
    myPropertiesAlignmentCombo.addItem(alignment);
  }
  myPropertiesAlignmentCombo.setRenderer(new ListCellRendererWrapper<PropertyAlignment>() {
    @Override
    public void customize(JList list, PropertyAlignment value, int index, boolean selected, boolean hasFocus) {
      setText(value.getDescription());
    }
  });
  myPropertiesAlignmentCombo.addItemListener(new ItemListener() {
    @Override
    public void itemStateChanged(ItemEvent e) {
      if (e.getStateChange() == ItemEvent.SELECTED) {
        somethingChanged();
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:JsonCodeStylePanel.java

示例3: registerReferenceProviders

import com.intellij.json.JsonLanguage; //导入依赖的package包/类
@Override
public void registerReferenceProviders(@NotNull final PsiReferenceRegistrar registrar) {
  registrar.registerReferenceProvider(
      psiElement(PsiLiteralExpression.class).
          withSuperParent(3, psiElement(PsiAnnotation.class)),
      new InjectionReferenceProvider()
  );

  registrar.registerReferenceProvider(
      psiElement(PsiLiteralExpression.class).
          withSuperParent(3, psiElement(PsiAnnotation.class)),
      new InjectorReferenceProvider()
  );

  registrar.registerReferenceProvider(
      psiElement(PsiLiteralExpression.class).
          withLanguage(JavaLanguage.INSTANCE).
          withSuperParent(3, psiElement(PsiAnnotation.class)),
      new MacroReferenceProvider()
  );

  registrar.registerReferenceProvider(
      psiElement(JsonProperty.class).withLanguage(JsonLanguage.INSTANCE),
      new MainClassReferenceProvider()
  );
}
 
开发者ID:defrac,项目名称:defrac-plugin-intellij,代码行数:27,代码来源:ReferenceContributor.java

示例4: localReferencePattern

import com.intellij.json.JsonLanguage; //导入依赖的package包/类
private PsiElementPattern.Capture<JsonLiteral> localReferencePattern(final String refTypePrefix) {
    return psiElement(JsonLiteral.class)
            .withParent(psiElement(JsonProperty.class).withName(OpenApiConstants.REF_KEY))
            .withText(StandardPatterns.string().contains(refTypePrefix))
            .andNot(StandardPatterns.string().contains(FileConstants.JSON_FILE_NAME_SUFFIX))
            .withLanguage(JsonLanguage.INSTANCE);
}
 
开发者ID:zalando,项目名称:intellij-swagger,代码行数:8,代码来源:OpenApiJsonReferenceContributor.java

示例5: localDefinitionsPattern

import com.intellij.json.JsonLanguage; //导入依赖的package包/类
private PsiElementPattern.Capture<JsonLiteral> localDefinitionsPattern() {
    return swagger(psiElement(JsonLiteral.class)
            .withParent(psiElement(JsonProperty.class).withName(SwaggerConstants.REF_KEY))
            .withText(StandardPatterns.string().contains(SwaggerConstants.LOCAL_DEFINITIONS_PREFIX))
            .andNot(StandardPatterns.string().contains(FileConstants.JSON_FILE_NAME_SUFFIX))
            .withLanguage(JsonLanguage.INSTANCE));
}
 
开发者ID:zalando,项目名称:intellij-swagger,代码行数:8,代码来源:SwaggerJsonReferenceContributor.java

示例6: preprocessEnter

import com.intellij.json.JsonLanguage; //导入依赖的package包/类
@Override
public Result preprocessEnter(@NotNull PsiFile file,
                              @NotNull Editor editor,
                              @NotNull Ref<Integer> caretOffsetRef,
                              @NotNull Ref<Integer> caretAdvance,
                              @NotNull DataContext dataContext,
                              EditorActionHandler originalHandler) {
  if (!file.getLanguage().is(JsonLanguage.INSTANCE)) {
    return Result.Continue;
  }
  return super.preprocessEnter(file, editor, caretOffsetRef, caretAdvance, dataContext, originalHandler);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:JsonEnterBetweenBracesHandler.java

示例7: getDefaultCommonSettings

import com.intellij.json.JsonLanguage; //导入依赖的package包/类
@Nullable
@Override
public CommonCodeStyleSettings getDefaultCommonSettings() {
  CommonCodeStyleSettings commonSettings = new CommonCodeStyleSettings(JsonLanguage.INSTANCE);
  CommonCodeStyleSettings.IndentOptions indentOptions = commonSettings.initIndentOptions();
  indentOptions.INDENT_SIZE = 2;
  // strip all blank lines by default
  commonSettings.KEEP_BLANK_LINES_IN_CODE = 0;
  return commonSettings;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:JsonLanguageCodeStyleSettingsProvider.java

示例8: isInsideCodeBlock

import com.intellij.json.JsonLanguage; //导入依赖的package包/类
private boolean isInsideCodeBlock(@Nullable PsiElement element) {
  if (element instanceof PsiFileSystemItem) {
    return false;
  }
  if (element == null || element.getParent() == null) {
    return true;
  }
  // Consider all elements of JSON PSI as externally visible, i.e. they are out of code block
  return !(element.getLanguage() instanceof JsonLanguage);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:JsonTreeChangePreprocessor.java

示例9: L10nFileType

import com.intellij.json.JsonLanguage; //导入依赖的package包/类
private L10nFileType() {
    super(JsonLanguage.INSTANCE);
}
 
开发者ID:smelukov,项目名称:intellij-basisjs-plugin,代码行数:4,代码来源:L10nFileType.java

示例10: hasJsonRootKey

import com.intellij.json.JsonLanguage; //导入依赖的package包/类
private boolean hasJsonRootKey(final PsiFile psiFile, final String lookupKey) {
    final Language language = psiFile.getLanguage();

    return JsonLanguage.INSTANCE.is(language) && new PathFinder().findByPathFrom(lookupKey, psiFile).isPresent();
}
 
开发者ID:zalando,项目名称:intellij-swagger,代码行数:6,代码来源:FileDetector.java

示例11: filePattern

import com.intellij.json.JsonLanguage; //导入依赖的package包/类
private PsiElementPattern.Capture<JsonLiteral> filePattern() {
    return psiElement(JsonLiteral.class)
            .withText(endsWithJson())
            .withLanguage(JsonLanguage.INSTANCE);
}
 
开发者ID:zalando,项目名称:intellij-swagger,代码行数:6,代码来源:OpenApiJsonReferenceContributor.java

示例12: componentFileReferencePattern

import com.intellij.json.JsonLanguage; //导入依赖的package包/类
private PsiElementPattern.Capture<JsonLiteral> componentFileReferencePattern() {
    return psiElement(JsonLiteral.class)
            .withParent(psiElement(JsonProperty.class).withName(OpenApiConstants.REF_KEY))
            .withText(StandardPatterns.string().matches("(.*).json#/([^/])*$"))
            .withLanguage(JsonLanguage.INSTANCE);
}
 
开发者ID:zalando,项目名称:intellij-swagger,代码行数:7,代码来源:OpenApiJsonReferenceContributor.java

示例13: externalDefinitionsInRootPattern

import com.intellij.json.JsonLanguage; //导入依赖的package包/类
private PsiElementPattern.Capture<JsonLiteral> externalDefinitionsInRootPattern() {
    return swagger(psiElement(JsonLiteral.class)
            .withParent(psiElement(JsonProperty.class).withName(SwaggerConstants.REF_KEY))
            .withText(StandardPatterns.string().matches("(.*).json#/([^/])*$"))
            .withLanguage(JsonLanguage.INSTANCE));
}
 
开发者ID:zalando,项目名称:intellij-swagger,代码行数:7,代码来源:SwaggerJsonReferenceContributor.java

示例14: externalDefinitionsNotInRootPattern

import com.intellij.json.JsonLanguage; //导入依赖的package包/类
private PsiElementPattern.Capture<JsonLiteral> externalDefinitionsNotInRootPattern() {
    return swagger(psiElement(JsonLiteral.class)
            .withParent(psiElement(JsonProperty.class).withName(SwaggerConstants.REF_KEY))
            .withText(StandardPatterns.string().matches("(.*).json#/(.*)/(.*)"))
            .withLanguage(JsonLanguage.INSTANCE));
}
 
开发者ID:zalando,项目名称:intellij-swagger,代码行数:7,代码来源:SwaggerJsonReferenceContributor.java

示例15: localParametersPattern

import com.intellij.json.JsonLanguage; //导入依赖的package包/类
private PsiElementPattern.Capture<JsonLiteral> localParametersPattern() {
    return swagger(psiElement(JsonLiteral.class).withText(StandardPatterns.string().contains(SwaggerConstants.LOCAL_PARAMETERS_PREFIX))
            .withLanguage(JsonLanguage.INSTANCE));
}
 
开发者ID:zalando,项目名称:intellij-swagger,代码行数:5,代码来源:SwaggerJsonReferenceContributor.java


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