@Override
 protected void doOKAction() {
   final String errorString = myComponent.canCreateAllFilesForAllLocales();
   if (errorString != null) {
     Messages.showErrorDialog(getContentPanel(), errorString);
   } else {
     final List<PsiFile> createFiles = myComponent.createPropertiesFiles();
     myCreatedFiles = createFiles.toArray(new PsiElement[createFiles.size()]);
     super.doOKAction();
   }
 }
    public void restore(BreakpointTree tree) {
      final List<TreePath> pathsToExpand = getPaths(tree, myExpandedUserObjects);
      if (!pathsToExpand.isEmpty()) {
        TreeUtil.restoreExpandedPaths(tree, pathsToExpand);
      }

      final List<TreePath> pathsToSelect = getPaths(tree, mySelectedUserObjects);
      if (!pathsToSelect.isEmpty()) {
        tree.getSelectionModel().clearSelection();
        tree.setSelectionPaths(pathsToSelect.toArray(new TreePath[pathsToSelect.size()]));
      }
    }
 public Breakpoint[] getSelectedBreakpoints() {
   final TreePath[] selectionPaths = getSelectionPaths();
   if (selectionPaths == null || selectionPaths.length == 0) {
     return Breakpoint.EMPTY_ARRAY;
   }
   final List<Breakpoint> breakpoints = new ArrayList<Breakpoint>(selectionPaths.length);
   for (TreePath path : selectionPaths) {
     final CheckedTreeNode node = (CheckedTreeNode) path.getLastPathComponent();
     TreeUtil.traverseDepth(
         node,
         new TreeUtil.Traverse() {
           public boolean accept(Object _node) {
             final CheckedTreeNode node = (CheckedTreeNode) _node;
             final TreeDescriptor descriptor = (TreeDescriptor) node.getUserObject();
             if (descriptor instanceof BreakpointDescriptor) {
               breakpoints.add(((BreakpointDescriptor) descriptor).getBreakpoint());
             }
             return true;
           }
         });
   }
   return breakpoints.toArray(new Breakpoint[breakpoints.size()]);
 }
 public TreeStateSnapshot(BreakpointTree tree) {
   final List<TreePath> expandedPaths = TreeUtil.collectExpandedPaths(tree);
   myExpandedUserObjects =
       getUserObjects(expandedPaths.toArray(new TreePath[expandedPaths.size()]));
   mySelectedUserObjects = getUserObjects(tree.getSelectionPaths());
 }
  private void updateDirectories(boolean updateFileCombo) {
    final Module module = getModule();
    List<VirtualFile> valuesDirs = Collections.emptyList();

    if (module != null) {
      final AndroidFacet facet = AndroidFacet.getInstance(module);

      if (facet != null) {
        myResourceDir = AndroidRootUtil.getResourceDir(facet);

        if (myResourceDir != null) {
          valuesDirs =
              AndroidResourceUtil.getResourceSubdirs(
                  ResourceFolderType.VALUES.getName(), new VirtualFile[] {myResourceDir});
        }
      }
    }

    Collections.sort(
        valuesDirs,
        new Comparator<VirtualFile>() {
          @Override
          public int compare(VirtualFile f1, VirtualFile f2) {
            return f1.getName().compareTo(f2.getName());
          }
        });

    final Map<String, JCheckBox> oldCheckBoxes = myCheckBoxes;
    final int selectedIndex = myDirectoriesList.getSelectedIndex();
    final String selectedDirName = selectedIndex >= 0 ? myDirNames[selectedIndex] : null;

    final List<JCheckBox> checkBoxList = new ArrayList<JCheckBox>();
    myCheckBoxes = new HashMap<String, JCheckBox>();
    myDirNames = new String[valuesDirs.size()];

    int newSelectedIndex = -1;

    int i = 0;

    for (VirtualFile dir : valuesDirs) {
      final String dirName = dir.getName();
      final JCheckBox oldCheckBox = oldCheckBoxes.get(dirName);
      final boolean selected = oldCheckBox != null && oldCheckBox.isSelected();
      final JCheckBox checkBox = new JCheckBox(dirName, selected);
      checkBoxList.add(checkBox);
      myCheckBoxes.put(dirName, checkBox);
      myDirNames[i] = dirName;

      if (dirName.equals(selectedDirName)) {
        newSelectedIndex = i;
      }
      i++;
    }
    myDirectoriesList.setModel(new CollectionListModel<JCheckBox>(checkBoxList));

    if (newSelectedIndex >= 0) {
      myDirectoriesList.setSelectedIndex(newSelectedIndex);
    }

    if (checkBoxList.size() == 1) {
      checkBoxList.get(0).setSelected(true);
    }

    if (updateFileCombo) {
      final Object oldItem = myFileNameCombo.getEditor().getItem();
      final Set<String> fileNameSet = new HashSet<String>();

      for (VirtualFile valuesDir : valuesDirs) {
        for (VirtualFile file : valuesDir.getChildren()) {
          fileNameSet.add(file.getName());
        }
      }
      final List<String> fileNames = new ArrayList<String>(fileNameSet);
      Collections.sort(fileNames);
      myFileNameCombo.setModel(new DefaultComboBoxModel(fileNames.toArray()));
      myFileNameCombo.getEditor().setItem(oldItem);
    }
  }