コード例 #1
0
 @Nullable
 public static DomNameStrategy getDomNameStrategy(final Class<?> rawType, boolean isAttribute) {
   Class aClass = null;
   if (isAttribute) {
     NameStrategyForAttributes annotation =
         DomReflectionUtil.findAnnotationDFS(rawType, NameStrategyForAttributes.class);
     if (annotation != null) {
       aClass = annotation.value();
     }
   }
   if (aClass == null) {
     NameStrategy annotation = DomReflectionUtil.findAnnotationDFS(rawType, NameStrategy.class);
     if (annotation != null) {
       aClass = annotation.value();
     }
   }
   if (aClass != null) {
     if (HyphenNameStrategy.class.equals(aClass)) return DomNameStrategy.HYPHEN_STRATEGY;
     if (JavaNameStrategy.class.equals(aClass)) return DomNameStrategy.JAVA_STRATEGY;
     try {
       return (DomNameStrategy) aClass.newInstance();
     } catch (InstantiationException e) {
       LOG.error(e);
     } catch (IllegalAccessException e) {
       LOG.error(e);
     }
   }
   return null;
 }
コード例 #2
0
 @Override
 public Collection<VirtualFile> getDomFileCandidates(
     Class<? extends DomElement> rootElementClass,
     Project project,
     final GlobalSearchScope scope) {
   return FileBasedIndex.getInstance()
       .getContainingFiles(DomFileIndex.NAME, rootElementClass.getName(), scope);
 }
コード例 #3
0
 public static <T> T getImmediateParent(ConvertContext context, Class<T> clazz) {
   DomElement parentElement = context.getInvocationElement().getParent();
   return clazz.isInstance(parentElement) ? (T) parentElement : null;
 }
コード例 #4
0
 public Collection<VirtualFile> getDomFileCandidates(
     Class<? extends DomElement> description, Project project) {
   return FileBasedIndex.getInstance()
       .getContainingFiles(
           DomFileIndex.NAME, description.getName(), GlobalSearchScope.allScope(project));
 }