Search in sources :

Example 1 with SearchTextField

use of com.intellij.ui.SearchTextField in project android by JetBrains.

the class ChooseDeviceDefinitionStepFixture method enterSearchTerm.

@NotNull
public ChooseDeviceDefinitionStepFixture enterSearchTerm(@NotNull String searchTerm) {
    SearchTextField searchField = robot().finder().findByType(target(), SearchTextField.class);
    replaceText(searchField.getTextEditor(), searchTerm);
    return this;
}
Also used : SearchTextField(com.intellij.ui.SearchTextField) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with SearchTextField

use of com.intellij.ui.SearchTextField in project android by JetBrains.

the class AttachedToolWindowTest method testSearchButtonInHeader.

@Test
public void testSearchButtonInHeader() {
    JLabel header = findHeaderLabel(myToolWindow.getComponent());
    assertThat(header.isVisible()).isTrue();
    SearchTextField searchField = findHeaderSearchField(myToolWindow.getComponent());
    assertThat(searchField.isVisible()).isFalse();
    ActionButton button = findButtonByName(myToolWindow.getComponent(), "Search");
    assertThat(button).isNotNull();
    button.click();
    assertThat(header.isVisible()).isFalse();
    assertThat(searchField.isVisible()).isTrue();
    fireFocusLost(searchField.getTextEditor());
    assertThat(header.isVisible()).isTrue();
    assertThat(searchField.isVisible()).isFalse();
}
Also used : ActionButton(com.intellij.openapi.actionSystem.impl.ActionButton) SearchTextField(com.intellij.ui.SearchTextField) Test(org.junit.Test)

Example 3 with SearchTextField

use of com.intellij.ui.SearchTextField in project android by JetBrains.

the class TraceViewPanel method createSearchField.

private SearchTextField createSearchField() {
    SearchTextField stf = new SearchTextField(true);
    stf.setOpaque(false);
    stf.setEnabled(true);
    Utils.setSmallerFont(stf);
    stf.addDocumentListener(new DocumentAdapter() {

        @Override
        protected void textChanged(DocumentEvent e) {
            searchTextChanged(getText(e));
        }

        private String getText(DocumentEvent e) {
            try {
                return e.getDocument().getText(0, e.getDocument().getLength());
            } catch (BadLocationException e1) {
                return "";
            }
        }
    });
    JTextField editorTextField = stf.getTextEditor();
    editorTextField.setMinimumSize(new Dimension(JBUI.scale(200), -1));
    editorTextField.registerKeyboardAction(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            closeSearchComponent();
        }
    }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);
    return stf;
}
Also used : SearchTextField(com.intellij.ui.SearchTextField) DocumentAdapter(com.intellij.ui.DocumentAdapter) DocumentEvent(javax.swing.event.DocumentEvent) BadLocationException(javax.swing.text.BadLocationException)

Aggregations

SearchTextField (com.intellij.ui.SearchTextField)3 ActionButton (com.intellij.openapi.actionSystem.impl.ActionButton)1 DocumentAdapter (com.intellij.ui.DocumentAdapter)1 DocumentEvent (javax.swing.event.DocumentEvent)1 BadLocationException (javax.swing.text.BadLocationException)1 NotNull (org.jetbrains.annotations.NotNull)1 Test (org.junit.Test)1