Java 类com.intellij.psi.impl.search.ThrowSearchUtil 实例源码

项目:intellij-ce-playground    文件:JavaFindUsagesProvider.java   
@Override
public String getHelpId(@NotNull PsiElement element) {
  if (element instanceof PsiPackage) {
    return HelpID.FIND_PACKAGE_USAGES;
  }
  if (element instanceof PsiClass) {
    return HelpID.FIND_CLASS_USAGES;
  }
  if (element instanceof PsiMethod) {
    return HelpID.FIND_METHOD_USAGES;
  }
  if (ThrowSearchUtil.isSearchable(element)) {
    return HelpID.FIND_THROW_USAGES;
  }
  return com.intellij.lang.HelpID.FIND_OTHER_USAGES;
}
项目:intellij-ce-playground    文件:JavaFindUsagesHandler.java   
@Override
@NotNull
public AbstractFindUsagesDialog getFindUsagesDialog(boolean isSingleFile, boolean toShowInNewTab, boolean mustOpenInNewTab) {
  PsiElement element = getPsiElement();
  if (element instanceof PsiPackage) {
    return new FindPackageUsagesDialog(element, getProject(), myFactory.getFindPackageOptions(), toShowInNewTab, mustOpenInNewTab, isSingleFile, this);
  }
  if (element instanceof PsiClass) {
    return new FindClassUsagesDialog(element, getProject(), myFactory.getFindClassOptions(), toShowInNewTab, mustOpenInNewTab, isSingleFile, this);
  }
  if (element instanceof PsiMethod) {
    return new FindMethodUsagesDialog(element, getProject(), myFactory.getFindMethodOptions(), toShowInNewTab, mustOpenInNewTab, isSingleFile, this);
  }
  if (element instanceof PsiVariable) {
    return new FindVariableUsagesDialog(element, getProject(), myFactory.getFindVariableOptions(), toShowInNewTab, mustOpenInNewTab, isSingleFile, this);
  }
  if (ThrowSearchUtil.isSearchable(element)) {
    return new FindThrowUsagesDialog(element, getProject(), myFactory.getFindThrowOptions(), toShowInNewTab, mustOpenInNewTab, isSingleFile, this);
  }
  return super.getFindUsagesDialog(isSingleFile, toShowInNewTab, mustOpenInNewTab);
}
项目:intellij-ce-playground    文件:JavaFindUsagesHandler.java   
@Override
@NotNull
public FindUsagesOptions getFindUsagesOptions(@Nullable final DataContext dataContext) {
  PsiElement element = getPsiElement();
  if (element instanceof PsiPackage) {
    return myFactory.getFindPackageOptions();
  }
  if (element instanceof PsiClass) {
    return myFactory.getFindClassOptions();
  }
  if (element instanceof PsiMethod) {
    return myFactory.getFindMethodOptions();
  }
  if (element instanceof PsiVariable) {
    return myFactory.getFindVariableOptions();
  }
  if (ThrowSearchUtil.isSearchable(element)) {
    return myFactory.getFindThrowOptions();
  }
  return super.getFindUsagesOptions(dataContext);
}
项目:tools-idea    文件:JavaFindUsagesProvider.java   
@Override
public String getHelpId(@NotNull PsiElement element) {
  if (element instanceof PsiPackage) {
    return HelpID.FIND_PACKAGE_USAGES;
  }
  if (element instanceof PsiClass) {
    return HelpID.FIND_CLASS_USAGES;
  }
  if (element instanceof PsiMethod) {
    return HelpID.FIND_METHOD_USAGES;
  }
  if (ThrowSearchUtil.isSearchable(element)) {
    return HelpID.FIND_THROW_USAGES;
  }
  return HelpID.FIND_OTHER_USAGES;
}
项目:tools-idea    文件:JavaFindUsagesHandler.java   
@Override
@NotNull
public AbstractFindUsagesDialog getFindUsagesDialog(boolean isSingleFile, boolean toShowInNewTab, boolean mustOpenInNewTab) {
  PsiElement element = getPsiElement();
  if (element instanceof PsiPackage) {
    return new FindPackageUsagesDialog(element, getProject(), myFactory.getFindPackageOptions(), toShowInNewTab, mustOpenInNewTab, isSingleFile, this);
  }
  if (element instanceof PsiClass) {
    return new FindClassUsagesDialog(element, getProject(), myFactory.getFindClassOptions(), toShowInNewTab, mustOpenInNewTab, isSingleFile, this);
  }
  if (element instanceof PsiMethod) {
    return new FindMethodUsagesDialog(element, getProject(), myFactory.getFindMethodOptions(), toShowInNewTab, mustOpenInNewTab, isSingleFile, this);
  }
  if (element instanceof PsiVariable) {
    return new FindVariableUsagesDialog(element, getProject(), myFactory.getFindVariableOptions(), toShowInNewTab, mustOpenInNewTab, isSingleFile, this);
  }
  if (ThrowSearchUtil.isSearchable(element)) {
    return new FindThrowUsagesDialog(element, getProject(), myFactory.getFindThrowOptions(), toShowInNewTab, mustOpenInNewTab, isSingleFile, this);
  }
  return super.getFindUsagesDialog(isSingleFile, toShowInNewTab, mustOpenInNewTab);
}
项目:tools-idea    文件:JavaFindUsagesHandler.java   
@Override
@NotNull
public FindUsagesOptions getFindUsagesOptions(@Nullable final DataContext dataContext) {
  PsiElement element = getPsiElement();
  if (element instanceof PsiPackage) {
    return myFactory.getFindPackageOptions();
  }
  if (element instanceof PsiClass) {
    return myFactory.getFindClassOptions();
  }
  if (element instanceof PsiMethod) {
    return myFactory.getFindMethodOptions();
  }
  if (element instanceof PsiVariable) {
    return myFactory.getFindVariableOptions();
  }
  if (ThrowSearchUtil.isSearchable(element)) {
    return myFactory.getFindThrowOptions();
  }
  return super.getFindUsagesOptions(dataContext);
}
项目:consulo-java    文件:JavaFindUsagesProvider.java   
@Override
public boolean canFindUsagesFor(@NotNull PsiElement element)
{
    if(element instanceof PsiDirectory)
    {
        PsiPackage psiPackage = JavaDirectoryService.getInstance().getPackage((PsiDirectory) element);
        return psiPackage != null && psiPackage.getQualifiedName().length() != 0;
    }

    return element instanceof PsiClass ||
            element instanceof PsiVariable ||
            element instanceof PsiMethod ||
            element instanceof PsiPackage ||
            element instanceof PsiLabeledStatement ||
            ThrowSearchUtil.isSearchable(element) ||
            element instanceof PsiMetaOwner && ((PsiMetaOwner) element).getMetaData() != null;
}
项目:consulo-java    文件:JavaFindUsagesProvider.java   
@Override
public String getHelpId(@NotNull PsiElement element)
{
    if(element instanceof PsiPackage)
    {
        return HelpID.FIND_PACKAGE_USAGES;
    }
    if(element instanceof PsiClass)
    {
        return HelpID.FIND_CLASS_USAGES;
    }
    if(element instanceof PsiMethod)
    {
        return HelpID.FIND_METHOD_USAGES;
    }
    if(ThrowSearchUtil.isSearchable(element))
    {
        return HelpID.FIND_THROW_USAGES;
    }
    return HelpID.FIND_OTHER_USAGES;
}
项目:intellij-ce-playground    文件:JavaFindUsagesProvider.java   
@Override
public boolean canFindUsagesFor(@NotNull PsiElement element) {
  if (element instanceof PsiDirectory) {
    PsiPackage psiPackage = JavaDirectoryService.getInstance().getPackage((PsiDirectory)element);
    return psiPackage != null && psiPackage.getQualifiedName().length() != 0;
  }

  return element instanceof PsiClass ||
         element instanceof PsiVariable ||
         element instanceof PsiMethod ||
         element instanceof PsiPackage ||
         element instanceof PsiLabeledStatement ||
         ThrowSearchUtil.isSearchable(element) ||
         element instanceof PsiMetaOwner && ((PsiMetaOwner)element).getMetaData() != null;
}
项目:intellij-ce-playground    文件:FindThrowUsagesDialog.java   
@Override
protected void update(){
  if (!myHasFindWhatPanel){
    setOKActionEnabled(true);
  }
  else{
    getFindUsagesOptions().setRoot((ThrowSearchUtil.Root)myCbExns.getSelectedItem());
    final boolean hasSelected = isSelected(myCbUsages);
    setOKActionEnabled(hasSelected);
  }
}
项目:tools-idea    文件:JavaFindUsagesProvider.java   
@Override
public boolean canFindUsagesFor(@NotNull PsiElement element) {
  if (element instanceof PsiDirectory) {
    PsiPackage psiPackage = JavaDirectoryService.getInstance().getPackage((PsiDirectory)element);
    return psiPackage != null && psiPackage.getQualifiedName().length() != 0;
  }

  return element instanceof PsiClass ||
         element instanceof PsiVariable ||
         element instanceof PsiMethod ||
         element instanceof PsiPackage ||
         element instanceof PsiLabeledStatement ||
         ThrowSearchUtil.isSearchable(element) ||
         element instanceof PsiMetaOwner && ((PsiMetaOwner)element).getMetaData() != null;
}
项目:tools-idea    文件:FindThrowUsagesDialog.java   
@Override
protected void update(){
  if (!myHasFindWhatPanel){
    setOKActionEnabled(true);
  }
  else{
    myFindUsagesOptions.putUserData(ThrowSearchUtil.THROW_SEARCH_ROOT_KEY, (ThrowSearchUtil.Root)myCbExns.getSelectedItem());
    final boolean hasSelected = isSelected(myCbUsages);
    setOKActionEnabled(hasSelected);
  }
}
项目:consulo-java    文件:JavaFindUsagesHandler.java   
@Override
@NotNull
public AbstractFindUsagesDialog getFindUsagesDialog(boolean isSingleFile,
        boolean toShowInNewTab,
        boolean mustOpenInNewTab)
{
    PsiElement element = getPsiElement();
    if(element instanceof PsiPackage)
    {
        return new FindPackageUsagesDialog(element, getProject(), myFactory.getFindPackageOptions(),
                toShowInNewTab, mustOpenInNewTab, isSingleFile, this);
    }
    if(element instanceof PsiClass)
    {
        return new FindClassUsagesDialog(element, getProject(), myFactory.getFindClassOptions(), toShowInNewTab,
                mustOpenInNewTab, isSingleFile, this);
    }
    if(element instanceof PsiMethod)
    {
        return new FindMethodUsagesDialog(element, getProject(), myFactory.getFindMethodOptions(), toShowInNewTab,
                mustOpenInNewTab, isSingleFile, this);
    }
    if(element instanceof PsiVariable)
    {
        return new FindVariableUsagesDialog(element, getProject(), myFactory.getFindVariableOptions(),
                toShowInNewTab, mustOpenInNewTab, isSingleFile, this);
    }
    if(ThrowSearchUtil.isSearchable(element))
    {
        return new FindThrowUsagesDialog(element, getProject(), myFactory.getFindThrowOptions(), toShowInNewTab,
                mustOpenInNewTab, isSingleFile, this);
    }
    return super.getFindUsagesDialog(isSingleFile, toShowInNewTab, mustOpenInNewTab);
}
项目:consulo-java    文件:JavaFindUsagesHandler.java   
@Override
@NotNull
public FindUsagesOptions getFindUsagesOptions(@Nullable final DataContext dataContext)
{
    PsiElement element = getPsiElement();
    if(element instanceof PsiPackage)
    {
        return myFactory.getFindPackageOptions();
    }
    if(element instanceof PsiClass)
    {
        return myFactory.getFindClassOptions();
    }
    if(element instanceof PsiMethod)
    {
        return myFactory.getFindMethodOptions();
    }
    if(element instanceof PsiVariable)
    {
        return myFactory.getFindVariableOptions();
    }
    if(ThrowSearchUtil.isSearchable(element))
    {
        return myFactory.getFindThrowOptions();
    }
    return super.getFindUsagesOptions(dataContext);
}
项目:consulo-java    文件:FindThrowUsagesDialog.java   
@Override
protected void init()
{
    // Kludge: myRoots used in super.init, which caller from constructor
    myRoots = ThrowSearchUtil.getSearchRoots(myPsiElement);
    super.init();
}
项目:consulo-java    文件:FindThrowUsagesDialog.java   
@Override
protected void update()
{
    if(!myHasFindWhatPanel)
    {
        setOKActionEnabled(true);
    }
    else
    {
        getFindUsagesOptions().setRoot((ThrowSearchUtil.Root) myCbExns.getSelectedItem());
        final boolean hasSelected = isSelected(myCbUsages);
        setOKActionEnabled(hasSelected);
    }
}
项目:intellij-ce-playground    文件:JavaThrowFindUsagesOptions.java   
public ThrowSearchUtil.Root getRoot() {
  return root;
}
项目:intellij-ce-playground    文件:JavaThrowFindUsagesOptions.java   
public void setRoot(ThrowSearchUtil.Root root) {
  this.root = root;
}
项目:intellij-ce-playground    文件:JavaFindUsagesProvider.java   
@Override
@NotNull
public String getType(@NotNull PsiElement element) {
  if (element instanceof PsiDirectory) {
    return LangBundle.message("terms.directory");
  }
  if (element instanceof PsiFile) {
    return LangBundle.message("terms.file");
  }
  if (ThrowSearchUtil.isSearchable(element)) {
    return LangBundle.message("java.terms.exception");
  }
  if (element instanceof PsiPackage) {
    return LangBundle.message("java.terms.package");
  }
  if (element instanceof PsiLabeledStatement) {
    return LangBundle.message("java.terms.label");
  }
  if (element instanceof PsiClass) {
    if (((PsiClass)element).isAnnotationType()) {
      return LangBundle.message("java.terms.annotation.interface");
    }
    if (((PsiClass)element).isEnum()) {
      return LangBundle.message("java.terms.enum");
    }
    if (((PsiClass)element).isInterface()) {
      return LangBundle.message("java.terms.interface");
    }
    if (element instanceof PsiTypeParameter) {
      return LangBundle.message("java.terms.type.parameter");
    }
    return LangBundle.message("java.terms.class");
  }
  if (element instanceof PsiField) {
    return LangBundle.message("java.terms.field");
  }
  if (element instanceof PsiParameter) {
    return LangBundle.message("java.terms.parameter");
  }
  if (element instanceof PsiLocalVariable) {
    return LangBundle.message("java.terms.variable");
  }
  if (element instanceof PsiMethod) {
    final PsiMethod psiMethod = (PsiMethod)element;
    final boolean isConstructor = psiMethod.isConstructor();
    if (isConstructor) {
      return LangBundle.message("java.terms.constructor");
    }
    return LangBundle.message("java.terms.method");
  }
  if (element instanceof PsiExpression) {
    return LangBundle.message("java.terms.expression");
  }

  final String name = TypePresentationService.getService().getTypePresentableName(element.getClass());
  if (name != null) {
    return name;
  }
  return "";
}
项目:intellij-ce-playground    文件:FindThrowUsagesDialog.java   
@Override
protected void init () {
  // Kludge: myRoots used in super.init, which caller from constructor
  myRoots = ThrowSearchUtil.getSearchRoots(myPsiElement);
  super.init ();
}
项目:intellij-ce-playground    文件:FindThrowUsagesDialog.java   
@Override
protected void doOKAction() {
  getFindUsagesOptions().setRoot((ThrowSearchUtil.Root)myCbExns.getSelectedItem());
  super.doOKAction();
}
项目:tools-idea    文件:JavaFindUsagesProvider.java   
@Override
@NotNull
public String getType(@NotNull PsiElement element) {
  if (element instanceof PsiDirectory) {
    return LangBundle.message("terms.directory");
  }
  if (element instanceof PsiFile) {
    return LangBundle.message("terms.file");
  }
  if (ThrowSearchUtil.isSearchable(element)) {
    return LangBundle.message("java.terms.exception");
  }
  if (element instanceof PsiPackage) {
    return LangBundle.message("java.terms.package");
  }
  if (element instanceof PsiLabeledStatement) {
    return LangBundle.message("java.terms.label");
  }
  if (element instanceof PsiClass) {
    if (((PsiClass)element).isAnnotationType()) {
      return LangBundle.message("java.terms.annotation.interface");
    }
    if (((PsiClass)element).isEnum()) {
      return LangBundle.message("java.terms.enum");
    }
    if (((PsiClass)element).isInterface()) {
      return LangBundle.message("java.terms.interface");
    }
    if (element instanceof PsiTypeParameter) {
      return LangBundle.message("java.terms.type.parameter");
    }
    return LangBundle.message("java.terms.class");
  }
  if (element instanceof PsiField) {
    return LangBundle.message("java.terms.field");
  }
  if (element instanceof PsiParameter) {
    return LangBundle.message("java.terms.parameter");
  }
  if (element instanceof PsiLocalVariable) {
    return LangBundle.message("java.terms.variable");
  }
  if (element instanceof PsiMethod) {
    final PsiMethod psiMethod = (PsiMethod)element;
    final boolean isConstructor = psiMethod.isConstructor();
    if (isConstructor) {
      return LangBundle.message("java.terms.constructor");
    }
    return LangBundle.message("java.terms.method");
  }
  if (element instanceof PsiExpression) {
    return LangBundle.message("java.terms.expression");
  }

  final String name = TypePresentationService.getService().getTypePresentableName(element.getClass());
  if (name != null) {
    return name;
  }
  return "";
}
项目:tools-idea    文件:FindThrowUsagesDialog.java   
@Override
protected void init () {
  // Kludge: myRoots used in super.init, which caller from constructor
  myRoots = ThrowSearchUtil.getSearchRoots(myPsiElement);
  super.init ();
}
项目:tools-idea    文件:FindThrowUsagesDialog.java   
@Override
protected void doOKAction() {
  myFindUsagesOptions.putUserData(ThrowSearchUtil.THROW_SEARCH_ROOT_KEY, (ThrowSearchUtil.Root)myCbExns.getSelectedItem());
  super.doOKAction();
}
项目:consulo-java    文件:JavaThrowFindUsagesOptions.java   
public ThrowSearchUtil.Root getRoot()
{
    return root;
}
项目:consulo-java    文件:JavaThrowFindUsagesOptions.java   
public void setRoot(ThrowSearchUtil.Root root)
{
    this.root = root;
}
项目:consulo-java    文件:JavaFindUsagesProvider.java   
@Override
@NotNull
public String getType(@NotNull PsiElement element)
{
    if(element instanceof PsiDirectory)
    {
        return LangBundle.message("terms.directory");
    }
    if(element instanceof PsiFile)
    {
        return LangBundle.message("terms.file");
    }
    if(ThrowSearchUtil.isSearchable(element))
    {
        return LangBundle.message("java.terms.exception");
    }
    if(element instanceof PsiPackage)
    {
        return LangBundle.message("java.terms.package");
    }
    if(element instanceof PsiLabeledStatement)
    {
        return LangBundle.message("java.terms.label");
    }
    if(element instanceof PsiClass)
    {
        if(((PsiClass) element).isAnnotationType())
        {
            return LangBundle.message("java.terms.annotation.interface");
        }
        if(((PsiClass) element).isEnum())
        {
            return LangBundle.message("java.terms.enum");
        }
        if(((PsiClass) element).isInterface())
        {
            return LangBundle.message("java.terms.interface");
        }
        if(element instanceof PsiTypeParameter)
        {
            return LangBundle.message("java.terms.type.parameter");
        }
        return LangBundle.message("java.terms.class");
    }
    if(element instanceof PsiField)
    {
        return LangBundle.message("java.terms.field");
    }
    if(element instanceof PsiParameter)
    {
        return LangBundle.message("java.terms.parameter");
    }
    if(element instanceof PsiLocalVariable)
    {
        return LangBundle.message("java.terms.variable");
    }
    if(element instanceof PsiMethod)
    {
        final PsiMethod psiMethod = (PsiMethod) element;
        final boolean isConstructor = psiMethod.isConstructor();
        if(isConstructor)
        {
            return LangBundle.message("java.terms.constructor");
        }
        return LangBundle.message("java.terms.method");
    }
    if(element instanceof PsiExpression)
    {
        return LangBundle.message("java.terms.expression");
    }

    final String name = TypePresentationService.getInstance().getTypePresentableName(element.getClass());
    if(name != null)
    {
        return name;
    }
    return "";
}
项目:consulo-java    文件:FindThrowUsagesDialog.java   
@Override
protected void doOKAction()
{
    getFindUsagesOptions().setRoot((ThrowSearchUtil.Root) myCbExns.getSelectedItem());
    super.doOKAction();
}