Icon class should be not used directly and should be located in ui but not generic modules

GitOrigin-RevId: 4c3b4a1ec67a88fb32df9cd618a4fe42ed4423ed
This commit is contained in:
Vladimir Krivosheev
2022-08-24 18:11:20 +02:00
committed by intellij-monorepo-bot
parent c0044f5718
commit 0e886c903e
71 changed files with 742 additions and 888 deletions

View File

@@ -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.StructureViewBundle;
@@ -20,12 +6,13 @@ import com.intellij.ide.util.treeView.smartTree.ActionPresentation;
import com.intellij.ide.util.treeView.smartTree.ActionPresentationData;
import com.intellij.ide.util.treeView.smartTree.Filter;
import com.intellij.ide.util.treeView.smartTree.TreeElement;
import com.intellij.util.PlatformIcons;
import com.intellij.ui.IconManager;
import com.intellij.ui.PlatformIcons;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
public class FieldsFilter implements Filter{
@NonNls public static final String ID = "SHOW_FIELDS";
public final class FieldsFilter implements Filter {
public static final @NonNls String ID = "SHOW_FIELDS";
@Override
public boolean isVisible(TreeElement treeNode) {
@@ -33,14 +20,13 @@ public class FieldsFilter implements Filter{
}
@Override
@NotNull
public ActionPresentation getPresentation() {
return new ActionPresentationData(StructureViewBundle.message("action.structureview.show.fields"), null, PlatformIcons.FIELD_ICON);
public @NotNull ActionPresentation getPresentation() {
return new ActionPresentationData(StructureViewBundle.message("action.structureview.show.fields"), null,
IconManager.getInstance().getPlatformIcon(PlatformIcons.Field));
}
@Override
@NotNull
public String getName() {
public @NotNull String getName() {
return ID;
}

View File

@@ -1,31 +1,18 @@
/*
* 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.util.JavaAnonymousClassesHelper;
import com.intellij.psi.PsiAnonymousClass;
import com.intellij.psi.PsiClass;
import com.intellij.util.PlatformIcons;
import com.intellij.ui.IconManager;
import com.intellij.ui.PlatformIcons;
import javax.swing.*;
/**
* @author Konstantin Bulenkov
*/
public class JavaAnonymousClassTreeElement extends JavaClassTreeElement {
public final class JavaAnonymousClassTreeElement extends JavaClassTreeElement {
public static final JavaAnonymousClassTreeElement[] EMPTY_ARRAY = {};
private String myName;
@@ -76,6 +63,6 @@ public class JavaAnonymousClassTreeElement extends JavaClassTreeElement {
@Override
public Icon getIcon(boolean open) {
return PlatformIcons.ANONYMOUS_CLASS_ICON;
return IconManager.getInstance().getPlatformIcon(PlatformIcons.AnonymousClass);
}
}

View File

@@ -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.ide.structureView.impl.java;
import com.intellij.ide.structureView.impl.common.PsiTreeElementBase;
@@ -14,7 +14,8 @@ import com.intellij.openapi.util.PropertyOwner;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.psi.PsiAnonymousClass;
import com.intellij.psi.PsiElement;
import com.intellij.util.PlatformIcons;
import com.intellij.ui.IconManager;
import com.intellij.ui.PlatformIcons;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -26,14 +27,13 @@ import java.util.List;
/**
* @author Konstantin Bulenkov
*/
public class JavaAnonymousClassesNodeProvider
public final class JavaAnonymousClassesNodeProvider
implements FileStructureNodeProvider<JavaAnonymousClassTreeElement>, PropertyOwner, DumbAware {
@NonNls public static final String ID = "SHOW_ANONYMOUS";
@NonNls public static final String JAVA_ANONYMOUS_PROPERTY_NAME = "java.anonymous.provider";
public static final @NonNls String ID = "SHOW_ANONYMOUS";
public static final @NonNls String JAVA_ANONYMOUS_PROPERTY_NAME = "java.anonymous.provider";
@NotNull
@Override
public Collection<JavaAnonymousClassTreeElement> provideNodes(@NotNull TreeElement node) {
public @NotNull Collection<JavaAnonymousClassTreeElement> provideNodes(@NotNull TreeElement node) {
if (node instanceof PsiMethodTreeElement || node instanceof PsiFieldTreeElement || node instanceof ClassInitializerTreeElement) {
final PsiElement el = ((PsiTreeElementBase<?>)node).getElement();
if (el != null) {
@@ -52,9 +52,8 @@ public class JavaAnonymousClassesNodeProvider
return Collections.emptyList();
}
@NotNull
@Override
public String getCheckBoxText() {
public @NotNull String getCheckBoxText() {
return JavaStructureViewBundle.message("file.structure.toggle.show.anonymous.classes");
}
@@ -63,21 +62,18 @@ public class JavaAnonymousClassesNodeProvider
return new Shortcut[]{KeyboardShortcut.fromString(SystemInfo.isMac ? "meta I" : "control I")};
}
@NotNull
@Override
public ActionPresentation getPresentation() {
return new ActionPresentationData(getCheckBoxText(), null, PlatformIcons.ANONYMOUS_CLASS_ICON);
public @NotNull ActionPresentation getPresentation() {
return new ActionPresentationData(getCheckBoxText(), null, IconManager.getInstance().getPlatformIcon(PlatformIcons.AnonymousClass));
}
@NotNull
@Override
public String getName() {
public @NotNull String getName() {
return ID;
}
@NotNull
@Override
public String getPropertyName() {
public @NotNull String getPropertyName() {
return JAVA_ANONYMOUS_PROPERTY_NAME;
}
}

View File

@@ -1,21 +1,21 @@
// 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 com.intellij.ide.structureView.impl.java;
import com.intellij.ide.util.treeView.AbstractTreeNode;
import com.intellij.ide.util.treeView.smartTree.*;
import com.intellij.psi.PsiElement;
import com.intellij.util.PlatformIcons;
import com.intellij.ui.IconManager;
import com.intellij.ui.PlatformIcons;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import java.util.*;
public final class PropertiesGrouper implements Grouper {
@NonNls public static final String ID = "SHOW_PROPERTIES";
public static final @NonNls String ID = "SHOW_PROPERTIES";
@Override
@NotNull
public Collection<Group> group(@NotNull AbstractTreeNode<?> parent, @NotNull Collection<TreeElement> children) {
public @NotNull Collection<Group> group(@NotNull AbstractTreeNode<?> parent, @NotNull Collection<TreeElement> children) {
if (parent.getValue() instanceof PropertyGroup) return Collections.emptyList();
Map<Group,Group> result = new HashMap<>();
for (TreeElement o : children) {
@@ -43,14 +43,12 @@ public final class PropertiesGrouper implements Grouper {
}
@Override
@NotNull
public ActionPresentation getPresentation() {
return new ActionPresentationData(JavaStructureViewBundle.message("action.structureview.show.properties"), null, PlatformIcons.PROPERTY_ICON);
public @NotNull ActionPresentation getPresentation() {
return new ActionPresentationData(JavaStructureViewBundle.message("action.structureview.show.properties"), null, IconManager.getInstance().getPlatformIcon(PlatformIcons.Property));
}
@Override
@NotNull
public String getName() {
public @NotNull String getName() {
return ID;
}
}

View File

@@ -1,25 +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-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.util.treeView.smartTree.ActionPresentation;
import com.intellij.ide.util.treeView.smartTree.ActionPresentationData;
import com.intellij.ide.util.treeView.smartTree.Filter;
import com.intellij.ide.util.treeView.smartTree.TreeElement;
import com.intellij.util.PlatformIcons;
import com.intellij.ui.IconManager;
import com.intellij.ui.PlatformIcons;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -39,7 +26,8 @@ public class PublicElementsFilter implements Filter{
@Override
@NotNull
public ActionPresentation getPresentation() {
return new ActionPresentationData(JavaStructureViewBundle.message("action.structureview.show.non.public"), null, PlatformIcons.PRIVATE_ICON);
return new ActionPresentationData(JavaStructureViewBundle.message("action.structureview.show.non.public"), null,
IconManager.getInstance().getPlatformIcon(PlatformIcons.Private));
}
@Override