• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java LangBundle类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getHomeChooserDescriptor

import com.intellij.lang.LangBundle; //导入依赖的package包/类
@Override
public FileChooserDescriptor getHomeChooserDescriptor() {
  final FileChooserDescriptor baseDescriptor = super.getHomeChooserDescriptor();
  final FileChooserDescriptor descriptor = new FileChooserDescriptor(baseDescriptor) {
    @Override
    public void validateSelectedFiles(VirtualFile[] files) throws Exception {
      if (files.length > 0 && !JrtFileSystem.isSupported()) {
        String path = files[0].getPath();
        if (JrtFileSystem.isModularJdk(path) || JrtFileSystem.isModularJdk(adjustSelectedSdkHome(path))) {
          throw new Exception(LangBundle.message("jrt.not.available.message"));
        }
      }
      baseDescriptor.validateSelectedFiles(files);
    }
  };
  descriptor.putUserData(KEY, Boolean.TRUE);
  return descriptor;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:JavaSdkImpl.java


示例2: getContainingClassDescription

import com.intellij.lang.LangBundle; //导入依赖的package包/类
private static String getContainingClassDescription(PsiClass aClass, String formatted) {
  if (aClass instanceof PsiAnonymousClass) {
    return LangBundle.message("java.terms.of.anonymous.class", formatted);
  }
  else {
    final String qualifiedName = aClass.getQualifiedName();
    final String className = qualifiedName != null ? qualifiedName : aClass.getName();
    if (aClass.isInterface()) {
      return LangBundle.message("java.terms.of.interface", formatted, className);
    }
    if (aClass.isEnum()) {
      return LangBundle.message("java.terms.of.enum", formatted, className);
    }
    if (aClass.isAnnotationType()) {
      return LangBundle.message("java.terms.of.annotation.type", formatted, className);
    }
    return LangBundle.message("java.terms.of.class", formatted, className);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:JavaFindUsagesProvider.java


示例3: getNodeName

import com.intellij.lang.LangBundle; //导入依赖的package包/类
@Nullable
@Override
public String getNodeName(final ViewSettings settings, final Object parentValue, final PsiDirectory directory) {
  if (JrtFileSystem.isRoot(directory.getVirtualFile())) {
    return LangBundle.message("jrt.node.short");
  }

  PsiPackage aPackage = JavaDirectoryService.getInstance().getPackage(directory);

  PsiPackage parentPackage;
  if (!ProjectRootsUtil.isSourceRoot(directory) && aPackage != null && !aPackage.getQualifiedName().isEmpty() && parentValue instanceof PsiDirectory) {
    parentPackage = JavaDirectoryService.getInstance().getPackage(((PsiDirectory)parentValue));
  }
  else if (ProjectRootsUtil.isSourceRoot(directory) && aPackage != null) {   //package prefix
    aPackage = null;
    parentPackage = null;
  }
  else {
    parentPackage = null;
  }

  return PackageUtil.getNodeName(settings, aPackage, parentPackage, directory.getName(), isShowFQName(settings, parentValue, directory));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:JavaProjectViewDirectoryHelper.java


示例4: update

import com.intellij.lang.LangBundle; //导入依赖的package包/类
@Override
public void update(final AnActionEvent e) {
  e.getPresentation().setVisible(false);

  VirtualFile virtualFile = e.getData(CommonDataKeys.VIRTUAL_FILE);
  VirtualFile[] files = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY);
  if (files != null && files.length > 1) {
    virtualFile = null;
  }
  if (virtualFile == null || virtualFile.isDirectory()) return;

  Project project = e.getData(CommonDataKeys.PROJECT);
  if (project == null) return;

  final FileViewProvider provider = PsiManager.getInstance(project).findViewProvider(virtualFile);
  if (provider instanceof ConfigurableTemplateLanguageFileViewProvider) {
    final TemplateLanguageFileViewProvider viewProvider = (TemplateLanguageFileViewProvider)provider;

    e.getPresentation().setText(LangBundle.message("quickfix.change.template.data.language.text", viewProvider.getTemplateDataLanguage().getDisplayName()));
    e.getPresentation().setEnabled(true);
    e.getPresentation().setVisible(true);
  }

}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:ChangeTemplateDataLanguageAction.java


示例5: update

import com.intellij.lang.LangBundle; //导入依赖的package包/类
@Override
public void update(final AnActionEvent e) {
  e.getPresentation().setVisible(false);

  VirtualFile virtualFile = e.getData(PlatformDataKeys.VIRTUAL_FILE);
  VirtualFile[] files = e.getData(PlatformDataKeys.VIRTUAL_FILE_ARRAY);
  if (files != null && files.length > 1) {
    virtualFile = null;
  }
  if (virtualFile == null || virtualFile.isDirectory()) return;

  Project project = e.getData(PlatformDataKeys.PROJECT);
  if (project == null) return;

  final FileViewProvider provider = PsiManager.getInstance(project).findViewProvider(virtualFile);
  if (provider instanceof ConfigurableTemplateLanguageFileViewProvider) {
    final TemplateLanguageFileViewProvider viewProvider = (TemplateLanguageFileViewProvider)provider;

    e.getPresentation().setText(LangBundle.message("quickfix.change.template.data.language.text", viewProvider.getTemplateDataLanguage().getDisplayName()));
    e.getPresentation().setEnabled(true);
    e.getPresentation().setVisible(true);
  }

}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:25,代码来源:ChangeTemplateDataLanguageAction.java


示例6: update

import com.intellij.lang.LangBundle; //导入依赖的package包/类
@Override
public void update(final AnActionEvent e) {
  e.getPresentation().setVisible(false);

  VirtualFile virtualFile = e.getData(PlatformDataKeys.VIRTUAL_FILE);
  VirtualFile[] files = e.getData(PlatformDataKeys.VIRTUAL_FILE_ARRAY);
  if (files != null && files.length > 1) {
    virtualFile = null;
  }
  if (virtualFile == null || virtualFile.isDirectory()) return;

  Project project = e.getData(CommonDataKeys.PROJECT);
  if (project == null) return;

  final FileViewProvider provider = PsiManager.getInstance(project).findViewProvider(virtualFile);
  if (provider instanceof ConfigurableTemplateLanguageFileViewProvider) {
    final TemplateLanguageFileViewProvider viewProvider = (TemplateLanguageFileViewProvider)provider;

    e.getPresentation().setText(LangBundle.message("quickfix.change.template.data.language.text", viewProvider.getTemplateDataLanguage().getDisplayName()));
    e.getPresentation().setEnabled(true);
    e.getPresentation().setVisible(true);
  }

}
 
开发者ID:consulo,项目名称:consulo,代码行数:25,代码来源:ChangeTemplateDataLanguageAction.java


示例7: addColorPreviewAndCodeToLookup

import com.intellij.lang.LangBundle; //导入依赖的package包/类
public static void addColorPreviewAndCodeToLookup(final Color color, final StringBuilder buf)
{
	if(color == null)
	{
		return;
	}
	final String code = '#' + toHex(color);
	final String colorName = getColorNameForHexCode(code);
	if(colorName != null)
	{
		buf.append(LangBundle.message("color.name", colorName)).append(BR);
	}

	String colorBox = "<div style=\"border: 1px solid #000000; width: 50px; height: 20px; background-color:" + code + "\"></div>";
	buf.append(LangBundle.message("color.preview", colorBox)).append(BR);
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:17,代码来源:ColorSampleLookupValue.java


示例8: handleEmptyLookup

import com.intellij.lang.LangBundle; //导入依赖的package包/类
@Override
public String handleEmptyLookup(@NotNull final CompletionParameters parameters, final Editor editor)
{
	if(!(parameters.getOriginalFile() instanceof PsiJavaFile))
	{
		return null;
	}

	if(shouldShowSecondSmartCompletionHint(parameters))
	{
		return LangBundle.message("completion.no.suggestions") + "; " + StringUtil.decapitalize(CompletionBundle.message("completion.class.name.hint.2", getActionShortcut(IdeActions
				.ACTION_CODE_COMPLETION)));
	}

	return null;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:17,代码来源:JavaClassNameCompletionContributor.java


示例9: getContainingClassDescription

import com.intellij.lang.LangBundle; //导入依赖的package包/类
private static String getContainingClassDescription(PsiClass aClass, String formatted)
{
	if(aClass instanceof PsiAnonymousClass)
	{
		return LangBundle.message("java.terms.of.anonymous.class", formatted);
	}
	else
	{
		final String qualifiedName = aClass.getQualifiedName();
		final String className = qualifiedName != null ? qualifiedName : aClass.getName();
		if(aClass.isInterface())
		{
			return LangBundle.message("java.terms.of.interface", formatted, className);
		}
		if(aClass.isEnum())
		{
			return LangBundle.message("java.terms.of.enum", formatted, className);
		}
		if(aClass.isAnnotationType())
		{
			return LangBundle.message("java.terms.of.annotation.type", formatted, className);
		}
		return LangBundle.message("java.terms.of.class", formatted, className);
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:26,代码来源:JavaFindUsagesProvider.java


示例10: getSymbolName

import com.intellij.lang.LangBundle; //导入依赖的package包/类
@Nullable
public static String getSymbolName(@NotNull PsiElement symbol, PsiSubstitutor substitutor) {
  String symbolName = null;

  if (symbol instanceof PsiClass) {
    if (symbol instanceof PsiAnonymousClass) {
      symbolName = LangBundle.message("java.terms.anonymous.class");
    }
    else {
      symbolName = ((PsiClass)symbol).getQualifiedName();
      if (symbolName == null) {
        symbolName = ((PsiClass)symbol).getName();
      }
    }
  }
  else if (symbol instanceof PsiMethod) {
    symbolName = PsiFormatUtil.formatMethod((PsiMethod)symbol,
                                            substitutor, PsiFormatUtilBase.SHOW_NAME | PsiFormatUtilBase.SHOW_PARAMETERS,
                                            PsiFormatUtilBase.SHOW_TYPE | PsiFormatUtilBase.SHOW_FQ_CLASS_NAMES | PsiFormatUtilBase.USE_INTERNAL_CANONICAL_TEXT);
  }
  else if (symbol instanceof PsiVariable) {
    symbolName = ((PsiVariable)symbol).getName();
  }
  else if (symbol instanceof PsiPackage) {
    symbolName = ((PsiPackage)symbol).getQualifiedName();
  }
  else if (symbol instanceof PsiFile) {
    PsiDirectory directory = ((PsiFile)symbol).getContainingDirectory();
    PsiPackage aPackage = directory == null ? null : JavaDirectoryService.getInstance().getPackage(directory);
    symbolName = aPackage == null ? null : aPackage.getQualifiedName();
  }
  else if (symbol instanceof PsiDirectory) {
    symbolName = ((PsiDirectory)symbol).getName();
  }

  return symbolName;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:38,代码来源:HighlightMessageUtil.java


示例11: handleEmptyLookup

import com.intellij.lang.LangBundle; //导入依赖的package包/类
@Override
public String handleEmptyLookup(@NotNull final CompletionParameters parameters, final Editor editor) {
  if (!(parameters.getOriginalFile() instanceof PsiJavaFile)) return null;

  if (shouldShowSecondSmartCompletionHint(parameters)) {
    return LangBundle.message("completion.no.suggestions") +
           "; " +
           StringUtil.decapitalize(
               CompletionBundle.message("completion.class.name.hint.2", getActionShortcut(IdeActions.ACTION_CODE_COMPLETION)));
  }

  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:JavaClassNameCompletionContributor.java


示例12: computeUsages

import com.intellij.lang.LangBundle; //导入依赖的package包/类
@Override
public void computeUsages(final List<PsiClass> targets) {
  final Project project = myEditor.getProject();
  final PsiElementFactory factory = JavaPsiFacade.getInstance(project).getElementFactory();

  addOccurrence(myTarget);
  for (PsiClass aClass : targets) {
    addExceptionThrownPlaces(factory.createType(aClass));
  }
  buildStatusText(LangBundle.message("java.terms.exception"), myReadUsages.size()-1 /* exclude target */);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:HighlightExceptionsHandler.java


示例13: calculateResult

import com.intellij.lang.LangBundle; //导入依赖的package包/类
@Override
public Result calculateResult(@NotNull Expression[] params, final ExpressionContext context) {
  PsiElement place = context.getPsiElementAtStartOffset();
  while(place != null){
    if (place instanceof PsiMethod){
      return new TextResult(((PsiMethod)place).getName());
    } else if (place instanceof PsiClassInitializer) {
      return ((PsiClassInitializer) place).hasModifierProperty(PsiModifier.STATIC) ?
             new TextResult(LangBundle.message("java.terms.static.initializer")) :
             new TextResult(LangBundle.message("java.terms.instance.initializer"));
    }
    place = place.getParent();
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:MethodNameMacro.java


示例14: getElementDescription

import com.intellij.lang.LangBundle; //导入依赖的package包/类
@Override
public String getElementDescription(@NotNull final PsiElement element, @NotNull final ElementDescriptionLocation location) {
  if (location instanceof UsageViewShortNameLocation) {
    if (element instanceof PsiThrowStatement) {
      return UsageViewBundle.message("usage.target.exception");
    }
  }

  if (location instanceof UsageViewLongNameLocation) {
    if (element instanceof PsiPackage) {
      return ((PsiPackage)element).getQualifiedName();
    }
    else if (element instanceof PsiClass) {
      if (element instanceof PsiAnonymousClass) {
        return LangBundle.message("java.terms.anonymous.class");
      }
      else {
        String ret = ((PsiClass)element).getQualifiedName(); // It happens for local classes
        if (ret == null) {
          ret = ((PsiClass)element).getName();
        }
        return ret;
      }
    }
    else if (element instanceof PsiVariable) {
      return ((PsiVariable)element).getName();
    }
    else if (element instanceof PsiMethod) {
      PsiMethod psiMethod = (PsiMethod)element;
      return PsiFormatUtil.formatMethod(psiMethod, PsiSubstitutor.EMPTY,
                                        PsiFormatUtilBase.SHOW_NAME | PsiFormatUtilBase.SHOW_PARAMETERS, PsiFormatUtilBase.SHOW_TYPE);
    }
  }

  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:37,代码来源:JavaUsageViewDescriptionProvider.java


示例15: generateClassInfo

import com.intellij.lang.LangBundle; //导入依赖的package包/类
@SuppressWarnings({"HardCodedStringLiteral"})
public static String generateClassInfo(PsiClass aClass) {
  StringBuilder buffer = new StringBuilder();

  if (aClass instanceof PsiAnonymousClass) return LangBundle.message("java.terms.anonymous.class");

  generatePackageInfo(buffer, aClass);
  generateModifiers(buffer, aClass);

  final String classString = aClass.isAnnotationType() ? "java.terms.annotation.interface"
                                                       : aClass.isInterface()
                                                         ? "java.terms.interface"
                                                         : aClass instanceof PsiTypeParameter
                                                           ? "java.terms.type.parameter"
                                                           : aClass.isEnum() ? "java.terms.enum" : "java.terms.class";
  buffer.append(LangBundle.message(classString)).append(" ");

  buffer.append(JavaDocUtil.getShortestClassName(aClass, aClass));

  generateTypeParameters(aClass, buffer);

  if (!aClass.isEnum() && !aClass.isAnnotationType()) {
    PsiReferenceList extendsList = aClass.getExtendsList();
    writeExtends(aClass, buffer, extendsList == null ? PsiClassType.EMPTY_ARRAY : extendsList.getReferencedTypes());
  }

  writeImplements(aClass, buffer, aClass.getImplementsListTypes());

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


示例16: getPresentableText

import com.intellij.lang.LangBundle; //导入依赖的package包/类
@Override
public String getPresentableText(final Object object) {
  if (object instanceof PsiClass) {
    return ClassPresentationUtil.getNameForClass((PsiClass)object, false);
  }
  else if (object instanceof PsiPackage) {
    final String name = ((PsiPackage)object).getName();
    return name != null ? name : AnalysisScopeBundle.message("dependencies.tree.node.default.package.abbreviation");
  }
  else if (object instanceof PsiDirectory && JrtFileSystem.isRoot(((PsiDirectory)object).getVirtualFile())) {
    return LangBundle.message("jrt.node.short");
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:JavaNavBarExtension.java


示例17: getUnresolvedMessagePattern

import com.intellij.lang.LangBundle; //导入依赖的package包/类
@NotNull
@Override
public String getUnresolvedMessagePattern() {
  return LangBundle.message("error.cannot.resolve")
         + " " + (isLast() ? LangBundle.message("terms.file") : LangBundle.message("terms.directory"))
         + " '" + StringUtil.escapePattern(decode(getCanonicalText())) + "'";
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:FileReference.java


示例18: getElementDescription

import com.intellij.lang.LangBundle; //导入依赖的package包/类
@Override
public String getElementDescription(@NotNull final PsiElement psiElement, @NotNull final ElementDescriptionLocation location) {
  if (!(location instanceof UsageViewTypeLocation)) return null;

  if (psiElement instanceof PsiMetaOwner) {
    final PsiMetaData metaData = ((PsiMetaOwner)psiElement).getMetaData();
    if (metaData instanceof PsiPresentableMetaData) {
      return ((PsiPresentableMetaData)metaData).getTypeName();
    }
  }

  if (psiElement instanceof PsiFile) {
    return LangBundle.message("terms.file");
  }
  if (psiElement instanceof PsiDirectory) {
    return LangBundle.message("terms.directory");
  }

  final Language lang = psiElement.getLanguage();
  FindUsagesProvider provider = LanguageFindUsages.INSTANCE.forLanguage(lang);
  final String type = provider.getType(psiElement);
  if (StringUtil.isNotEmpty(type)) {
    return type;
  }

  return TypePresentationService.getService().getTypePresentableName(psiElement.getClass());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:UsageViewTypeLocation.java


示例19: addEmptyItem

import com.intellij.lang.LangBundle; //导入依赖的package包/类
private void addEmptyItem(CollectionListModel<LookupElement> model) {
  LookupElement item = new EmptyLookupItem(myCalculating ? " " : LangBundle.message("completion.no.suggestions"), false);
  myMatchers.put(item, new CamelHumpMatcher(""));
  model.add(item);

  updateLookupWidth(item);
  requestResize();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:LookupImpl.java


示例20: applyEditorTo

import com.intellij.lang.LangBundle; //导入依赖的package包/类
@Override
protected void applyEditorTo(CompoundRunConfiguration s) throws ConfigurationException {
  Set<RunConfiguration> checked = new HashSet<RunConfiguration>();
  for (int i = 0; i < myModel.getSize(); i++) {
    RunConfiguration configuration = myModel.get(i);
      String message =
        LangBundle.message("compound.run.configuration.cycle", configuration.getType().getDisplayName(), configuration.getName());
      if (!canBeAdded(configuration, s)) throw new ConfigurationException(message);
      checked.add(configuration);
  }
  Set<RunConfiguration> toRun = s.getSetToRun();
  toRun.clear();
  toRun.addAll(checked);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:CompoundRunConfigurationSettingsEditor.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java OrderByBorder类代码示例发布时间:2022-05-23
下一篇:
Java ProgressBarTableCell类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap