コード例 #1
0
 @Override
 public void actionPerformed(AnActionEvent e) {
   final Component c = e.getData(PlatformDataKeys.CONTEXT_COMPONENT);
   if (c != null) {
     final JTree tree = UIUtil.getParentOfType(JTree.class, c);
     if (tree != null) {
       TreeUtil.expandAll(tree);
     }
   }
 }
コード例 #2
0
 private void rebuildListContent() {
   ArrayList<Item> items = new ArrayList<Item>();
   int i = 0;
   List<Data> contents = new ArrayList<Data>(getContents());
   for (Data content : contents) {
     String fullString = getStringRepresentationFor(content);
     if (fullString != null) {
       String shortString;
       fullString = StringUtil.convertLineSeparators(fullString);
       int newLineIdx = fullString.indexOf('\n');
       if (newLineIdx == -1) {
         shortString = fullString.trim();
       } else {
         int lastLooked = 0;
         do {
           int nextLineIdx = fullString.indexOf("\n", lastLooked);
           if (nextLineIdx > lastLooked) {
             shortString = fullString.substring(lastLooked, nextLineIdx).trim() + " ...";
             break;
           } else if (nextLineIdx == -1) {
             shortString = " ...";
             break;
           }
           lastLooked = nextLineIdx + 1;
         } while (true);
       }
       items.add(new Item(i++, shortString, fullString));
     }
   }
   myAllContents = contents;
   FilteringListModel listModel = (FilteringListModel) myList.getModel();
   ((CollectionListModel) listModel.getOriginalModel()).removeAll();
   listModel.addAll(items);
   ListWithFilter listWithFilter = UIUtil.getParentOfType(ListWithFilter.class, myList);
   if (listWithFilter != null) {
     listWithFilter.getSpeedSearch().update();
     if (listModel.getSize() == 0) listWithFilter.resetFilter();
   }
 }