mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup
GitOrigin-RevId: 3dec1b2a5d050ba5284f49a3a6ee31e887de154f
This commit is contained in:
committed by
intellij-monorepo-bot
parent
24c0477d33
commit
ae1f8d58f9
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.psi.impl.light;
|
||||
|
||||
import com.intellij.lang.Language;
|
||||
@@ -20,10 +6,7 @@ import com.intellij.psi.*;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author peter
|
||||
*/
|
||||
public class LightParameter extends LightVariableBuilder<LightVariableBuilder> implements PsiParameter {
|
||||
public class LightParameter extends LightVariableBuilder<LightVariableBuilder<?>> implements PsiParameter {
|
||||
private final PsiElement myDeclarationScope;
|
||||
private final boolean myVarArgs;
|
||||
|
||||
@@ -46,9 +29,8 @@ public class LightParameter extends LightVariableBuilder<LightVariableBuilder> i
|
||||
myVarArgs = isVarArgs;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public PsiElement getDeclarationScope() {
|
||||
public @NotNull PsiElement getDeclarationScope() {
|
||||
return myDeclarationScope;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.psi.impl.source;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
@@ -27,9 +13,6 @@ import com.intellij.reference.SoftReference;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author ven
|
||||
*/
|
||||
public class PsiAnnotationMethodImpl extends PsiMethodImpl implements PsiAnnotationMethod {
|
||||
private SoftReference<PsiAnnotationMemberValue> myCachedDefaultValue;
|
||||
|
||||
|
||||
+7
-23
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.ide.structureView.impl.java;
|
||||
|
||||
import com.intellij.ide.structureView.StructureViewModel;
|
||||
@@ -25,13 +11,13 @@ import com.intellij.ui.PlaceHolder;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public class JavaFileTreeModel extends TextEditorBasedStructureViewModel implements StructureViewModel.ElementInfoProvider, PlaceHolder {
|
||||
private static final Collection<NodeProvider> NODE_PROVIDERS = Arrays.asList(new JavaInheritedMembersNodeProvider(),
|
||||
new JavaAnonymousClassesNodeProvider(),
|
||||
new JavaLambdaNodeProvider());
|
||||
private static final Collection<NodeProvider<?>> NODE_PROVIDERS = List.of(new JavaInheritedMembersNodeProvider(),
|
||||
new JavaAnonymousClassesNodeProvider(),
|
||||
new JavaLambdaNodeProvider());
|
||||
private String myPlace;
|
||||
|
||||
public JavaFileTreeModel(@NotNull PsiClassOwner file, @Nullable Editor editor) {
|
||||
@@ -43,9 +29,8 @@ public class JavaFileTreeModel extends TextEditorBasedStructureViewModel impleme
|
||||
return new Filter[]{new FieldsFilter(), new PublicElementsFilter()};
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<NodeProvider> getNodeProviders() {
|
||||
public @NotNull Collection<NodeProvider<?>> getNodeProviders() {
|
||||
return NODE_PROVIDERS;
|
||||
}
|
||||
|
||||
@@ -55,8 +40,7 @@ public class JavaFileTreeModel extends TextEditorBasedStructureViewModel impleme
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public StructureViewTreeElement getRoot() {
|
||||
public @NotNull StructureViewTreeElement getRoot() {
|
||||
return new JavaFileTreeElement(getPsiFile());
|
||||
}
|
||||
|
||||
|
||||
+9
-9
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.ide.structureView;
|
||||
|
||||
import com.intellij.ide.util.treeView.smartTree.*;
|
||||
@@ -124,8 +124,7 @@ public abstract class TextEditorBasedStructureViewModel implements StructureView
|
||||
return o1;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected Object findAcceptableElement(PsiElement element) {
|
||||
protected @Nullable Object findAcceptableElement(PsiElement element) {
|
||||
while (element != null && !(element instanceof PsiFile)) {
|
||||
if (isSuitable(element)) return element;
|
||||
element = element.getParent();
|
||||
@@ -138,9 +137,11 @@ public abstract class TextEditorBasedStructureViewModel implements StructureView
|
||||
}
|
||||
|
||||
protected boolean isSuitable(final PsiElement element) {
|
||||
if (element == null) return false;
|
||||
final Class[] suitableClasses = getSuitableClasses();
|
||||
for (Class suitableClass : suitableClasses) {
|
||||
if (element == null) {
|
||||
return false;
|
||||
}
|
||||
Class<?>[] suitableClasses = getSuitableClasses();
|
||||
for (Class<?> suitableClass : suitableClasses) {
|
||||
if (ReflectionUtil.isAssignable(suitableClass, element.getClass())) return true;
|
||||
}
|
||||
return false;
|
||||
@@ -163,7 +164,7 @@ public abstract class TextEditorBasedStructureViewModel implements StructureView
|
||||
*
|
||||
* @return the array of classes
|
||||
*/
|
||||
protected Class @NotNull [] getSuitableClasses() {
|
||||
protected Class<?> @NotNull [] getSuitableClasses() {
|
||||
return ArrayUtil.EMPTY_CLASS_ARRAY;
|
||||
}
|
||||
|
||||
@@ -186,9 +187,8 @@ public abstract class TextEditorBasedStructureViewModel implements StructureView
|
||||
return Filter.EMPTY_ARRAY;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<NodeProvider> getNodeProviders() {
|
||||
public @NotNull Collection<NodeProvider<?>> getNodeProviders() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
||||
+4
-18
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.ide.util.treeView.smartTree;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -23,7 +9,7 @@ import java.util.Collection;
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public interface ProvidingTreeModel extends TreeModel {
|
||||
@NotNull
|
||||
Collection<NodeProvider> getNodeProviders();
|
||||
boolean isEnabled(@NotNull NodeProvider provider);
|
||||
@NotNull Collection<NodeProvider<?>> getNodeProviders();
|
||||
|
||||
boolean isEnabled(@NotNull NodeProvider<?> provider);
|
||||
}
|
||||
|
||||
+11
-13
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
package com.intellij.ide.structureView.newStructureView;
|
||||
|
||||
@@ -15,7 +15,7 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class TreeModelWrapper implements StructureViewModel, ProvidingTreeModel {
|
||||
public final class TreeModelWrapper implements StructureViewModel, ProvidingTreeModel {
|
||||
private final StructureViewModel myModel;
|
||||
private final TreeActionsOwner myStructureView;
|
||||
|
||||
@@ -25,8 +25,7 @@ public class TreeModelWrapper implements StructureViewModel, ProvidingTreeModel
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public StructureViewTreeElement getRoot() {
|
||||
public @NotNull StructureViewTreeElement getRoot() {
|
||||
return myModel.getRoot();
|
||||
}
|
||||
|
||||
@@ -36,8 +35,7 @@ public class TreeModelWrapper implements StructureViewModel, ProvidingTreeModel
|
||||
return filtered.toArray(Grouper.EMPTY_ARRAY);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private <T extends TreeAction> List<T> filterActive(T @NotNull [] actions) {
|
||||
private @NotNull <T extends TreeAction> List<T> filterActive(T @NotNull [] actions) {
|
||||
List<T> filtered = new ArrayList<>();
|
||||
for (T action : actions) {
|
||||
if (isFiltered(action)) filtered.add(action);
|
||||
@@ -45,11 +43,12 @@ public class TreeModelWrapper implements StructureViewModel, ProvidingTreeModel
|
||||
return filtered;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private List<NodeProvider> filterProviders(@NotNull Collection<? extends NodeProvider> actions) {
|
||||
List<NodeProvider> filtered = new ArrayList<>();
|
||||
for (NodeProvider action : actions) {
|
||||
if (isFiltered(action)) filtered.add(action);
|
||||
private @NotNull List<NodeProvider<?>> filterProviders(@NotNull Collection<? extends NodeProvider<?>> actions) {
|
||||
List<NodeProvider<?>> filtered = new ArrayList<>();
|
||||
for (NodeProvider<?> action : actions) {
|
||||
if (isFiltered(action)) {
|
||||
filtered.add(action);
|
||||
}
|
||||
}
|
||||
return filtered;
|
||||
}
|
||||
@@ -75,9 +74,8 @@ public class TreeModelWrapper implements StructureViewModel, ProvidingTreeModel
|
||||
return myModel.getCurrentEditorElement();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<NodeProvider> getNodeProviders() {
|
||||
public @NotNull Collection<NodeProvider<?>> getNodeProviders() {
|
||||
if (myModel instanceof ProvidingTreeModel) {
|
||||
return filterProviders(((ProvidingTreeModel)myModel).getNodeProviders());
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.ide.util;
|
||||
|
||||
import com.intellij.ide.structureView.StructureViewModel;
|
||||
@@ -25,7 +25,7 @@ import java.util.Set;
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public class StructureViewCompositeModel extends StructureViewModelBase
|
||||
public final class StructureViewCompositeModel extends StructureViewModelBase
|
||||
implements Disposable,
|
||||
StructureViewModel.ElementInfoProvider,
|
||||
StructureViewModel.ExpandInfoProvider {
|
||||
@@ -38,8 +38,7 @@ public class StructureViewCompositeModel extends StructureViewModelBase
|
||||
myViews = views;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private JBIterable<StructureViewModel> getModels() {
|
||||
private @NotNull JBIterable<StructureViewModel> getModels() {
|
||||
return JBIterable.from(myViews).map(o -> o.structureModel);
|
||||
}
|
||||
|
||||
@@ -48,9 +47,8 @@ public class StructureViewCompositeModel extends StructureViewModelBase
|
||||
return getModels().filterMap(o -> o.getCurrentEditorElement()).first();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static StructureViewTreeElement createRootNode(@NotNull PsiFile file,
|
||||
@NotNull List<? extends StructureViewComposite.StructureViewDescriptor> views) {
|
||||
private static @NotNull StructureViewTreeElement createRootNode(@NotNull PsiFile file,
|
||||
@NotNull List<? extends StructureViewComposite.StructureViewDescriptor> views) {
|
||||
JBIterable<TreeElement> children = JBIterable.from(views).map(o -> createTreeElementFromView(file, o));
|
||||
return new StructureViewTreeElement() {
|
||||
@Override
|
||||
@@ -73,9 +71,8 @@ public class StructureViewCompositeModel extends StructureViewModelBase
|
||||
return file.canNavigateToSource();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ItemPresentation getPresentation() {
|
||||
public @NotNull ItemPresentation getPresentation() {
|
||||
return file.getPresentation();
|
||||
}
|
||||
|
||||
@@ -87,9 +84,8 @@ public class StructureViewCompositeModel extends StructureViewModelBase
|
||||
};
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<NodeProvider> getNodeProviders() {
|
||||
public @NotNull Collection<NodeProvider<?>> getNodeProviders() {
|
||||
return getModels().filter(ProvidingTreeModel.class).flatMap(ProvidingTreeModel::getNodeProviders).toSet();
|
||||
}
|
||||
|
||||
@@ -134,8 +130,7 @@ public class StructureViewCompositeModel extends StructureViewModelBase
|
||||
return result;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static TreeElement createTreeElementFromView(final PsiFile file, final StructureViewComposite.StructureViewDescriptor view) {
|
||||
private static @NotNull TreeElement createTreeElementFromView(final PsiFile file, final StructureViewComposite.StructureViewDescriptor view) {
|
||||
return new StructureViewTreeElement() {
|
||||
@Override
|
||||
public Object getValue() {
|
||||
@@ -157,19 +152,16 @@ public class StructureViewCompositeModel extends StructureViewModelBase
|
||||
return file.canNavigateToSource();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ItemPresentation getPresentation() {
|
||||
public @NotNull ItemPresentation getPresentation() {
|
||||
return new ItemPresentation() {
|
||||
@Nullable
|
||||
@Override
|
||||
public String getPresentableText() {
|
||||
public @Nullable String getPresentableText() {
|
||||
return view.title;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Icon getIcon(boolean unused) {
|
||||
public @Nullable Icon getIcon(boolean unused) {
|
||||
return view.icon;
|
||||
}
|
||||
};
|
||||
|
||||
+5
-20
@@ -1,19 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.ide.util.treeView.smartTree;
|
||||
|
||||
import com.intellij.ide.projectView.PresentationData;
|
||||
@@ -55,11 +40,11 @@ public class TreeElementWrapper extends CachingChildrenTreeNode<TreeElement> {
|
||||
addSubElement(createChildNode(child));
|
||||
}
|
||||
if (myTreeModel instanceof ProvidingTreeModel) {
|
||||
Collection<NodeProvider> originalProviders = ((ProvidingTreeModel)myTreeModel).getNodeProviders();
|
||||
Collection<NodeProvider> providers = DumbService.getInstance(myProject).filterByDumbAwareness(originalProviders);
|
||||
for (NodeProvider provider : providers) {
|
||||
Collection<NodeProvider<?>> originalProviders = ((ProvidingTreeModel)myTreeModel).getNodeProviders();
|
||||
Collection<NodeProvider<?>> providers = DumbService.getInstance(myProject).filterByDumbAwareness(originalProviders);
|
||||
for (NodeProvider<?> provider : providers) {
|
||||
if (((ProvidingTreeModel)myTreeModel).isEnabled(provider)) {
|
||||
Collection<TreeElement> nodes = provider.provideNodes(value);
|
||||
Collection<TreeElement> nodes = (Collection<TreeElement>)provider.provideNodes(value);
|
||||
for (TreeElement node : nodes) {
|
||||
if (node == null) {
|
||||
LOG.error(provider + " returned null node: " + nodes);
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.plugins.groovy.ext.newify
|
||||
|
||||
import com.intellij.openapi.util.NlsSafe
|
||||
@@ -40,7 +40,7 @@ interface GrNewifyAttributes {
|
||||
}
|
||||
}
|
||||
|
||||
class NewifyMemberContributor : NonCodeMembersContributor() {
|
||||
internal class NewifyMemberContributor : NonCodeMembersContributor() {
|
||||
override fun processDynamicElements(qualifierType: PsiType,
|
||||
aClass: PsiClass?,
|
||||
processor: PsiScopeProcessor,
|
||||
|
||||
+4
-6
@@ -19,8 +19,8 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class KotlinFirStructureViewFactory implements PsiStructureViewFactory {
|
||||
private static final List<NodeProvider> NODE_PROVIDERS =
|
||||
final class KotlinFirStructureViewFactory implements PsiStructureViewFactory {
|
||||
private static final List<NodeProvider<?>> NODE_PROVIDERS =
|
||||
Collections.singletonList(new KotlinFirInheritedMembersNodeProvider());
|
||||
@Override
|
||||
public StructureViewBuilder getStructureViewBuilder(@NotNull PsiFile psiFile) {
|
||||
@@ -30,13 +30,11 @@ public class KotlinFirStructureViewFactory implements PsiStructureViewFactory {
|
||||
|
||||
KtFile file = (KtFile) psiFile;
|
||||
return new TreeBasedStructureViewBuilder() {
|
||||
@NotNull
|
||||
@Override
|
||||
public StructureViewModel createStructureViewModel(@Nullable Editor editor) {
|
||||
public @NotNull StructureViewModel createStructureViewModel(@Nullable Editor editor) {
|
||||
return new KotlinStructureViewModel(file, editor, new KotlinFirStructureViewElement(file, file, false)) {
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<NodeProvider> getNodeProviders() {
|
||||
public @NotNull Collection<NodeProvider<?>> getNodeProviders() {
|
||||
return NODE_PROVIDERS;
|
||||
}
|
||||
};
|
||||
|
||||
+4
-6
@@ -18,9 +18,8 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class KotlinStructureViewFactory implements PsiStructureViewFactory {
|
||||
private static final List<NodeProvider> NODE_PROVIDERS =
|
||||
Collections.singletonList(new KotlinInheritedMembersNodeProvider());
|
||||
public final class KotlinStructureViewFactory implements PsiStructureViewFactory {
|
||||
private static final List<NodeProvider<?>> NODE_PROVIDERS = Collections.singletonList(new KotlinInheritedMembersNodeProvider());
|
||||
@Override
|
||||
public StructureViewBuilder getStructureViewBuilder(@NotNull PsiFile psiFile) {
|
||||
if (!(psiFile instanceof KtFile)) {
|
||||
@@ -29,12 +28,11 @@ public class KotlinStructureViewFactory implements PsiStructureViewFactory {
|
||||
|
||||
KtFile file = (KtFile) psiFile;
|
||||
return new TreeBasedStructureViewBuilder() {
|
||||
@NotNull
|
||||
@Override
|
||||
public StructureViewModel createStructureViewModel(@Nullable Editor editor) {
|
||||
public @NotNull StructureViewModel createStructureViewModel(@Nullable Editor editor) {
|
||||
return new KotlinStructureViewModel(file, editor, new KotlinStructureViewElement(file, false)) {
|
||||
@Override
|
||||
public Collection<NodeProvider> getNodeProviders() {
|
||||
public @NotNull Collection<NodeProvider<?>> getNodeProviders() {
|
||||
return NODE_PROVIDERS;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.yaml.structureView;
|
||||
|
||||
import com.intellij.icons.AllIcons;
|
||||
@@ -21,7 +21,7 @@ import javax.swing.*;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
public class YAMLStructureViewFactory implements PsiStructureViewFactory {
|
||||
public final class YAMLStructureViewFactory implements PsiStructureViewFactory {
|
||||
static final Icon ALIAS_ICON = AllIcons.Nodes.Alias;
|
||||
|
||||
public YAMLStructureViewFactory() {
|
||||
@@ -31,8 +31,7 @@ public class YAMLStructureViewFactory implements PsiStructureViewFactory {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public StructureViewBuilder getStructureViewBuilder(@NotNull final PsiFile psiFile) {
|
||||
public @Nullable StructureViewBuilder getStructureViewBuilder(final @NotNull PsiFile psiFile) {
|
||||
if (!(psiFile instanceof YAMLFile)) {
|
||||
return null;
|
||||
}
|
||||
@@ -46,12 +45,10 @@ public class YAMLStructureViewFactory implements PsiStructureViewFactory {
|
||||
|
||||
return new TreeBasedStructureViewBuilder() {
|
||||
@Override
|
||||
@NotNull
|
||||
public StructureViewModel createStructureViewModel(@Nullable Editor editor) {
|
||||
public @NotNull StructureViewModel createStructureViewModel(@Nullable Editor editor) {
|
||||
return new StructureViewModelBase(psiFile, editor, new YAMLStructureViewFile((YAMLFile)psiFile)){
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<NodeProvider> getNodeProviders() {
|
||||
public @NotNull Collection<NodeProvider<?>> getNodeProviders() {
|
||||
return Collections.singleton(new YAMLAliasResolveNodeProvider());
|
||||
}
|
||||
}
|
||||
@@ -61,13 +58,11 @@ public class YAMLStructureViewFactory implements PsiStructureViewFactory {
|
||||
};
|
||||
}
|
||||
|
||||
@NotNull
|
||||
static String getAliasPresentableText(@NotNull YAMLAlias alias) {
|
||||
static @NotNull String getAliasPresentableText(@NotNull YAMLAlias alias) {
|
||||
return "*" + alias.getAliasName();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
static Collection<StructureViewTreeElement> createChildrenViewTreeElements(@Nullable YAMLPsiElement element, @Nullable String path) {
|
||||
static @NotNull Collection<StructureViewTreeElement> createChildrenViewTreeElements(@Nullable YAMLPsiElement element, @Nullable String path) {
|
||||
if (element == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
package org.jetbrains.uast.java
|
||||
|
||||
@@ -119,7 +119,7 @@ class JavaUAnonymousClass(
|
||||
override fun getFields(): Array<UField> = super<AbstractJavaUClass>.getFields()
|
||||
override fun getInitializers(): Array<UClassInitializer> = super<AbstractJavaUClass>.getInitializers()
|
||||
|
||||
val fakeConstructor: JavaUMethod? by lz {
|
||||
private val fakeConstructor: JavaUMethod? by lz {
|
||||
val psiClass = this.javaPsi
|
||||
val physicalNewExpression = psiClass.parent.castSafelyTo<PsiNewExpression>() ?: return@lz null
|
||||
val superConstructor = physicalNewExpression.resolveMethod()
|
||||
@@ -141,9 +141,9 @@ class JavaUAnonymousClass(
|
||||
}
|
||||
|
||||
override fun getMethods(): Array<UMethod> {
|
||||
val contsructor = fakeConstructor ?: return super<AbstractJavaUClass>.getMethods()
|
||||
val constructor = fakeConstructor ?: return super<AbstractJavaUClass>.getMethods()
|
||||
val uMethods = SmartList<UMethod>()
|
||||
uMethods.add(contsructor)
|
||||
uMethods.add(constructor)
|
||||
uMethods.addAll(super<AbstractJavaUClass>.getMethods())
|
||||
return uMethods.toTypedArray()
|
||||
}
|
||||
|
||||
+10
-16
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.lang.html.structureView;
|
||||
|
||||
import com.intellij.icons.AllIcons;
|
||||
@@ -17,15 +17,13 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
|
||||
class HtmlStructureViewTreeModel extends XmlStructureViewTreeModel implements PlaceHolder {
|
||||
|
||||
private final Collection<NodeProvider> myNodeProviders;
|
||||
final class HtmlStructureViewTreeModel extends XmlStructureViewTreeModel implements PlaceHolder {
|
||||
private final Collection<NodeProvider<?>> myNodeProviders;
|
||||
private String myStructureViewPlace;
|
||||
|
||||
private static final Sorter HTML_ALPHA_SORTER = new Sorter() {
|
||||
@NotNull
|
||||
@Override
|
||||
public Comparator getComparator() {
|
||||
public @NotNull Comparator getComparator() {
|
||||
return new Comparator() {
|
||||
@Override
|
||||
public int compare(Object o1, Object o2) {
|
||||
@@ -38,7 +36,7 @@ class HtmlStructureViewTreeModel extends XmlStructureViewTreeModel implements Pl
|
||||
return s1.compareToIgnoreCase(s2);
|
||||
}
|
||||
|
||||
private boolean isTagPresentation(final String presentation, final String tagName) {
|
||||
private static boolean isTagPresentation(final String presentation, final String tagName) {
|
||||
// "head", "head#id", "head.cls"
|
||||
final String lowerCased = StringUtil.toLowerCase(presentation);
|
||||
return lowerCased.startsWith(tagName) &&
|
||||
@@ -57,16 +55,14 @@ class HtmlStructureViewTreeModel extends XmlStructureViewTreeModel implements Pl
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public ActionPresentation getPresentation() {
|
||||
public @NotNull ActionPresentation getPresentation() {
|
||||
return new ActionPresentationData(PlatformEditorBundle.message("action.sort.alphabetically"),
|
||||
PlatformEditorBundle.message("action.sort.alphabetically"),
|
||||
AllIcons.ObjectBrowser.Sorted);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
public @NotNull String getName() {
|
||||
return ALPHA_SORTER_ID;
|
||||
}
|
||||
};
|
||||
@@ -80,7 +76,7 @@ class HtmlStructureViewTreeModel extends XmlStructureViewTreeModel implements Pl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlace(@NotNull final String place) {
|
||||
public void setPlace(final @NotNull String place) {
|
||||
myStructureViewPlace = place;
|
||||
}
|
||||
|
||||
@@ -99,14 +95,12 @@ class HtmlStructureViewTreeModel extends XmlStructureViewTreeModel implements Pl
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Collection<NodeProvider> getNodeProviders() {
|
||||
public @NotNull Collection<NodeProvider<?>> getNodeProviders() {
|
||||
return myNodeProviders;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public StructureViewTreeElement getRoot() {
|
||||
public @NotNull StructureViewTreeElement getRoot() {
|
||||
return new HtmlFileTreeElement(TreeStructureUtil.isInStructureViewPopup(this), getPsiFile());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user