mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-27 16:57:49 +08:00
[code samples] remove explicit type
This commit is contained in:
parent
089a0a7e46
commit
29ff4cd931
@ -19,7 +19,7 @@ import javax.swing.*;
|
||||
public class DemoFacetType extends FacetType<DemoFacet, DemoFacetConfiguration> {
|
||||
public static final String FACET_ID = "DEMO_FACET_ID";
|
||||
public static final String FACET_NAME = "SDK Facet";
|
||||
public static final FacetTypeId<DemoFacet> DEMO_FACET_TYPE_ID = new FacetTypeId<DemoFacet>(FACET_ID);
|
||||
public static final FacetTypeId<DemoFacet> DEMO_FACET_TYPE_ID = new FacetTypeId<>(FACET_ID);
|
||||
|
||||
public DemoFacetType() {
|
||||
super(DEMO_FACET_TYPE_ID, FACET_ID, FACET_NAME);
|
||||
|
@ -76,14 +76,14 @@ public class ImagesProjectNode extends AbstractTreeNode<VirtualFile> {
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<? extends AbstractTreeNode> getChildren() {
|
||||
final List<VirtualFile> files = new ArrayList<VirtualFile>(0);
|
||||
final List<VirtualFile> files = new ArrayList<>(0);
|
||||
for (VirtualFile file : getValue().getChildren()) {
|
||||
if (getImagesFiles(myProject).contains(file)) {
|
||||
files.add(file);
|
||||
}
|
||||
}
|
||||
if (files.isEmpty()) return Collections.emptyList();
|
||||
final List<AbstractTreeNode> nodes = new ArrayList<AbstractTreeNode>(files.size());
|
||||
final List<AbstractTreeNode> nodes = new ArrayList<>(files.size());
|
||||
final boolean alwaysOnTop = ProjectView.getInstance(myProject).isFoldersAlwaysOnTop("");
|
||||
Collections.sort(files, (o1, o2) -> {
|
||||
if (alwaysOnTop) {
|
||||
|
@ -23,7 +23,7 @@ public class SimpleBlock extends AbstractBlock {
|
||||
|
||||
@Override
|
||||
protected List<Block> buildChildren() {
|
||||
List<Block> blocks = new ArrayList<Block>();
|
||||
List<Block> blocks = new ArrayList<>();
|
||||
ASTNode child = myNode.getFirstChildNode();
|
||||
while (child != null) {
|
||||
if (child.getElementType() != TokenType.WHITE_SPACE) {
|
||||
|
@ -14,7 +14,7 @@ public class SimpleChooseByNameContributor implements ChooseByNameContributor {
|
||||
@Override
|
||||
public String[] getNames(Project project, boolean includeNonProjectItems) {
|
||||
List<SimpleProperty> properties = SimpleUtil.findProperties(project);
|
||||
List<String> names = new ArrayList<String>(properties.size());
|
||||
List<String> names = new ArrayList<>(properties.size());
|
||||
for (SimpleProperty property : properties) {
|
||||
if (property.getKey() != null && property.getKey().length() > 0) {
|
||||
names.add(property.getKey());
|
||||
|
@ -21,7 +21,7 @@ public class SimpleFoldingBuilder extends FoldingBuilderEx implements DumbAware
|
||||
// Initialize the group of folding regions that will expand/collapse together.
|
||||
FoldingGroup group = FoldingGroup.newGroup(SimpleAnnotator.SIMPLE_PREFIX_STR);
|
||||
// Initialize the list of folding regions
|
||||
List< FoldingDescriptor > descriptors = new ArrayList< FoldingDescriptor >();
|
||||
List< FoldingDescriptor > descriptors = new ArrayList<>();
|
||||
// Get a collection of the literal expressions in the document below root
|
||||
Collection< PsiLiteralExpression > literalExpressions =
|
||||
PsiTreeUtil.findChildrenOfType(root, PsiLiteralExpression.class);
|
||||
|
@ -24,7 +24,7 @@ public class SimpleReference extends PsiReferenceBase<PsiElement> implements Psi
|
||||
public ResolveResult[] multiResolve(boolean incompleteCode) {
|
||||
Project project = myElement.getProject();
|
||||
final List<SimpleProperty> properties = SimpleUtil.findProperties(project, key);
|
||||
List<ResolveResult> results = new ArrayList<ResolveResult>();
|
||||
List<ResolveResult> results = new ArrayList<>();
|
||||
for (SimpleProperty property : properties) {
|
||||
results.add(new PsiElementResolveResult(property));
|
||||
}
|
||||
@ -43,7 +43,7 @@ public class SimpleReference extends PsiReferenceBase<PsiElement> implements Psi
|
||||
public Object[] getVariants() {
|
||||
Project project = myElement.getProject();
|
||||
List<SimpleProperty> properties = SimpleUtil.findProperties(project);
|
||||
List<LookupElement> variants = new ArrayList<LookupElement>();
|
||||
List<LookupElement> variants = new ArrayList<>();
|
||||
for (final SimpleProperty property : properties) {
|
||||
if (property.getKey() != null && property.getKey().length() > 0) {
|
||||
variants.add(LookupElementBuilder
|
||||
|
@ -63,7 +63,7 @@ public class SimpleStructureViewElement implements StructureViewTreeElement, Sor
|
||||
public TreeElement[] getChildren() {
|
||||
if (myElement instanceof SimpleFile) {
|
||||
List<SimpleProperty> properties = PsiTreeUtil.getChildrenOfTypeAsList(myElement, SimpleProperty.class);
|
||||
List<TreeElement> treeElements = new ArrayList<TreeElement>(properties.size());
|
||||
List<TreeElement> treeElements = new ArrayList<>(properties.size());
|
||||
for (SimpleProperty property : properties) {
|
||||
treeElements.add(new SimpleStructureViewElement((SimplePropertyImpl) property));
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ public class SimpleUtil {
|
||||
}
|
||||
|
||||
public static List<SimpleProperty> findProperties(Project project) {
|
||||
List<SimpleProperty> result = new ArrayList<SimpleProperty>();
|
||||
List<SimpleProperty> result = new ArrayList<>();
|
||||
Collection<VirtualFile> virtualFiles =
|
||||
FileTypeIndex.getFiles(SimpleFileType.INSTANCE, GlobalSearchScope.allScope(project));
|
||||
for (VirtualFile virtualFile : virtualFiles) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user