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


Java JavaFxControllerClassIndex类代码示例

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


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

示例1: isImplicitWrite

import org.jetbrains.plugins.javaFX.JavaFxControllerClassIndex; //导入依赖的package包/类
@Override
public boolean isImplicitWrite(PsiElement element) {
  if (element instanceof PsiField) {
    final String name = ((PsiField)element).getName();
    final PsiClass containingClass = ((PsiField)element).getContainingClass();
    if (containingClass != null) {
      final String qualifiedName = containingClass.getQualifiedName();
      if (qualifiedName != null) {
        final Project project = element.getProject();
        final List<VirtualFile> fxmls = JavaFxControllerClassIndex.findFxmlsWithController(project, qualifiedName);
        if (!fxmls.isEmpty()) {
          final Collection<String> filePaths = JavaFxIdsIndex.getFilePaths(project, name);
          for (VirtualFile fxml : fxmls) {
            if (filePaths.contains(fxml.getPath())) return true;
          }
        }
      }
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:JavaFxImplicitUsageProvider.java

示例2: collectTargets

import org.jetbrains.plugins.javaFX.JavaFxControllerClassIndex; //导入依赖的package包/类
private static <T> void collectTargets(PsiField field, final ArrayList<T> targets, final Function<PsiElement, T> fun, final boolean stopAtFirst) {
  final PsiClass containingClass = field.getContainingClass();
  LOG.assertTrue(containingClass != null);
  final String qualifiedName = containingClass.getQualifiedName();
  LOG.assertTrue(qualifiedName != null);
  final List<VirtualFile> fxmls = JavaFxControllerClassIndex.findFxmlsWithController(field.getProject(), qualifiedName);
  if (fxmls.isEmpty()) return;
  ReferencesSearch.search(field, GlobalSearchScope.filesScope(field.getProject(), fxmls)).forEach(
    new Processor<PsiReference>() {
      @Override
      public boolean process(PsiReference reference) {
        final PsiElement referenceElement = reference.getElement();
        if (referenceElement == null) return true;
        final PsiFile containingFile = referenceElement.getContainingFile();
        if (containingFile == null) return true;
        if (!JavaFxFileTypeFactory.isFxml(containingFile)) return true;
        if (!(referenceElement instanceof XmlAttributeValue)) return true;
        final XmlAttributeValue attributeValue = (XmlAttributeValue)referenceElement;
        final PsiElement parent = attributeValue.getParent();
        if (!(parent instanceof XmlAttribute)) return true;
        if (!FxmlConstants.FX_ID.equals(((XmlAttribute)parent).getName())) return true;
        targets.add(fun.fun(parent));
        return !stopAtFirst;
      }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:JavaFxRelatedItemLineMarkerProvider.java

示例3: getAdditionalUseScope

import org.jetbrains.plugins.javaFX.JavaFxControllerClassIndex; //导入依赖的package包/类
@Nullable
@Override
public SearchScope getAdditionalUseScope(@NotNull PsiElement element) {
  PsiClass containingClass = null;
  if (element instanceof PsiField) {
    containingClass = ((PsiField)element).getContainingClass();
  }
  else if (element instanceof PsiParameter) {
    final PsiElement declarationScope = ((PsiParameter)element).getDeclarationScope();
    if (declarationScope instanceof PsiMethod && PropertyUtil.isSimplePropertySetter((PsiMethod)declarationScope)) {
      containingClass = ((PsiMethod)declarationScope).getContainingClass();
    }
  }

  if (containingClass != null) {
    if (element instanceof PsiField && 
        !((PsiField)element).hasModifierProperty(PsiModifier.PUBLIC) && 
        AnnotationUtil.isAnnotated((PsiField)element, JavaFxCommonClassNames.JAVAFX_FXML_ANNOTATION, false) || element instanceof PsiParameter) {
      final Project project = element.getProject();
      final String qualifiedName = containingClass.getQualifiedName();
      if (qualifiedName != null && !JavaFxControllerClassIndex.findFxmlWithController(project, qualifiedName).isEmpty()) {
        final GlobalSearchScope projectScope = GlobalSearchScope.projectScope(project);
        return new DelegatingGlobalSearchScope(projectScope){
          @Override
          public boolean contains(@NotNull VirtualFile file) {
            return super.contains(file) && JavaFxFileTypeFactory.isFxml(file);
          }
        };
      }
    }
  } 

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

示例4: getAdditionalUseScope

import org.jetbrains.plugins.javaFX.JavaFxControllerClassIndex; //导入依赖的package包/类
@Nullable
@Override
public SearchScope getAdditionalUseScope(@NotNull PsiElement element) {
  PsiClass containingClass = null;
  if (element instanceof PsiField) {
    containingClass = ((PsiField)element).getContainingClass();
  }
  else if (element instanceof PsiParameter) {
    final PsiElement declarationScope = ((PsiParameter)element).getDeclarationScope();
    if (declarationScope instanceof PsiMethod && PropertyUtil.isSimplePropertySetter((PsiMethod)declarationScope)) {
      containingClass = ((PsiMethod)declarationScope).getContainingClass();
    }
  }

  if (containingClass != null) {
    if (element instanceof PsiField && ((PsiField)element).hasModifierProperty(PsiModifier.PRIVATE) || element instanceof PsiParameter) {
      final Project project = element.getProject();
      final String qualifiedName = containingClass.getQualifiedName();
      if (qualifiedName != null && !JavaFxControllerClassIndex.findFxmlWithController(project, qualifiedName).isEmpty()) {
        final GlobalSearchScope projectScope = GlobalSearchScope.projectScope(project);
        return new DelegatingGlobalSearchScope(projectScope){
          @Override
          public boolean contains(VirtualFile file) {
            return super.contains(file) && JavaFxFileTypeFactory.isFxml(file);
          }
        };
      }
    }
  } 

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

示例5: execute

import org.jetbrains.plugins.javaFX.JavaFxControllerClassIndex; //导入依赖的package包/类
@Override
public boolean execute(@NotNull final ReferencesSearch.SearchParameters queryParameters, @NotNull final Processor<PsiReference> consumer) {
  final PsiElement elementToSearch = queryParameters.getElementToSearch();
  if (elementToSearch instanceof PsiField) {
    final PsiField field = (PsiField)elementToSearch;
    final PsiClass containingClass = ApplicationManager.getApplication().runReadAction(new Computable<PsiClass>() {
      @Override
      public PsiClass compute() {
        return field.getContainingClass();
      }
    });
    if (containingClass != null) {
      final String qualifiedName = ApplicationManager.getApplication().runReadAction(new Computable<String>() {
        @Override
        public String compute() {
          return containingClass.getQualifiedName(); 
        }
      });
      if (qualifiedName != null) {
        Project project = PsiUtilCore.getProjectInReadAction(containingClass);
        final List<PsiFile> fxmlWithController =
          JavaFxControllerClassIndex.findFxmlWithController(project, qualifiedName);
        for (final PsiFile file : fxmlWithController) {
          ApplicationManager.getApplication().runReadAction(new Runnable() {
            @Override
            public void run() {
              final String fieldName = field.getName();
              final VirtualFile virtualFile = file.getViewProvider().getVirtualFile();
              final SearchScope searchScope = queryParameters.getEffectiveSearchScope();
              boolean contains = searchScope instanceof LocalSearchScope ? ((LocalSearchScope)searchScope).isInScope(virtualFile) :
                                 ((GlobalSearchScope)searchScope).contains(virtualFile);
              if (contains) {
                file.accept(new XmlRecursiveElementVisitor() {
                  @Override
                  public void visitXmlAttributeValue(final XmlAttributeValue value) {
                    final PsiReference reference = value.getReference();
                    if (reference != null) {
                      final PsiElement resolve = reference.resolve();
                      if (resolve instanceof XmlAttributeValue) {
                        final PsiElement parent = resolve.getParent();
                        if (parent instanceof XmlAttribute) {
                          final XmlAttribute attribute = (XmlAttribute)parent;
                          if (FxmlConstants.FX_ID.equals(attribute.getName()) && fieldName.equals(attribute.getValue())) {
                            consumer.process(reference);
                          }
                        }
                      }
                    }
                  }
                });
              }
            }
          });
        }
      }
    }
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:60,代码来源:JavaFxControllerFieldSearcher.java

示例6: execute

import org.jetbrains.plugins.javaFX.JavaFxControllerClassIndex; //导入依赖的package包/类
@Override
public boolean execute(@NotNull final ReferencesSearch.SearchParameters queryParameters, @NotNull final Processor<PsiReference> consumer) {
  final PsiElement elementToSearch = queryParameters.getElementToSearch();
  if (elementToSearch instanceof PsiField) {
    final PsiField field = (PsiField)elementToSearch;
    final PsiClass containingClass = field.getContainingClass();
    if (containingClass != null) {
      final String qualifiedName = ApplicationManager.getApplication().runReadAction(new Computable<String>() {
        @Override
        public String compute() {
          return containingClass.getQualifiedName(); 
        }
      });
      if (qualifiedName != null) {
        final List<PsiFile> fxmlWithController = 
          JavaFxControllerClassIndex.findFxmlWithController(containingClass.getProject(), qualifiedName);
        final String fieldName = field.getName();
        for (PsiFile file : fxmlWithController) {
          final VirtualFile virtualFile = file.getViewProvider().getVirtualFile();
          final SearchScope searchScope = ApplicationManager.getApplication().runReadAction(new Computable<SearchScope>() {
            @Override
            public SearchScope compute() {
              return queryParameters.getEffectiveSearchScope();
            }
          });
          if (searchScope instanceof LocalSearchScope) {
            if (!((LocalSearchScope)searchScope).isInScope(virtualFile)) continue;
          } else if (searchScope instanceof GlobalSearchScope) {
            if (!((GlobalSearchScope)searchScope).contains(virtualFile)) continue;
          }
          file.accept(new XmlRecursiveElementVisitor() {
            @Override
            public void visitXmlAttributeValue(final XmlAttributeValue value) {
              Runnable runnable = new Runnable() {
                public void run() {
                  final PsiReference reference = value.getReference();
                  if (reference != null) {
                    final PsiElement resolve = reference.resolve();
                    if (resolve instanceof XmlAttributeValue) {
                      final PsiElement parent = resolve.getParent();
                      if (parent instanceof XmlAttribute) {
                        final XmlAttribute attribute = (XmlAttribute)parent;
                        if (FxmlConstants.FX_ID.equals(attribute.getName()) && fieldName.equals(attribute.getValue())) {
                          consumer.process(reference);
                        }
                      }
                    }
                  }
                }
              };
              ApplicationManager.getApplication().runReadAction(runnable);
            }
          });
        }
      }
    }
  }
  return true;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:60,代码来源:JavaFxControllerFieldSearcher.java

示例7: execute

import org.jetbrains.plugins.javaFX.JavaFxControllerClassIndex; //导入依赖的package包/类
@Override
public boolean execute(@NotNull final ReferencesSearch.SearchParameters queryParameters, @NotNull final Processor<PsiReference> consumer) {
  final PsiElement elementToSearch = queryParameters.getElementToSearch();
  if (elementToSearch instanceof PsiField) {
    final PsiField field = (PsiField)elementToSearch;
    final PsiClass containingClass = field.getContainingClass();
    if (containingClass != null) {
      final String qualifiedName = ApplicationManager.getApplication().runReadAction(new Computable<String>() {
        @Override
        public String compute() {
          return containingClass.getQualifiedName(); 
        }
      });
      if (qualifiedName != null) {
        final List<PsiFile> fxmlWithController = 
          JavaFxControllerClassIndex.findFxmlWithController(containingClass.getProject(), qualifiedName);
        final String fieldName = field.getName();
        for (final PsiFile file : fxmlWithController) {
          final VirtualFile virtualFile = file.getViewProvider().getVirtualFile();
          final SearchScope searchScope = ApplicationManager.getApplication().runReadAction(new Computable<SearchScope>() {
            @Override
            public SearchScope compute() {
              return queryParameters.getEffectiveSearchScope();
            }
          });
          if (searchScope instanceof LocalSearchScope) {
            if (!((LocalSearchScope)searchScope).isInScope(virtualFile)) continue;
          } else if (searchScope instanceof GlobalSearchScope) {
            if (!((GlobalSearchScope)searchScope).contains(virtualFile)) continue;
          }
          final Runnable runnable = new Runnable() {
            public void run() {
              file.accept(new XmlRecursiveElementVisitor() {
                @Override
                public void visitXmlAttributeValue(final XmlAttributeValue value) {
                  final PsiReference reference = value.getReference();
                  if (reference != null) {
                    final PsiElement resolve = reference.resolve();
                    if (resolve instanceof XmlAttributeValue) {
                      final PsiElement parent = resolve.getParent();
                      if (parent instanceof XmlAttribute) {
                        final XmlAttribute attribute = (XmlAttribute)parent;
                        if (FxmlConstants.FX_ID.equals(attribute.getName()) && fieldName.equals(attribute.getValue())) {
                          consumer.process(reference);
                        }
                      }
                    }
                  }
                }
              });
            }
          };
          ApplicationManager.getApplication().runReadAction(runnable);
        }
      }
    }
  }
  return true;
}
 
开发者ID:consulo,项目名称:consulo-javafx,代码行数:60,代码来源:JavaFxControllerFieldSearcher.java


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