本文整理汇总了Java中com.intellij.util.SmartList.add方法的典型用法代码示例。如果您正苦于以下问题:Java SmartList.add方法的具体用法?Java SmartList.add怎么用?Java SmartList.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.SmartList
的用法示例。
在下文中一共展示了SmartList.add方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseParentRevisions
import com.intellij.util.SmartList; //导入方法依赖的package包/类
@NotNull
protected static SmartList<HgRevisionNumber> parseParentRevisions(@NotNull String parentsString, @NotNull String currentRevisionString) {
SmartList<HgRevisionNumber> parents = new SmartList<HgRevisionNumber>();
if (StringUtil.isEmptyOrSpaces(parentsString)) {
// parents shouldn't be empty only if not supported
Long revision = Long.valueOf(currentRevisionString);
HgRevisionNumber parentRevision = HgRevisionNumber.getLocalInstance(String.valueOf(revision - 1));
parents.add(parentRevision);
return parents;
}
//hg returns parents in the format 'rev:node rev:node ' (note the trailing space)
List<String> parentStrings = StringUtil.split(parentsString.trim(), " ");
for (String parentString : parentStrings) {
List<String> parentParts = StringUtil.split(parentString, ":");
//if revision has only 1 parent and "--debug" argument were added or if appropriate parent template were used,
// its second parent has revision number -1
if (Integer.valueOf(parentParts.get(0)) >= 0) {
parents.add(HgRevisionNumber.getInstance(parentParts.get(0), parentParts.get(1)));
}
}
return parents;
}
示例2: makeQualifiedModuleInterfaceNames
import com.intellij.util.SmartList; //导入方法依赖的package包/类
private static String[] makeQualifiedModuleInterfaceNames(XmlTag component, String fqn) {
final XmlTag[] children = component.findSubTags("option");
for (XmlTag child : children) {
if ("type".equals(child.getAttributeValue("name"))) {
final String value = child.getAttributeValue("value");
final SmartList<String> names = new SmartList<String>();
if (value != null) {
final String[] moduleTypes = value.split(";");
for (String moduleType : moduleTypes) {
names.add(fqn + "#" + moduleType);
}
}
return ArrayUtil.toStringArray(names);
}
}
return new String[]{ fqn };
}
示例3: getTypeUseAnnotations
import com.intellij.util.SmartList; //导入方法依赖的package包/类
@Nullable
public static List<PsiAnnotation> getTypeUseAnnotations(@NotNull PsiModifierList modifierList) {
SmartList<PsiAnnotation> result = null;
for (PsiAnnotation annotation : modifierList.getAnnotations()) {
if (isTypeAnnotation(annotation)) {
if (result == null) result = new SmartList<PsiAnnotation>();
result.add(annotation);
}
}
return result;
}
示例4: getSourceFolders
import com.intellij.util.SmartList; //导入方法依赖的package包/类
@NotNull
@Override
public List<SourceFolder> getSourceFolders(@NotNull Set<? extends JpsModuleSourceRootType<?>> rootTypes) {
SmartList<SourceFolder> folders = new SmartList<SourceFolder>();
for (SourceFolder folder : mySourceFolders) {
if (rootTypes.contains(folder.getRootType())) {
folders.add(folder);
}
}
return folders;
}
示例5: prepareRefsToIndicesMap
import com.intellij.util.SmartList; //导入方法依赖的package包/类
@NotNull
private TIntObjectHashMap<SmartList<VcsRef>> prepareRefsToIndicesMap(@NotNull Collection<VcsRef> refs) {
TIntObjectHashMap<SmartList<VcsRef>> map = new TIntObjectHashMap<SmartList<VcsRef>>();
for (VcsRef ref : refs) {
int index = myHashMap.getCommitIndex(ref.getCommitHash());
SmartList<VcsRef> list = map.get(index);
if (list == null) map.put(index, list = new SmartList<VcsRef>());
list.add(ref);
}
return map;
}
示例6: load
import com.intellij.util.SmartList; //导入方法依赖的package包/类
@NotNull
private static Collection<InternalExternalProjectInfo> load(@NotNull Project project) throws IOException {
SmartList<InternalExternalProjectInfo> projects = new SmartList<InternalExternalProjectInfo>();
@SuppressWarnings("unchecked") final File configurationFile = getProjectConfigurationFile(project);
if (!configurationFile.isFile()) return projects;
DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(configurationFile)));
try {
final String storage_version = in.readUTF();
if (!STORAGE_VERSION.equals(storage_version)) return projects;
final int size = in.readInt();
ObjectInputStream os = new ObjectInputStream(in);
try {
for (int i = 0; i < size; i++) {
//noinspection unchecked
InternalExternalProjectInfo projectDataDataNode = (InternalExternalProjectInfo)os.readObject();
projects.add(projectDataDataNode);
}
}
catch (ClassNotFoundException e) {
IOException ioException = new IOException();
ioException.initCause(e);
throw ioException;
}
finally {
os.close();
}
}
finally {
in.close();
}
return projects;
}
示例7: getTopBottomComponents
import com.intellij.util.SmartList; //导入方法依赖的package包/类
@NotNull
private List<JComponent> getTopBottomComponents(@NotNull FileEditor editor, boolean top) {
SmartList<JComponent> result = new SmartList<JComponent>();
JComponent container = top ? myTopComponents.get(editor) : myBottomComponents.get(editor);
for (Component each : container.getComponents()) {
if (each instanceof TopBottomComponentWrapper) {
result.add(((TopBottomComponentWrapper)each).getWrappee());
}
}
return Collections.unmodifiableList(result);
}
示例8: computeKinds
import com.intellij.util.SmartList; //导入方法依赖的package包/类
private static List<Pair<LibraryKind, LibraryProperties>> computeKinds(List<VirtualFile> files) {
final SmartList<Pair<LibraryKind, LibraryProperties>> result = new SmartList<Pair<LibraryKind, LibraryProperties>>();
final LibraryType<?>[] libraryTypes = LibraryType.EP_NAME.getExtensions();
final LibraryPresentationProvider[] presentationProviders = LibraryPresentationProvider.EP_NAME.getExtensions();
for (LibraryPresentationProvider provider : ContainerUtil.concat(libraryTypes, presentationProviders)) {
final LibraryProperties properties = provider.detect(files);
if (properties != null) {
result.add(Pair.create(provider.getKind(), properties));
}
}
return result;
}
示例9: resolveAndDownloadImpl
import com.intellij.util.SmartList; //导入方法依赖的package包/类
public static List<OrderRoot> resolveAndDownloadImpl(final Project project,
final String coord,
boolean attachJavaDoc,
boolean attachSources,
@Nullable final String copyTo,
List<MavenRepositoryInfo> repositories,
ProgressIndicator indicator) {
final SmartList<MavenExtraArtifactType> extraTypes = new SmartList<MavenExtraArtifactType>();
if (attachSources) extraTypes.add(MavenExtraArtifactType.SOURCES);
if (attachJavaDoc) extraTypes.add(MavenExtraArtifactType.DOCS);
final Ref<List<OrderRoot>> result = Ref.create(null);
doResolveInner(project, getMavenId(coord), extraTypes, repositories, new Processor<List<MavenArtifact>>() {
public boolean process(final List<MavenArtifact> artifacts) {
if (!artifacts.isEmpty()) {
AccessToken accessToken = WriteAction.start();
try {
final List<OrderRoot> roots = createRoots(artifacts, copyTo);
result.set(roots);
}
finally {
accessToken.finish();
}
}
return true;
}
}, indicator);
return result.get();
}
示例10: checkExtendClass
import com.intellij.util.SmartList; //导入方法依赖的package包/类
@NotNull
public static List<DomElementProblemDescriptor> checkExtendClass(final GenericDomValue element, final PsiClass value, final String name,
final boolean instantiatable, final boolean canBeDecorator, final boolean allowInterface,
final boolean allowNonPublic,
final boolean allowAbstract,
final boolean allowEnum,
final DomElementAnnotationHolder holder) {
final Project project = element.getManager().getProject();
PsiClass extendClass = JavaPsiFacade.getInstance(project).findClass(name, GlobalSearchScope.allScope(project));
final SmartList<DomElementProblemDescriptor> list = new SmartList<DomElementProblemDescriptor>();
if (extendClass != null) {
if (!name.equals(value.getQualifiedName()) && !value.isInheritor(extendClass, true)) {
String message = DomBundle.message("class.is.not.a.subclass", value.getQualifiedName(), extendClass.getQualifiedName());
list.add(holder.createProblem(element, message));
}
}
if (instantiatable) {
if (value.hasModifierProperty(PsiModifier.ABSTRACT)) {
list.add(holder.createProblem(element, DomBundle.message("class.is.not.concrete", value.getQualifiedName())));
}
else if (!allowNonPublic && !value.hasModifierProperty(PsiModifier.PUBLIC)) {
list.add(holder.createProblem(element, DomBundle.message("class.is.not.public", value.getQualifiedName())));
}
else if (!PsiUtil.hasDefaultConstructor(value, true)) {
if (canBeDecorator) {
boolean hasConstructor = false;
for (PsiMethod method : value.getConstructors()) {
final PsiParameterList psiParameterList = method.getParameterList();
if (psiParameterList.getParametersCount() != 1) continue;
PsiTypeElement typeElement = psiParameterList.getParameters()[0].getTypeElement();
if (typeElement != null) {
final PsiType psiType = typeElement.getType();
if (psiType instanceof PsiClassType) {
final PsiClass psiClass = ((PsiClassType)psiType).resolve();
if (psiClass != null && InheritanceUtil.isInheritorOrSelf(psiClass, extendClass, true)) {
hasConstructor = true;
break;
}
}
}
}
if (!hasConstructor) {
list.add(holder.createProblem(element, DomBundle.message("class.decorator.or.has.default.constructor", value.getQualifiedName())));
}
}
else {
list.add(holder.createProblem(element, DomBundle.message("class.has.no.default.constructor", value.getQualifiedName())));
}
}
}
if (!allowInterface && value.isInterface()) {
list.add(holder.createProblem(element, DomBundle.message("interface.not.allowed", value.getQualifiedName())));
}
if (!allowEnum && value.isEnum()) {
list.add(holder.createProblem(element, DomBundle.message("enum.not.allowed", value.getQualifiedName())));
}
if (!allowAbstract && value.hasModifierProperty(PsiModifier.ABSTRACT) && !value.isInterface()) {
list.add(holder.createProblem(element, DomBundle.message("abstract.class.not.allowed", value.getQualifiedName())));
}
return list;
}
示例11: checkRequired
import com.intellij.util.SmartList; //导入方法依赖的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();
}