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


Java ContainerUtil.createMaybeSingletonList方法代码示例

本文整理汇总了Java中com.intellij.util.containers.ContainerUtil.createMaybeSingletonList方法的典型用法代码示例。如果您正苦于以下问题:Java ContainerUtil.createMaybeSingletonList方法的具体用法?Java ContainerUtil.createMaybeSingletonList怎么用?Java ContainerUtil.createMaybeSingletonList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.util.containers.ContainerUtil的用法示例。


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

示例1: visitCatchSection

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Override
public void visitCatchSection(PsiCatchSection section) {
  startElement(section);
  PsiCodeBlock catchBlock = section.getCatchBlock();
  if (catchBlock != null) {
    CatchDescriptor currentDescriptor = new CatchDescriptor(section.getParameter(), catchBlock);
    DfaVariableValue exceptionHolder = getExceptionHolder(currentDescriptor);

    // exception is in exceptionHolder mock variable
    // check if it's assignable to catch parameter type
    PsiType declaredType = section.getCatchType();
    List<PsiType> flattened = declaredType instanceof PsiDisjunctionType ?
                              ((PsiDisjunctionType)declaredType).getDisjunctions() :
                              ContainerUtil.createMaybeSingletonList(declaredType);
    for (PsiType catchType : flattened) {
      addInstruction(new PushInstruction(exceptionHolder, null));
      addInstruction(new PushInstruction(myFactory.createTypeValue(catchType, Nullness.UNKNOWN), null));
      addInstruction(new BinopInstruction(JavaTokenType.INSTANCEOF_KEYWORD, null, myProject));
      addInstruction(new ConditionalGotoInstruction(ControlFlow.deltaOffset(getStartOffset(catchBlock), -5), false, null));
    }
    
    // not assignable => rethrow 
    rethrowException(currentDescriptor, true);

    // e = $exception$
    addInstruction(new PushInstruction(myFactory.getVarFactory().createVariableValue(section.getParameter(), false), null));
    addInstruction(new PushInstruction(exceptionHolder, null));
    addInstruction(new AssignInstruction(null, null));
    addInstruction(new PopInstruction());
    
    addInstruction(new FlushVariableInstruction(exceptionHolder));
    
    catchBlock.accept(this);
  }
  finishElement(section);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:37,代码来源:ControlFlowAnalyzer.java

示例2: getAllModuleEncodings

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
@Override
public Collection<Charset> getAllModuleEncodings(@NotNull Module module) {
  final Set<Charset> encodings = myModuleFileEncodings.getValue().get(module);
  if (encodings != null) {
    return encodings;
  }
  return ContainerUtil.createMaybeSingletonList(EncodingProjectManager.getInstance(myProject).getDefaultCharset());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:CompilerEncodingServiceImpl.java

示例3: setMapping

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public void setMapping(@Nullable final VirtualFile file, @Nullable T dialect) {
  synchronized (myMappings) {
    if (dialect == null) {
      myMappings.remove(file);
    }
    else {
      myMappings.put(file, dialect);
    }
  }
  List<VirtualFile> files = ContainerUtil.createMaybeSingletonList(file);
  handleMappingChange(files, files, false);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:PerFileMappingsBase.java

示例4: getKnownTreeRoots

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
public List<FileElement> getKnownTreeRoots() {
  PsiFile psiFile = getCachedPsi(myBaseLanguage);
  if (!(psiFile instanceof PsiFileImpl)) return Collections.emptyList();
  FileElement element = ((PsiFileImpl)psiFile).getTreeElement();
  return ContainerUtil.createMaybeSingletonList(element);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:SingleRootFileViewProvider.java

示例5: getStringsToSearch

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Nullable
protected Collection<String> getStringsToSearch(@NotNull final PsiElement element) {
  if (element instanceof PsiNamedElement) {
    return ContainerUtil.createMaybeSingletonList(((PsiNamedElement)element).getName());
  }

  return Collections.singleton(element.getText());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:FindUsagesHandler.java

示例6: getAnnotations

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Override
@NotNull
public final List<Annotation> getAnnotations() {
  if (myAnnotations == null) {
    myAnnotations = ContainerUtil.createMaybeSingletonList(DomElementsHighlightingUtil.createAnnotation(this));
  }
  return myAnnotations;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:DomElementProblemDescriptorImpl.java

示例7: getOutputRoots

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
@Override
public Collection<File> getOutputRoots(CompileContext context) {
  return ContainerUtil.createMaybeSingletonList(getOutputDir());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:ResourcesTarget.java

示例8: getAdditionalClasspath

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
@Override
public List<File> getAdditionalClasspath() {
  return ContainerUtil.createMaybeSingletonList(findEcjJarFile());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:EclipseCompilerTool.java

示例9: chooseElements

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Override
@NotNull
public List<Library> chooseElements() {
  return ContainerUtil.createMaybeSingletonList(createLibrary());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:NewLibraryChooser.java

示例10: getAllFiles

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Override
@NotNull
public List<PsiFile> getAllFiles() {
  return ContainerUtil.createMaybeSingletonList(getPsi(getBaseLanguage()));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:SingleRootFileViewProvider.java

示例11: getCachedPsiFiles

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public List<PsiFile> getCachedPsiFiles() {
  return ContainerUtil.createMaybeSingletonList(getCachedPsi(myBaseLanguage));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:SingleRootFileViewProvider.java

示例12: fun

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Override
@NotNull
public Collection<? extends PsiElement> fun(final PsiElement element) {
  return ContainerUtil.createMaybeSingletonList(element);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:NavigationGutterIconBuilder.java

示例13: checkRequired

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Override
@NotNull
public List<DomElementProblemDescriptor> checkRequired(final DomElement element, final DomElementAnnotationHolder holder) {
  final Required required = element.getAnnotation(Required.class);
  if (required != null) {
    final XmlElement xmlElement = element.getXmlElement();
    if (xmlElement == null) {
      if (required.value()) {
        final String xmlElementName = element.getXmlElementName();
        String namespace = element.getXmlElementNamespace();
        if (element instanceof GenericAttributeValue) {
          return Collections.singletonList(holder.createProblem(element, IdeBundle.message("attribute.0.should.be.defined", xmlElementName),
                                                            new DefineAttributeQuickFix(xmlElementName, namespace)));
        }
        return Collections.singletonList(
          holder.createProblem(
            element,
            HighlightSeverity.ERROR,
            IdeBundle.message("child.tag.0.should.be.defined", xmlElementName),
            new AddRequiredSubtagFix(xmlElementName, namespace)
          )
        );
      }
    }
    else if (element instanceof GenericDomValue) {
      return ContainerUtil.createMaybeSingletonList(checkRequiredGenericValue((GenericDomValue)element, required, holder));
    }
  }
  if (DomUtil.hasXml(element)) {
    final SmartList<DomElementProblemDescriptor> list = new SmartList<DomElementProblemDescriptor>();
    final DomGenericInfo info = element.getGenericInfo();
    for (final AbstractDomChildrenDescription description : info.getChildrenDescriptions()) {
      if (description instanceof DomCollectionChildDescription && description.getValues(element).isEmpty()) {
        final DomCollectionChildDescription childDescription = (DomCollectionChildDescription)description;
        final Required annotation = description.getAnnotation(Required.class);
        if (annotation != null && annotation.value()) {
          list.add(holder.createProblem(element, childDescription, IdeBundle.message("child.tag.0.should.be.defined", ((DomCollectionChildDescription)description).getXmlElementName())));
        }
      }
    }
    return list;
  }
  return Collections.emptyList();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:45,代码来源:DomHighlightingHelperImpl.java

示例14: createProblemDescriptors

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Override
public List<ProblemDescriptor> createProblemDescriptors(final InspectionManager manager, DomElementProblemDescriptor problemDescriptor) {
  return ContainerUtil.createMaybeSingletonList(DomElementsHighlightingUtil.createProblemDescriptors(manager, problemDescriptor));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:DomElementAnnotationsManagerImpl.java

示例15: getUrls

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
public Collection<Url> getUrls(@NotNull OpenInBrowserRequest request) throws BrowserException {
  return ContainerUtil.createMaybeSingletonList(getUrl(request, request.getVirtualFile()));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:WebBrowserUrlProvider.java


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