mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 11:53:49 +07:00
Fix display of enum members in navbar (IDEA-231596)
GitOrigin-RevId: 1a429cba7fe88365f22085b49e29010eae3ef4e8
This commit is contained in:
committed by
intellij-monorepo-bot
parent
87a64bc101
commit
dafad04681
@@ -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-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.
|
||||
package com.intellij.ide.structureView.impl.java;
|
||||
|
||||
import com.intellij.ide.structureView.StructureViewTreeElement;
|
||||
@@ -44,11 +30,10 @@ public class JavaClassTreeElement extends JavaClassTreeElementBase<PsiClass> {
|
||||
@Override
|
||||
@NotNull
|
||||
public Collection<StructureViewTreeElement> getChildrenBase() {
|
||||
return getClassChildren();
|
||||
return getClassChildren(getElement());
|
||||
}
|
||||
|
||||
private Collection<StructureViewTreeElement> getClassChildren() {
|
||||
final PsiClass aClass = getElement();
|
||||
static Collection<StructureViewTreeElement> getClassChildren(PsiClass aClass) {
|
||||
if (aClass == null) return Collections.emptyList();
|
||||
|
||||
LinkedHashSet<PsiElement> members = getOwnChildren(aClass);
|
||||
|
||||
@@ -1,24 +1,12 @@
|
||||
/*
|
||||
* 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-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.
|
||||
package com.intellij.ide.structureView.impl.java;
|
||||
|
||||
import com.intellij.ide.structureView.StructureViewTreeElement;
|
||||
import com.intellij.ide.util.treeView.smartTree.SortableTreeElement;
|
||||
import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.PsiEnumConstant;
|
||||
import com.intellij.psi.PsiEnumConstantInitializer;
|
||||
import com.intellij.psi.PsiField;
|
||||
import com.intellij.psi.PsiSubstitutor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -36,6 +24,13 @@ public class PsiFieldTreeElement extends JavaClassTreeElementBase<PsiField> impl
|
||||
@Override
|
||||
@NotNull
|
||||
public Collection<StructureViewTreeElement> getChildrenBase() {
|
||||
PsiField field = getField();
|
||||
if (field instanceof PsiEnumConstant) {
|
||||
PsiEnumConstantInitializer initializingClass = ((PsiEnumConstant)field).getInitializingClass();
|
||||
if (initializingClass != null) {
|
||||
return JavaClassTreeElement.getClassChildren(initializingClass);
|
||||
}
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user