コード例 #1
1
 private Component createSearchField() {
   final SearchTextFieldWithStoredHistory textFilter =
       new SearchTextFieldWithStoredHistory("Vcs.Log.Text.Filter.History") {
         @Override
         protected void onFieldCleared() {
           myFilterModel.setFilter(null);
         }
       };
   textFilter.setText(myFilterModel.getText());
   textFilter
       .getTextEditor()
       .addActionListener(
           new ActionListener() {
             @Override
             public void actionPerformed(@NotNull ActionEvent e) {
               myFilterModel.setFilter(new VcsLogTextFilterImpl(textFilter.getText()));
               textFilter.addCurrentTextToHistory();
             }
           });
   textFilter.addDocumentListener(
       new DocumentAdapter() {
         @Override
         protected void textChanged(DocumentEvent e) {
           try {
             myFilterModel.setUnsavedText(
                 e.getDocument().getText(0, e.getDocument().getLength()));
           } catch (BadLocationException ex) {
             LOG.error(ex);
           }
         }
       });
   return textFilter;
 }
コード例 #2
0
 @NotNull
 @Override
 public VcsLogFilterCollection getFilters() {
   ApplicationManager.getApplication().assertIsDispatchThread();
   Pair<VcsLogTextFilter, VcsLogHashFilter> filtersFromText =
       getFiltersFromTextArea(myTextFilterModel.getFilter());
   return new VcsLogFilterCollectionImpl(
       myBranchFilterModel.getFilter(),
       myUserFilterModel.getFilter(),
       filtersFromText.second,
       myDateFilterModel.getFilter(),
       filtersFromText.first,
       myStructureFilterModel.getFilter() == null
           ? null
           : myStructureFilterModel.getFilter().getStructureFilter(),
       myStructureFilterModel.getFilter() == null
           ? null
           : myStructureFilterModel.getFilter().getRootFilter());
 }