Imports on copy/paste UI: do not show misleading icon in dialog
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright 2010-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.
|
||||
*/
|
||||
|
||||
package org.jetbrains.jet.plugin.codeInsight
|
||||
|
||||
import com.intellij.ide.util.FQNameCellRenderer
|
||||
import javax.swing.JList
|
||||
import java.awt.Component
|
||||
|
||||
class KotlinImportListRenderer: FQNameCellRenderer() {
|
||||
override fun getListCellRendererComponent(list: JList?, value: Any?, index: Int, isSelected: Boolean, cellHasFocus: Boolean): Component? {
|
||||
val component = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus)
|
||||
setIcon(null)
|
||||
return component
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,6 @@ package org.jetbrains.jet.plugin.codeInsight;
|
||||
|
||||
import com.intellij.CommonBundle;
|
||||
import com.intellij.codeInsight.CodeInsightBundle;
|
||||
import com.intellij.ide.util.FQNameCellRenderer;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.ui.VerticalFlowLayout;
|
||||
@@ -35,7 +34,7 @@ import static com.intellij.util.ui.UIUtil.ComponentStyle.SMALL;
|
||||
import static com.intellij.util.ui.UIUtil.FontColor.BRIGHTER;
|
||||
|
||||
//TODO: this is a copy of com.intellij.codeInsight.editorActions.RestoreReferencesDialog
|
||||
//consider improving rendering of list cells if you decide to submit pull request to idea (or improve this version)
|
||||
// Cell renderer was replaced by custom implementation
|
||||
public class RestoreReferencesDialog extends DialogWrapper {
|
||||
private final Object[] myNamedElements;
|
||||
private JList myList;
|
||||
@@ -74,7 +73,7 @@ public class RestoreReferencesDialog extends DialogWrapper {
|
||||
protected JComponent createCenterPanel() {
|
||||
final JPanel panel = new JPanel(new BorderLayout(UIUtil.DEFAULT_HGAP, UIUtil.DEFAULT_VGAP));
|
||||
myList = new JBList(myNamedElements);
|
||||
myList.setCellRenderer(new FQNameCellRenderer());
|
||||
myList.setCellRenderer(new KotlinImportListRenderer());
|
||||
panel.add(ScrollPaneFactory.createScrollPane(myList), BorderLayout.CENTER);
|
||||
|
||||
panel.add(new JBLabel(myContainsClassesOnly ?
|
||||
|
||||
Reference in New Issue
Block a user