make title compact

This commit is contained in:
Konstantin Bulenkov
2012-06-08 14:14:31 +02:00
parent 78cf87d2c8
commit a5c210ebf6
2 changed files with 21 additions and 10 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2010 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -460,7 +460,8 @@ public class ShowUsagesAction extends AnAction implements PopupAction {
else {
s = title + " (" + UsageViewBundle.message("usages.n", usages.size()) + " found)";
}
builder.setTitle(suggestSecondInvocation(options, handler, s));
builder.setTitle("<html>" + s + "</html>");
builder.setAdText(getSecondInvocationTitle(options, handler));
}
builder.setMovable(true).setResizable(true);
@@ -555,16 +556,26 @@ public class ShowUsagesAction extends AnAction implements PopupAction {
}
private static String suggestSecondInvocation(FindUsagesOptions options, FindUsagesHandler handler, String s) {
if (getShowUsagesShortcut() != null) {
GlobalSearchScope maximalScope = getMaximalScope(handler);
if (!notNullizeScope(options, handler.getProject()).equals(maximalScope)) {
s += "<br><small>Press " + KeymapUtil.getShortcutText(getShowUsagesShortcut()) +
" again to search in " + maximalScope.getDisplayName() + "</small>";
}
final String title = getSecondInvocationTitle(options, handler);
if (title != null) {
s += "<br><small>Press " + title + "</small>";
}
return "<html><body>" + s + "</body></html>";
}
@Nullable
private static String getSecondInvocationTitle(FindUsagesOptions options, FindUsagesHandler handler) {
if (getShowUsagesShortcut() != null) {
GlobalSearchScope maximalScope = getMaximalScope(handler);
if (!notNullizeScope(options, handler.getProject()).equals(maximalScope)) {
return "Press " + KeymapUtil.getShortcutText(getShowUsagesShortcut()) +
" again to search in " + maximalScope.getDisplayName();
}
}
return null;
}
private void searchEverywhere(FindUsagesOptions options,
FindUsagesHandler handler,
Editor editor,
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -87,7 +87,7 @@ public class CaptionPanel extends JPanel {
public void addSettingsComponent(Component component) {
if (mySettingComponent == null) {
mySettingComponent = new JPanel(new FlowLayout());
mySettingComponent = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
mySettingComponent.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
add(mySettingComponent, BorderLayout.WEST);
mySettingComponent.setOpaque(false);