Java 类com.intellij.lang.refactoring.InlineHandlers 实例源码

项目:intellij-ce-playground    文件:GenericInlineHandler.java   
public static Map<Language, InlineHandler.Inliner> initializeInliners(PsiElement element,
                                                                      InlineHandler.Settings settings,
                                                                      Collection<? extends PsiReference> allReferences) {
  final Map<Language, InlineHandler.Inliner> inliners = new HashMap<Language, InlineHandler.Inliner>();
  for (PsiReference ref : allReferences) {
    if (ref == null) {
      LOG.error("element: " + element.getClass()+ ", allReferences contains null!");
      continue;
    }
    PsiElement refElement = ref.getElement();
    LOG.assertTrue(refElement != null, ref.getClass().getName());

    final Language language = refElement.getLanguage();
    if (inliners.containsKey(language)) continue;

    final List<InlineHandler> handlers = InlineHandlers.getInlineHandlers(language);
    for (InlineHandler handler : handlers) {
      InlineHandler.Inliner inliner = handler.createInliner(element, settings);
      if (inliner != null) {
        inliners.put(language, inliner);
        break;
      }
    }
  }
  return inliners;
}
项目:tools-idea    文件:GenericInlineHandler.java   
public static Map<Language, InlineHandler.Inliner> initializeInliners(PsiElement element,
                                                                      InlineHandler.Settings settings,
                                                                      Collection<? extends PsiReference> allReferences) {
  final Map<Language, InlineHandler.Inliner> inliners = new HashMap<Language, InlineHandler.Inliner>();
  for (PsiReference ref : allReferences) {
    if (ref == null) {
      LOG.error("element: " + element.getClass()+ ", allReferences contains null!");
      continue;
    }
    PsiElement refElement = ref.getElement();
    LOG.assertTrue(refElement != null, ref.getClass().getName());

    final Language language = refElement.getLanguage();
    if (inliners.containsKey(language)) continue;

    final List<InlineHandler> handlers = InlineHandlers.getInlineHandlers(language);
    for (InlineHandler handler : handlers) {
      InlineHandler.Inliner inliner = handler.createInliner(element, settings);
      if (inliner != null) {
        inliners.put(language, inliner);
        break;
      }
    }
  }
  return inliners;
}
项目:consulo    文件:GenericInlineHandler.java   
public static Map<Language, InlineHandler.Inliner> initializeInliners(PsiElement element,
                                                                      InlineHandler.Settings settings,
                                                                      Collection<? extends PsiReference> allReferences) {
  final Map<Language, InlineHandler.Inliner> inliners = new HashMap<Language, InlineHandler.Inliner>();
  for (PsiReference ref : allReferences) {
    if (ref == null) {
      LOG.error("element: " + element.getClass()+ ", allReferences contains null!");
      continue;
    }
    PsiElement refElement = ref.getElement();
    LOG.assertTrue(refElement != null, ref.getClass().getName());

    final Language language = refElement.getLanguage();
    if (inliners.containsKey(language)) continue;

    final List<InlineHandler> handlers = InlineHandlers.getInlineHandlers(language);
    for (InlineHandler handler : handlers) {
      InlineHandler.Inliner inliner = handler.createInliner(element, settings);
      if (inliner != null) {
        inliners.put(language, inliner);
        break;
      }
    }
  }
  return inliners;
}
项目:intellij-ce-playground    文件:InlineAction.java   
private static boolean hasInlineActionHandler(PsiElement element, @Nullable Language editorLanguage, Editor editor) {
  for(InlineActionHandler handler: Extensions.getExtensions(InlineActionHandler.EP_NAME)) {
    if (handler.isEnabledOnElement(element, editor)) {
      return true;
    }
  }
  return InlineHandlers.getInlineHandlers(
    editorLanguage != null ? editorLanguage :element.getLanguage()
  ).size() > 0;
}
项目:intellij-ce-playground    文件:InlineAction.java   
@Override
protected RefactoringActionHandler getHandler(@NotNull Language language, PsiElement element) {
  RefactoringActionHandler handler = super.getHandler(language, element);
  if (handler != null) return handler;
  List<InlineHandler> handlers = InlineHandlers.getInlineHandlers(language);
  return handlers.isEmpty() ? null : new InlineRefactoringActionHandler();
}
项目:intellij-ce-playground    文件:InlineAction.java   
@Override
protected boolean isAvailableForLanguage(Language language) {
  for(InlineActionHandler handler: Extensions.getExtensions(InlineActionHandler.EP_NAME)) {
    if (handler.isEnabledForLanguage(language)) {
      return true;
    }
  }
  return InlineHandlers.getInlineHandlers(language).size() > 0;
}
项目:intellij-ce-playground    文件:InlineRefactoringActionHandler.java   
public static boolean invokeInliner(@Nullable Editor editor, PsiElement element) {
  final List<InlineHandler> handlers = InlineHandlers.getInlineHandlers(element.getLanguage());
  for (InlineHandler handler : handlers) {
    if (GenericInlineHandler.invoke(element, editor, handler)) {
      return true;
    }
  }
  return false;
}
项目:tools-idea    文件:InlineAction.java   
private static boolean hasInlineActionHandler(PsiElement element, @Nullable Language editorLanguage, Editor editor) {
  for(InlineActionHandler handler: Extensions.getExtensions(InlineActionHandler.EP_NAME)) {
    if (handler.isEnabledOnElement(element, editor)) {
      return true;
    }
  }
  return InlineHandlers.getInlineHandlers(
    editorLanguage != null ? editorLanguage :element.getLanguage()
  ).size() > 0;
}
项目:tools-idea    文件:InlineAction.java   
@Override
protected RefactoringActionHandler getHandler(@NotNull Language language, PsiElement element) {
  RefactoringActionHandler handler = super.getHandler(language, element);
  if (handler != null) return handler;
  List<InlineHandler> handlers = InlineHandlers.getInlineHandlers(language);
  return handlers.isEmpty() ? null : new InlineRefactoringActionHandler();
}
项目:tools-idea    文件:InlineAction.java   
@Override
protected boolean isAvailableForLanguage(Language language) {
  for(InlineActionHandler handler: Extensions.getExtensions(InlineActionHandler.EP_NAME)) {
    if (handler.isEnabledForLanguage(language)) {
      return true;
    }
  }
  return InlineHandlers.getInlineHandlers(language).size() > 0;
}
项目:tools-idea    文件:InlineRefactoringActionHandler.java   
public static boolean invokeInliner(@Nullable Editor editor, PsiElement element) {
  final List<InlineHandler> handlers = InlineHandlers.getInlineHandlers(element.getLanguage());
  for (InlineHandler handler : handlers) {
    if (GenericInlineHandler.invoke(element, editor, handler)) {
      return true;
    }
  }
  return false;
}
项目:consulo    文件:InlineAction.java   
private static boolean hasInlineActionHandler(PsiElement element, @Nullable Language editorLanguage, Editor editor) {
  for(InlineActionHandler handler: Extensions.getExtensions(InlineActionHandler.EP_NAME)) {
    if (handler.isEnabledOnElement(element, editor)) {
      return true;
    }
  }
  return InlineHandlers.getInlineHandlers(
    editorLanguage != null ? editorLanguage :element.getLanguage()
  ).size() > 0;
}
项目:consulo    文件:InlineAction.java   
@Override
protected RefactoringActionHandler getHandler(@Nonnull Language language, PsiElement element) {
  RefactoringActionHandler handler = super.getHandler(language, element);
  if (handler != null) return handler;
  List<InlineHandler> handlers = InlineHandlers.getInlineHandlers(language);
  return handlers.isEmpty() ? null : new InlineRefactoringActionHandler();
}
项目:consulo    文件:InlineAction.java   
@Override
protected boolean isAvailableForLanguage(Language language) {
  for(InlineActionHandler handler: Extensions.getExtensions(InlineActionHandler.EP_NAME)) {
    if (handler.isEnabledForLanguage(language)) {
      return true;
    }
  }
  return InlineHandlers.getInlineHandlers(language).size() > 0;
}
项目:consulo    文件:InlineRefactoringActionHandler.java   
public static boolean invokeInliner(@Nullable Editor editor, PsiElement element) {
  final List<InlineHandler> handlers = InlineHandlers.getInlineHandlers(element.getLanguage());
  for (InlineHandler handler : handlers) {
    if (GenericInlineHandler.invoke(element, editor, handler)) {
      return true;
    }
  }
  return false;
}