Java 类com.intellij.util.PairConvertor 实例源码

项目:intellij-ce-playground    文件:MultipleTraitsSpeedSearch.java   
@Override
protected boolean isMatchingElement(Object element, String pattern) {
  for (PairConvertor<Object, String, Boolean> convertor : myOrderedConvertors) {
    final Boolean matched = convertor.convert(element, pattern);
    if (Boolean.TRUE.equals(matched)) return true;
  }
  return false;
}
项目:tools-idea    文件:MultipleTraitsSpeedSearch.java   
@Override
protected boolean isMatchingElement(Object element, String pattern) {
  for (PairConvertor<Object, String, Boolean> convertor : myOrderedConvertors) {
    final Boolean matched = convertor.convert(element, pattern);
    if (Boolean.TRUE.equals(matched)) return true;
  }
  return false;
}
项目:consulo    文件:MultipleTraitsSpeedSearch.java   
@Override
protected boolean isMatchingElement(Object element, String pattern) {
  for (PairConvertor<Object, String, Boolean> convertor : myOrderedConvertors) {
    final Boolean matched = convertor.convert(element, pattern);
    if (Boolean.TRUE.equals(matched)) return true;
  }
  return false;
}
项目:intellij-ce-playground    文件:MultipleTraitsListSpeedSearch.java   
public MultipleTraitsListSpeedSearch(JList component, @NotNull List<PairConvertor<Object, String, Boolean>> convertors) {
  super(component, convertors);
}
项目:intellij-ce-playground    文件:MultipleTraitsSpeedSearch.java   
public MultipleTraitsSpeedSearch(Comp component, @NotNull List<PairConvertor<Object, String, Boolean>> convertors) {
  super(component);
  myOrderedConvertors = convertors;
}
项目:intellij-ce-playground    文件:FileTypeConfigurable.java   
private MySpeedSearch(JList component) {
  super(component, new ArrayList<PairConvertor<Object, String, Boolean>>());
  initConvertors();
}
项目:intellij-ce-playground    文件:SchemaTypeInheritanceIndex.java   
public static PairConvertor<String, String, List<Set<SchemaTypeInfo>>> getWorker(final Project project, final VirtualFile currentFile) {
  return new MyWorker(currentFile, project);
}
项目:intellij-ce-playground    文件:SchemaDefinitionsSearch.java   
private Collection<SchemaTypeInfo> gatherInheritors(XmlTagImpl xml) {
  XmlAttribute name = getNameAttr(xml);
  if (name == null || StringUtil.isEmptyOrSpaces(name.getValue())) return null;
  String localName = name.getValue();
  final boolean hasPrefix = localName.contains(":");
  localName = hasPrefix ? localName.substring(localName.indexOf(':') + 1) : localName;
  final String nsPrefix = hasPrefix ? name.getValue().substring(0, name.getValue().indexOf(':')) : null;

  final XmlFile file = XmlUtil.getContainingFile(xml);
  if (file == null) return null;
  final Project project = file.getProject();
  if (project == null) return null;

  final Set<SchemaTypeInfo> result = new HashSet<SchemaTypeInfo>();
  final ArrayDeque<SchemaTypeInfo> queue = new ArrayDeque<SchemaTypeInfo>();

  String nsUri;
  if (! hasPrefix) {
    nsUri = getDefaultNs(file);
  } else {
    nsUri = XmlUtil.findNamespaceByPrefix(nsPrefix, file.getRootTag());
  }
  if (nsUri == null) return null;

  queue.add(new SchemaTypeInfo(localName, true, nsUri));

  final PairConvertor<String,String,List<Set<SchemaTypeInfo>>> worker =
    SchemaTypeInheritanceIndex.getWorker(project, file.getContainingFile().getVirtualFile());
  while (! queue.isEmpty()) {
    final SchemaTypeInfo info = queue.removeFirst();
    final List<Set<SchemaTypeInfo>> childrenOfType = worker.convert(info.getNamespaceUri(), info.getTagName());
    for (Set<SchemaTypeInfo> infos : childrenOfType) {
      for (SchemaTypeInfo typeInfo : infos) {
        if (typeInfo.isIsTypeName()) {
          queue.add(typeInfo);
        }
        result.add(typeInfo);
      }
    }
  }
  return result;
}
项目:tools-idea    文件:MultipleTraitsListSpeedSearch.java   
public MultipleTraitsListSpeedSearch(JList component, @NotNull List<PairConvertor<Object, String, Boolean>> convertors) {
  super(component, convertors);
}
项目:tools-idea    文件:MultipleTraitsSpeedSearch.java   
public MultipleTraitsSpeedSearch(Comp component, @NotNull List<PairConvertor<Object, String, Boolean>> convertors) {
  super(component);
  myOrderedConvertors = convertors;
}
项目:tools-idea    文件:FileTypeConfigurable.java   
private MySpeedSearch(JList component) {
  super(component, new ArrayList<PairConvertor<Object, String, Boolean>>());
  initConvertors();
}
项目:tools-idea    文件:SchemaTypeInheritanceIndex.java   
public static PairConvertor<String, String, List<Set<SchemaTypeInfo>>> getWorker(final Project project, final VirtualFile currentFile) {
  return new MyWorker(currentFile, project);
}
项目:tools-idea    文件:SchemaDefinitionsSearch.java   
private Collection<SchemaTypeInfo> gatherInheritors(XmlTagImpl xml) {
  XmlAttribute name = getNameAttr(xml);
  if (name == null || StringUtil.isEmptyOrSpaces(name.getValue())) return null;
  String localName = name.getValue();
  final boolean hasPrefix = localName.contains(":");
  localName = hasPrefix ? localName.substring(localName.indexOf(':') + 1) : localName;
  final String nsPrefix = hasPrefix ? name.getValue().substring(0, name.getValue().indexOf(':')) : null;

  final XmlFile file = XmlUtil.getContainingFile(xml);
  if (file == null) return null;
  final Project project = file.getProject();
  if (project == null) return null;

  final Set<SchemaTypeInfo> result = new HashSet<SchemaTypeInfo>();
  final ArrayDeque<SchemaTypeInfo> queue = new ArrayDeque<SchemaTypeInfo>();

  String nsUri;
  if (! hasPrefix) {
    nsUri = getDefaultNs(file);
  } else {
    nsUri = XmlUtil.findNamespaceByPrefix(nsPrefix, file.getRootTag());
  }
  if (nsUri == null) return null;

  queue.add(new SchemaTypeInfo(localName, true, nsUri));

  final PairConvertor<String,String,List<Set<SchemaTypeInfo>>> worker =
    SchemaTypeInheritanceIndex.getWorker(project, file.getContainingFile().getVirtualFile());
  while (! queue.isEmpty()) {
    final SchemaTypeInfo info = queue.removeFirst();
    final List<Set<SchemaTypeInfo>> childrenOfType = worker.convert(info.getNamespaceUri(), info.getTagName());
    for (Set<SchemaTypeInfo> infos : childrenOfType) {
      for (SchemaTypeInfo typeInfo : infos) {
        if (typeInfo.isIsTypeName()) {
          queue.add(typeInfo);
        }
        result.add(typeInfo);
      }
    }
  }
  return result;
}
项目:consulo    文件:MultipleTraitsListSpeedSearch.java   
public MultipleTraitsListSpeedSearch(JList component, @Nonnull List<PairConvertor<Object, String, Boolean>> convertors) {
  super(component, convertors);
}
项目:consulo    文件:MultipleTraitsSpeedSearch.java   
public MultipleTraitsSpeedSearch(Comp component, @Nonnull List<PairConvertor<Object, String, Boolean>> convertors) {
  super(component);
  myOrderedConvertors = convertors;
}
项目:consulo    文件:FileTypeConfigurable.java   
private MySpeedSearch(JList component) {
  super(component, new ArrayList<PairConvertor<Object, String, Boolean>>());
  initConvertors();
}
项目:consulo-xml    文件:SchemaTypeInheritanceIndex.java   
public static PairConvertor<String, String, List<Set<SchemaTypeInfo>>> getWorker(final Project project, final VirtualFile currentFile)
{
    return new MyWorker(currentFile, project);
}
项目:consulo-xml    文件:SchemaDefinitionsSearch.java   
private Collection<SchemaTypeInfo> gatherInheritors(XmlTagImpl xml)
{
    XmlAttribute name = getNameAttr(xml);
    if(name == null || StringUtil.isEmptyOrSpaces(name.getValue()))
    {
        return null;
    }
    String localName = name.getValue();
    final boolean hasPrefix = localName.contains(":");
    localName = hasPrefix ? localName.substring(localName.indexOf(':') + 1) : localName;
    final String nsPrefix = hasPrefix ? name.getValue().substring(0, name.getValue().indexOf(':')) : null;

    final XmlFile file = XmlUtil.getContainingFile(xml);
    if(file == null)
    {
        return null;
    }
    final Project project = file.getProject();
    if(project == null)
    {
        return null;
    }

    final Set<SchemaTypeInfo> result = new HashSet<SchemaTypeInfo>();
    final ArrayDeque<SchemaTypeInfo> queue = new ArrayDeque<SchemaTypeInfo>();

    String nsUri;
    if(!hasPrefix)
    {
        nsUri = getDefaultNs(file);
    }
    else
    {
        nsUri = XmlUtil.findNamespaceByPrefix(nsPrefix, file.getRootTag());
    }
    if(nsUri == null)
    {
        return null;
    }

    queue.add(new SchemaTypeInfo(localName, true, nsUri));

    final PairConvertor<String, String, List<Set<SchemaTypeInfo>>> worker = SchemaTypeInheritanceIndex.getWorker(project, file.getContainingFile().getVirtualFile());
    while(!queue.isEmpty())
    {
        final SchemaTypeInfo info = queue.removeFirst();
        final List<Set<SchemaTypeInfo>> childrenOfType = worker.convert(info.getNamespaceUri(), info.getTagName());
        for(Set<SchemaTypeInfo> infos : childrenOfType)
        {
            for(SchemaTypeInfo typeInfo : infos)
            {
                if(typeInfo.isIsTypeName())
                {
                    queue.add(typeInfo);
                }
                result.add(typeInfo);
            }
        }
    }
    return result;
}