mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-144857 Find in Path layout
Iteration #2 : matches counter inside the search field; don't lose custom scope name
This commit is contained in:
@@ -28,12 +28,15 @@ import com.intellij.openapi.actionSystem.impl.InplaceActionButtonLook;
|
||||
import com.intellij.openapi.project.DumbAwareAction;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.ui.Gray;
|
||||
import com.intellij.ui.JBColor;
|
||||
import com.intellij.ui.components.JBLabel;
|
||||
import com.intellij.ui.components.JBList;
|
||||
import com.intellij.ui.components.JBScrollPane;
|
||||
import com.intellij.ui.components.panels.NonOpaquePanel;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.ui.JBUI;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -47,6 +50,7 @@ import java.beans.PropertyChangeListener;
|
||||
|
||||
public class SearchTextArea extends NonOpaquePanel implements PropertyChangeListener, FocusListener {
|
||||
private final JTextArea myTextArea;
|
||||
private final JLabel myInfoLabel;
|
||||
|
||||
public SearchTextArea(boolean search) {
|
||||
this(new JTextArea(), search);
|
||||
@@ -54,8 +58,6 @@ public class SearchTextArea extends NonOpaquePanel implements PropertyChangeList
|
||||
|
||||
public SearchTextArea(@NotNull JTextArea textArea,boolean search) {
|
||||
myTextArea = textArea;
|
||||
setBorder(JBUI.Borders.empty(6, 6, 6, 8));
|
||||
setLayout(new BorderLayout(JBUI.scale(4), 0));
|
||||
myTextArea.addPropertyChangeListener("background", this);
|
||||
myTextArea.addFocusListener(this);
|
||||
myTextArea.setBorder(null);
|
||||
@@ -72,10 +74,15 @@ public class SearchTextArea extends NonOpaquePanel implements PropertyChangeList
|
||||
ActionButton button =
|
||||
new ActionButton(historyAction, historyAction.getTemplatePresentation(), ActionPlaces.UNKNOWN, new Dimension(JBUI.scale(16), JBUI.scale(16)));
|
||||
button.setLook(new InplaceActionButtonLook());
|
||||
JPanel p = new NonOpaquePanel(new BorderLayout());
|
||||
p.add(button, BorderLayout.NORTH);
|
||||
add(p, BorderLayout.WEST);
|
||||
add(scrollPane, BorderLayout.CENTER);
|
||||
|
||||
myInfoLabel = new JBLabel(UIUtil.ComponentStyle.SMALL);
|
||||
myInfoLabel.setForeground(JBColor.GRAY);
|
||||
|
||||
setBorder(JBUI.Borders.empty(6, 6, 6, 8));
|
||||
setLayout(new MigLayout("flowx, ins 0, gapx " + JBUI.scale(4) + "px"));
|
||||
add(button, "ay top, gaptop " + JBUI.scale(2) + "px");
|
||||
add(scrollPane, "growx, pushx");
|
||||
add(myInfoLabel, "ay top, gaptop " + JBUI.scale(2) + "px, gapright " + JBUI.scale(6) + "px");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -103,6 +110,10 @@ public class SearchTextArea extends NonOpaquePanel implements PropertyChangeList
|
||||
repaint();
|
||||
}
|
||||
|
||||
public void setInfoText(String info) {
|
||||
myInfoLabel.setText(info);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint(Graphics graphics) {
|
||||
Graphics2D g = (Graphics2D)graphics.create();
|
||||
|
||||
@@ -803,7 +803,8 @@ public class FindPopupPanel extends JBPanel {
|
||||
mySearchRescheduleOnCancellationsAlarm.cancelAllRequests();
|
||||
applyTo(myModel, false);
|
||||
FindManager.getInstance(myProject).getFindInProjectModel().copyFrom(myModel);
|
||||
((FindManagerImpl)FindManager.getInstance(myProject)).changeGlobalSettings(/*findModel*/myModel);
|
||||
((FindManagerImpl)FindManager.getInstance(myProject)).changeGlobalSettings(myModel);
|
||||
FindSettings.getInstance().setDefaultScopeName(myScopeCombo.getSelectedScopeName());
|
||||
|
||||
|
||||
ValidationInfo result = getValidationInfo(/*findModel*/myModel);
|
||||
@@ -871,6 +872,15 @@ public class FindPopupPanel extends JBPanel {
|
||||
int occurrences = resultsCount.get();
|
||||
if (occurrences == 0) myResultsPreviewTable.getEmptyText().setText(UIBundle.message("message.nothingToShow"));
|
||||
myCodePreviewComponent.setVisible(occurrences > 0);
|
||||
StringBuilder info = new StringBuilder();
|
||||
if (occurrences > 0) {
|
||||
info.append(Math.min(ShowUsagesAction.USAGES_PAGE_SIZE, occurrences));
|
||||
if (occurrences >= ShowUsagesAction.USAGES_PAGE_SIZE) {
|
||||
info.append("+");
|
||||
}
|
||||
info.append(UIBundle.message("message.matches", occurrences));
|
||||
}
|
||||
mySearchTextArea.setInfoText(info.toString());
|
||||
scheduleUpdateResultsPopupBounds();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,6 +164,7 @@ tool.window.name.documentation=Documentation
|
||||
|
||||
message.nothingToShow=Nothing to show
|
||||
message.noMatchesFound=No matches found
|
||||
message.matches={0,choice, 0# matches|1# match|2# matches}
|
||||
|
||||
tool.window.quick.access.title=Tool Windows Quick Access
|
||||
tool.window.quick.access.message=Hover over the icon below to access tool windows\nClick the icon to make tool windows buttons visible
|
||||
|
||||
Reference in New Issue
Block a user