本文整理汇总了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);
}
示例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());
}
示例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);
}
示例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);
}
示例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());
}
示例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;
}
示例7: getOutputRoots
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
@Override
public Collection<File> getOutputRoots(CompileContext context) {
return ContainerUtil.createMaybeSingletonList(getOutputDir());
}
示例8: getAdditionalClasspath
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
@Override
public List<File> getAdditionalClasspath() {
return ContainerUtil.createMaybeSingletonList(findEcjJarFile());
}
示例9: chooseElements
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Override
@NotNull
public List<Library> chooseElements() {
return ContainerUtil.createMaybeSingletonList(createLibrary());
}
示例10: getAllFiles
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Override
@NotNull
public List<PsiFile> getAllFiles() {
return ContainerUtil.createMaybeSingletonList(getPsi(getBaseLanguage()));
}
示例11: getCachedPsiFiles
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public List<PsiFile> getCachedPsiFiles() {
return ContainerUtil.createMaybeSingletonList(getCachedPsi(myBaseLanguage));
}
示例12: fun
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Override
@NotNull
public Collection<? extends PsiElement> fun(final PsiElement element) {
return ContainerUtil.createMaybeSingletonList(element);
}
示例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();
}
示例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));
}
示例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()));
}