Remove dependency to IconLoader from compiler
This commit is contained in:
+2
-5
@@ -19,14 +19,12 @@ package org.jetbrains.kotlin.asJava.elements;
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.navigation.NavigationItem;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.ElementPresentationUtil;
|
||||
import com.intellij.psi.impl.light.LightElement;
|
||||
import com.intellij.psi.impl.light.LightModifierList;
|
||||
import com.intellij.ui.RowIcon;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.PlatformIcons;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.idea.KotlinIconProviderService;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
@@ -112,7 +110,6 @@ public class LightVariableBuilder extends LightElement implements PsiVariable, N
|
||||
|
||||
@Override
|
||||
public Icon getElementIcon(int flags) {
|
||||
RowIcon baseIcon = ElementPresentationUtil.createLayeredIcon(PlatformIcons.VARIABLE_ICON, this, false);
|
||||
return ElementPresentationUtil.addVisibilityIcon(this, flags, baseIcon);
|
||||
return KotlinIconProviderService.getInstance().getLightVariableIcon(this, flags);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.idea;
|
||||
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public interface KotlinFileIcon {
|
||||
Icon KOTLIN_FILE = IconLoader.getIcon("/org/jetbrains/kotlin/idea/icons/kotlin_file.svg");
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.idea;
|
||||
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public interface KotlinFileIcon {
|
||||
Icon KOTLIN_FILE = IconLoader.getIcon("/org/jetbrains/kotlin/idea/icons/kotlin_file.png");
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.idea;
|
||||
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public interface KotlinFileIcon {
|
||||
Icon KOTLIN_FILE = IconLoader.getIcon("/org/jetbrains/kotlin/idea/icons/kotlin_file.png");
|
||||
}
|
||||
@@ -17,7 +17,6 @@
|
||||
package org.jetbrains.kotlin.idea;
|
||||
|
||||
import com.intellij.openapi.fileTypes.LanguageFileType;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.openapi.util.NotNullLazyValue;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -31,7 +30,7 @@ public class KotlinFileType extends LanguageFileType {
|
||||
@NotNull
|
||||
@Override
|
||||
protected Icon compute() {
|
||||
return KotlinFileIcon.KOTLIN_FILE;
|
||||
return KotlinIconProviderService.getInstance().getFileIcon();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.idea;
|
||||
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.psi.PsiModifierListOwner;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public abstract class KotlinIconProviderService {
|
||||
public abstract Icon getFileIcon();
|
||||
public abstract Icon getLightVariableIcon(@NotNull PsiModifierListOwner element, int flags);
|
||||
|
||||
public static class CompilerKotlinFileIconProviderService extends KotlinIconProviderService {
|
||||
@Override
|
||||
public Icon getFileIcon() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getLightVariableIcon(@NotNull PsiModifierListOwner element, int flags) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static KotlinIconProviderService getInstance() {
|
||||
KotlinIconProviderService service = ServiceManager.getService(KotlinIconProviderService.class);
|
||||
return service != null ? service : new CompilerKotlinFileIconProviderService();
|
||||
}
|
||||
}
|
||||
@@ -17,8 +17,6 @@
|
||||
package org.jetbrains.kotlin.idea;
|
||||
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.fileTypes.LanguageFileType;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.openapi.util.NotNullLazyValue;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -34,7 +32,7 @@ public class KotlinModuleFileType implements FileType {
|
||||
@NotNull
|
||||
@Override
|
||||
protected Icon compute() {
|
||||
return KotlinFileIcon.KOTLIN_FILE;
|
||||
return KotlinIconProviderService.getInstance().getFileIcon();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -221,6 +221,9 @@
|
||||
</actions>
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<applicationService serviceInterface="org.jetbrains.kotlin.idea.KotlinIconProviderService"
|
||||
serviceImplementation="org.jetbrains.kotlin.idea.KotlinIdeFileIconProviderService"/>
|
||||
|
||||
<applicationService serviceInterface="org.jetbrains.kotlin.psi.stubs.elements.StubIndexService"
|
||||
serviceImplementation="org.jetbrains.kotlin.idea.stubindex.IdeStubIndexService"/>
|
||||
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.idea
|
||||
|
||||
import com.intellij.openapi.util.IconLoader
|
||||
import com.intellij.psi.PsiModifierListOwner
|
||||
import com.intellij.psi.impl.ElementPresentationUtil
|
||||
import com.intellij.util.PlatformIcons
|
||||
import javax.swing.Icon
|
||||
|
||||
class KotlinIdeFileIconProviderService : KotlinIconProviderService() {
|
||||
override fun getFileIcon(): Icon = KOTLIN_FILE
|
||||
|
||||
override fun getLightVariableIcon(element: PsiModifierListOwner, flags: Int): Icon {
|
||||
val baseIcon = ElementPresentationUtil.createLayeredIcon(PlatformIcons.VARIABLE_ICON, element, false)
|
||||
return ElementPresentationUtil.addVisibilityIcon(element, flags, baseIcon)
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val KOTLIN_FILE = IconLoader.getIcon("/org/jetbrains/kotlin/idea/icons/kotlin_file.svg")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.idea
|
||||
|
||||
import com.intellij.openapi.util.IconLoader
|
||||
import com.intellij.psi.PsiModifierListOwner
|
||||
import com.intellij.psi.impl.ElementPresentationUtil
|
||||
import com.intellij.util.PlatformIcons
|
||||
import javax.swing.Icon
|
||||
|
||||
class KotlinIdeFileIconProviderService : KotlinIconProviderService() {
|
||||
override fun getFileIcon(): Icon = KOTLIN_FILE
|
||||
|
||||
override fun getLightVariableIcon(element: PsiModifierListOwner, flags: Int): Icon {
|
||||
val baseIcon = ElementPresentationUtil.createLayeredIcon(PlatformIcons.VARIABLE_ICON, element, false)
|
||||
return ElementPresentationUtil.addVisibilityIcon(element, flags, baseIcon)
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val KOTLIN_FILE = IconLoader.getIcon("/org/jetbrains/kotlin/idea/icons/kotlin_file.png")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.idea
|
||||
|
||||
import com.intellij.openapi.util.IconLoader
|
||||
import com.intellij.psi.PsiModifierListOwner
|
||||
import com.intellij.psi.impl.ElementPresentationUtil
|
||||
import com.intellij.util.PlatformIcons
|
||||
import javax.swing.Icon
|
||||
|
||||
class KotlinIdeFileIconProviderService : KotlinIconProviderService() {
|
||||
override fun getFileIcon(): Icon = KOTLIN_FILE
|
||||
|
||||
override fun getLightVariableIcon(element: PsiModifierListOwner, flags: Int): Icon {
|
||||
val baseIcon = ElementPresentationUtil.createLayeredIcon(PlatformIcons.VARIABLE_ICON, element, false)
|
||||
return ElementPresentationUtil.addVisibilityIcon(element, flags, baseIcon)
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val KOTLIN_FILE = IconLoader.getIcon("/org/jetbrains/kotlin/idea/icons/kotlin_file.png")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user