Fix empty name for class initializer in project view when "Show Members" enabled
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2013 JetBrains s.r.o.
|
* Copyright 2010-2014 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -51,13 +51,13 @@ public class JetDeclarationTreeNode extends AbstractPsiBasedNode<JetDeclaration>
|
|||||||
protected void updateImpl(PresentationData data) {
|
protected void updateImpl(PresentationData data) {
|
||||||
JetDeclaration declaration = getValue();
|
JetDeclaration declaration = getValue();
|
||||||
if (declaration != null) {
|
if (declaration != null) {
|
||||||
String text = declaration.getName();
|
String text = declaration instanceof JetClassInitializer ? CLASS_INITIALIZER : declaration.getName();
|
||||||
if (text == null) return;
|
if (text == null) return;
|
||||||
|
|
||||||
JetCodeStyleSettings settings = CodeStyleSettingsManager.getInstance(getProject()).getCurrentSettings()
|
JetCodeStyleSettings settings = CodeStyleSettingsManager.getInstance(getProject()).getCurrentSettings()
|
||||||
.getCustomSettings(JetCodeStyleSettings.class);
|
.getCustomSettings(JetCodeStyleSettings.class);
|
||||||
if (declaration instanceof JetClassInitializer) {
|
|
||||||
text = CLASS_INITIALIZER;
|
if (declaration instanceof JetProperty) {
|
||||||
} else if (declaration instanceof JetProperty) {
|
|
||||||
JetProperty property = (JetProperty) declaration;
|
JetProperty property = (JetProperty) declaration;
|
||||||
JetTypeReference ref = property.getTypeRef();
|
JetTypeReference ref = property.getTypeRef();
|
||||||
if (ref != null) {
|
if (ref != null) {
|
||||||
@@ -66,7 +66,8 @@ public class JetDeclarationTreeNode extends AbstractPsiBasedNode<JetDeclaration>
|
|||||||
if (settings.SPACE_AFTER_TYPE_COLON) text += " ";
|
if (settings.SPACE_AFTER_TYPE_COLON) text += " ";
|
||||||
text += ref.getText();
|
text += ref.getText();
|
||||||
}
|
}
|
||||||
} else if (declaration instanceof JetFunction) {
|
}
|
||||||
|
else if (declaration instanceof JetFunction) {
|
||||||
JetFunction function = (JetFunction) declaration;
|
JetFunction function = (JetFunction) declaration;
|
||||||
JetTypeReference receiverTypeRef = function.getReceiverTypeRef();
|
JetTypeReference receiverTypeRef = function.getReceiverTypeRef();
|
||||||
if (receiverTypeRef != null) {
|
if (receiverTypeRef != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user