mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fix popup caption to not expand popup for wild titles + fix ClassPresentationUtil to return correct presentation for anonymous classes
This commit is contained in:
@@ -79,8 +79,8 @@ public class ClassPresentationUtil {
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static ItemPresentation getPresentation(@NotNull final PsiClass psiClass) {
|
||||
if (psiClass instanceof PsiAnonymousClass) return null;
|
||||
return new ItemPresentation() {
|
||||
public String getPresentableText() {
|
||||
return getNameForClass(psiClass, false);
|
||||
|
||||
@@ -64,10 +64,23 @@ public class TitlePanel extends CaptionPanel {
|
||||
myLabel.setText(titleText);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getMinimumSize() {
|
||||
return new Dimension(10, getPreferredSize().height);
|
||||
}
|
||||
|
||||
public Dimension getPreferredSize() {
|
||||
final String text = myLabel.getText();
|
||||
return text != null && text.trim().length() > 0 ? super.getPreferredSize() : new Dimension(0, 0);
|
||||
if (text == null || text.trim().length() == 0) {
|
||||
return new Dimension(0, 0);
|
||||
}
|
||||
|
||||
final Dimension preferredSize = super.getPreferredSize();
|
||||
if (preferredSize.width > 100) { // do not allow caption to extend parent container
|
||||
return new Dimension(100, preferredSize.height);
|
||||
}
|
||||
|
||||
return preferredSize;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user