Java 类com.intellij.psi.PsiBundle 实例源码

项目:intellij-ce-playground    文件:ProjectScopeBuilderImpl.java   
@NotNull
@Override
public GlobalSearchScope buildLibrariesScope() {
  ProjectAndLibrariesScope result = new ProjectAndLibrariesScope(myProject) {
    @Override
    public boolean contains(@NotNull VirtualFile file) {
      return myProjectFileIndex.isInLibrarySource(file) || myProjectFileIndex.isInLibraryClasses(file);
    }

    @Override
    public boolean isSearchInModuleContent(@NotNull Module aModule) {
      return false;
    }
  };
  result.setDisplayName(PsiBundle.message("psi.search.scope.libraries"));
  return result;
}
项目:intellij-ce-playground    文件:CheckUtil.java   
public static void checkWritable(@NotNull final PsiElement element) throws IncorrectOperationException {
  if (!element.isWritable()) {
    if (element instanceof PsiDirectory) {
      throw new IncorrectOperationException(
        PsiBundle.message("cannot.modify.a.read.only.directory", ((PsiDirectory)element).getVirtualFile().getPresentableUrl()));
    }
    else {
      PsiFile file = element.getContainingFile();
      if (file == null) {
        throw new IncorrectOperationException();
      }
      final VirtualFile virtualFile = file.getVirtualFile();
      if (virtualFile == null) {
        throw new IncorrectOperationException();
      }
      throw new IncorrectOperationException(PsiBundle.message("cannot.modify.a.read.only.file", virtualFile.getPresentableUrl()));
    }
  }
}
项目:tools-idea    文件:CheckUtil.java   
public static void checkWritable(@NotNull final PsiElement element) throws IncorrectOperationException {
  if (!element.isWritable()) {
    if (element instanceof PsiDirectory) {
      throw new IncorrectOperationException(
        PsiBundle.message("cannot.modify.a.read.only.directory", ((PsiDirectory)element).getVirtualFile().getPresentableUrl()));
    }
    else {
      PsiFile file = element.getContainingFile();
      if (file == null) {
        throw new IncorrectOperationException();
      }
      final VirtualFile virtualFile = file.getVirtualFile();
      if (virtualFile == null) {
        throw new IncorrectOperationException();
      }
      throw new IncorrectOperationException(PsiBundle.message("cannot.modify.a.read.only.file", virtualFile.getPresentableUrl()));
    }
  }
}
项目:consulo-dotnet    文件:TypeInheritorsSearch.java   
@Override
public boolean execute(@NotNull final SearchParameters parameters, @NotNull final Processor<DotNetTypeDeclaration> consumer)
{
    final String baseVmQName = parameters.getVmQName();
    final SearchScope searchScope = parameters.getScope();

    TypeInheritorsSearch.LOGGER.assertTrue(searchScope != null);

    ProgressIndicator progress = ProgressIndicatorProvider.getGlobalProgressIndicator();
    if(progress != null)
    {
        progress.pushState();
        progress.setText(PsiBundle.message("psi.search.inheritors.of.class.progress", baseVmQName));
    }

    boolean result = processInheritors(consumer, baseVmQName, searchScope, parameters);

    if(progress != null)
    {
        progress.popState();
    }

    return result;
}
项目:consulo    文件:CheckUtil.java   
public static void checkWritable(@Nonnull final PsiElement element) throws IncorrectOperationException {
  if (!element.isWritable()) {
    if (element instanceof PsiDirectory) {
      throw new IncorrectOperationException(
        PsiBundle.message("cannot.modify.a.read.only.directory", ((PsiDirectory)element).getVirtualFile().getPresentableUrl()));
    }
    else {
      PsiFile file = element.getContainingFile();
      if (file == null) {
        throw new IncorrectOperationException();
      }
      final VirtualFile virtualFile = file.getVirtualFile();
      if (virtualFile == null) {
        throw new IncorrectOperationException();
      }
      throw new IncorrectOperationException(PsiBundle.message("cannot.modify.a.read.only.file", virtualFile.getPresentableUrl()));
    }
  }
}
项目:consulo-xml    文件:XmlHighlightVisitor.java   
@NotNull
public static String getErrorDescription(@NotNull PsiReference reference)
{
    String message;
    if(reference instanceof EmptyResolveMessageProvider)
    {
        message = ((EmptyResolveMessageProvider) reference).getUnresolvedMessagePattern();
    }
    else
    {
        //noinspection UnresolvedPropertyKey
        message = PsiBundle.message("cannot.resolve.symbol");
    }

    String description;
    try
    {
        description = BundleBase.format(message, reference.getCanonicalText()); // avoid double formatting
    }
    catch(IllegalArgumentException ex)
    {
        // unresolvedMessage provided by third-party reference contains wrong format string (e.g. {}), tolerate it
        description = message;
    }
    return description;
}
项目:consulo-java    文件:JavaPresentationUtil.java   
@Nullable
private static String getJavaSymbolContainerText(final PsiElement element) {
  final String result;
  PsiElement container = PsiTreeUtil.getParentOfType(element, PsiMember.class, PsiFile.class);

  if (container instanceof PsiClass) {
    String qName = ((PsiClass)container).getQualifiedName();
    if (qName != null) {
      result = qName;
    }
    else {
      result = ((PsiClass)container).getName();
    }
  }
  else if (container instanceof PsiJavaFile) {
    result = ((PsiJavaFile)container).getPackageName();
  }
  else {//TODO: local classes
    result = null;
  }
  if (result != null) {
    return PsiBundle.message("aux.context.display", result);
  }
  return null;
}
项目:livescript-idea    文件:LiveScriptTaskConsumer.java   
@NotNull
public TaskOptions getOptionsTemplate() {

    TaskOptions options = new TaskOptions();
    options.setName(LiveScriptFileType.LIVE_SCRIPT_LANGUAGE.getDisplayName());
    options.setDescription("Compiles .ls files into .js files");
    options.setFileExtension("ls");
    options.setScopeName(PsiBundle.message("psi.search.scope.project", new Object[0]));

    options.setWorkingDir("$" + new FileDirMacro().getName() + "$");

    options.setArguments("--compile $" + new FileNameMacro().getName() + "$");
    options.setOutput("$" + new FileNameWithoutExtension().getName() + "$.js");

    return options;

}
项目:intellij-ce-playground    文件:GlobalSearchScope.java   
@NotNull
@Override
public String getDisplayName() {
  if (myDisplayName == null) {
    return PsiBundle.message("psi.search.scope.intersection", myScope1.getDisplayName(), myScope2.getDisplayName());
  }
  return myDisplayName;
}
项目:tools-idea    文件:GlobalSearchScope.java   
@Override
public String getDisplayName() {
  if (myDisplayName == null) {
    return PsiBundle.message("psi.search.scope.intersection", myScope1.getDisplayName(), myScope2.getDisplayName());
  }
  return myDisplayName;
}
项目:tools-idea    文件:GlobalSearchScope.java   
@Override
public String getDisplayName() {
  if (myDisplayName == null) {
    return PsiBundle.message("psi.search.scope.union", myScope1.getDisplayName(), myScope2.getDisplayName());
  }
  return myDisplayName;
}
项目:tools-idea    文件:CodeStyleSchemeImpl.java   
public void save(File dir) throws WriteExternalException{
  Element newElement = new Element(CODE_SCHEME);
  newElement.setAttribute(NAME, getName());
  (this).writeExternal(newElement);

  String filePath = dir.getAbsolutePath() + File.separator + getName() + XML_EXTENSION;
  try {
    JDOMUtil.writeDocument(new Document(newElement), filePath, getCodeStyleSettings().getLineSeparator());
  }
  catch (IOException e) {
    Messages.showErrorDialog(PsiBundle.message("codestyle.cannot.save.scheme.file", filePath, e.getLocalizedMessage()), CommonBundle.getErrorTitle());
  }
}
项目:tools-idea    文件:PersistableCodeStyleSchemes.java   
@Nullable
private static File getDir(boolean create) {
  String directoryPath = PathManager.getConfigPath() + File.separator + CODESTYLES_DIRECTORY;
  File directory = new File(directoryPath);
  if (!directory.exists()) {
    if (!create) return null;
    if (!directory.mkdir()) {
      Messages.showErrorDialog(PsiBundle.message("codestyle.cannot.save.settings.directory.cant.be.created.message", directoryPath),
                               PsiBundle.message("codestyle.cannot.save.settings.directory.cant.be.created.title"));
      return null;
    }
  }
  return directory;
}
项目:consulo    文件:GlobalSearchScope.java   
@Nonnull
@Override
public String getDisplayName() {
  if (myDisplayName == null) {
    return PsiBundle.message("psi.search.scope.intersection", myScope1.getDisplayName(), myScope2.getDisplayName());
  }
  return myDisplayName;
}
项目:consulo-java    文件:JavaClassInheritorsSearcher.java   
@Override
public void processQuery(@NotNull ClassInheritorsSearch.SearchParameters parameters, @NotNull Processor<PsiClass> consumer)
{
    final PsiClass baseClass = parameters.getClassToProcess();
    final SearchScope searchScope = parameters.getScope();

    LOG.assertTrue(searchScope != null);

    ProgressIndicator progress = ProgressIndicatorProvider.getGlobalProgressIndicator();
    if(progress != null)
    {
        progress.pushState();
        String className = ApplicationManager.getApplication().runReadAction(new Computable<String>()
        {
            @Override
            public String compute()
            {
                return baseClass.getName();
            }
        });
        progress.setText(className != null ? PsiBundle.message("psi.search.inheritors.of.class.progress", className) : PsiBundle.message("psi.search.inheritors.progress"));
    }

    processInheritors(consumer, baseClass, searchScope, parameters);

    if(progress != null)
    {
        progress.popState();
    }
}
项目:intellij-ce-playground    文件:GlobalSearchScopesCore.java   
@NotNull
@Override
public String getDisplayName() {
  return PsiBundle.message("psi.search.scope.production.files");
}
项目:intellij-ce-playground    文件:GlobalSearchScopesCore.java   
@NotNull
@Override
public String getDisplayName() {
  return PsiBundle.message("psi.search.scope.test.files");
}
项目:intellij-ce-playground    文件:GlobalSearchScope.java   
@NotNull
@Override
public String getDisplayName() {
  return PsiBundle.message("psi.search.scope.union", myScopes[0].getDisplayName(), myScopes[1].getDisplayName());
}
项目:intellij-ce-playground    文件:SearchScope.java   
@NotNull
public String getDisplayName() {
  return PsiBundle.message("search.scope.unknown");
}
项目:intellij-ce-playground    文件:ModuleWithDependenciesScope.java   
@NotNull
@Override
public String getDisplayName() {
  return hasOption(COMPILE) ? PsiBundle.message("search.scope.module", myModule.getName())
                            : PsiBundle.message("search.scope.module.runtime", myModule.getName());
}
项目:intellij-ce-playground    文件:ProjectScopeImpl.java   
@NotNull
@Override
public String getDisplayName() {
  return PsiBundle.message("psi.search.scope.project");
}
项目:intellij-ce-playground    文件:PrattTokenType.java   
public String getExpectedText(final PrattBuilder builder) {
  return PsiBundle.message("0.expected", toString());
}
项目:tools-idea    文件:GlobalSearchScopesCore.java   
@Override
public String getDisplayName() {
  return PsiBundle.message("psi.search.scope.production.files");
}
项目:tools-idea    文件:GlobalSearchScopesCore.java   
@Override
public String getDisplayName() {
  return PsiBundle.message("psi.search.scope.test.files");
}
项目:tools-idea    文件:SearchScope.java   
public String getDisplayName() {
  return PsiBundle.message("search.scope.unknown");
}
项目:tools-idea    文件:ModuleWithDependenciesScope.java   
@Override
public String getDisplayName() {
  return hasOption(COMPILE) ? PsiBundle.message("search.scope.module", myModule.getName())
                            : PsiBundle.message("search.scope.module.runtime", myModule.getName());
}
项目:tools-idea    文件:ProjectAndLibrariesScope.java   
public String getDisplayName() {
  return PsiBundle.message("psi.search.scope.project.and.libraries");
}
项目:tools-idea    文件:ProjectScopeImpl.java   
@Override
public String getDisplayName() {
  return PsiBundle.message("psi.search.scope.project");
}
项目:tools-idea    文件:PrattTokenType.java   
public String getExpectedText(final PrattBuilder builder) {
  return PsiBundle.message("0.expected", toString());
}
项目:tools-idea    文件:CodeStyleSchemesImpl.java   
@Override
@NotNull
public String getPresentableName() {
  return PsiBundle.message("codestyle.export.display.name");
}
项目:consulo    文件:GlobalSearchScopesCore.java   
@Nonnull
@Override
public String getDisplayName() {
  return PsiBundle.message("psi.search.scope.production.files");
}
项目:consulo    文件:GlobalSearchScopesCore.java   
@Nonnull
@Override
public String getDisplayName() {
  return PsiBundle.message("psi.search.scope.test.files");
}
项目:consulo    文件:GlobalSearchScope.java   
@Nonnull
@Override
public String getDisplayName() {
  return PsiBundle.message("psi.search.scope.union", myScopes[0].getDisplayName(), myScopes[1].getDisplayName());
}
项目:consulo    文件:SearchScope.java   
public String getDisplayName() {
  return PsiBundle.message("search.scope.unknown");
}
项目:consulo    文件:ModuleWithDependenciesScope.java   
@Nonnull
@Override
public String getDisplayName() {
  return hasOption(COMPILE) ? PsiBundle.message("search.scope.module", myModule.getName())
                            : PsiBundle.message("search.scope.module.runtime", myModule.getName());
}
项目:consulo    文件:ProjectAndLibrariesScope.java   
@Override
@Nonnull
public String getDisplayName() {
  return PsiBundle.message("psi.search.scope.project.and.libraries");
}
项目:consulo    文件:ProjectScopeImpl.java   
@Nonnull
@Override
public String getDisplayName() {
  return PsiBundle.message("psi.search.scope.project");
}
项目:consulo    文件:PrattTokenType.java   
public String getExpectedText(final PrattBuilder builder) {
  return PsiBundle.message("0.expected", toString());
}
项目:consulo    文件:FindPopupScopeUIImpl.java   
public void initComponents() {
  Module[] modules = ModuleManager.getInstance(myProject).getModules();
  String[] names = new String[modules.length];
  for (int i = 0; i < modules.length; i++) {
    names[i] = modules[i].getName();
  }

  Arrays.sort(names, String.CASE_INSENSITIVE_ORDER);
  myModuleComboBox = new ComboBox<>(names);
  ActionListener restartSearchListener = e -> scheduleResultsUpdate();
  myModuleComboBox.addActionListener(restartSearchListener);

  myDirectoryChooser = new FindPopupDirectoryChooser(myFindPopupPanel);

  myScopeCombo = new ScopeChooserCombo();
  myScopeCombo.init(myProject, true, true, FindSettings.getInstance().getDefaultScopeName(), new Condition<ScopeDescriptor>() {
    //final String projectFilesScopeName = PsiBundle.message("psi.search.scope.project");
    final String moduleFilesScopeName;

    {
      String moduleScopeName = PsiBundle.message("search.scope.module", "");
      final int ind = moduleScopeName.indexOf(' ');
      moduleFilesScopeName = moduleScopeName.substring(0, ind + 1);
    }

    @Override
    public boolean value(ScopeDescriptor descriptor) {
      final String display = descriptor.getDisplay();
      return /*!projectFilesScopeName.equals(display) &&*/ !display.startsWith(moduleFilesScopeName);
    }
  });
  myScopeCombo.setBrowseListener(new ScopeChooserCombo.BrowseListener() {

    private FindModel myModelSnapshot;

    @Override
    public void onBeforeBrowseStarted() {
      myModelSnapshot = myHelper.getModel();
      myFindPopupPanel.getCanClose().set(false);
    }

    @Override
    public void onAfterBrowseFinished() {
      if (myModelSnapshot != null) {
        SearchScope scope = myScopeCombo.getSelectedScope();
        if (scope != null) {
          myModelSnapshot.setCustomScope(scope);
        }
        myFindPopupPanel.getCanClose().set(true);
      }
    }
  });
  myScopeCombo.getComboBox().addActionListener(restartSearchListener);
  Disposer.register(myFindPopupPanel.getDisposable(), myScopeCombo);
}
项目:consulo-java    文件:VisibilityUtil.java   
@NotNull
public static String toPresentableText(@PsiModifier.ModifierConstant @NotNull String modifier)
{
    return PsiBundle.visibilityPresentation(modifier);
}