Esempio n. 1
0
  @Override
  protected void done() {
    try {
      String result = get();

      if (result != null) {
        JOptionPane.showMessageDialog(
            mainPanel, result, "Error opening file", JOptionPane.ERROR_MESSAGE);
      } else {
        JideTabbedPane tabbedPane = mainPanel.getTabbedPane();
        if (tabbedPane != null) {
          if (contentPanel != null) {
            // Already opened!
            tabbedPane.setSelectedComponent(contentPanel);
          } else {
            FolderDiffPanel panel = new FolderDiffPanel(mainPanel, diff);
            panel.setId(contentId);

            tabbedPane.addTab(panel.getTitle(), ImageUtil.getSmallImageIcon("stock_folder"), panel);
            tabbedPane.setSelectedComponent(panel);
          }
        }
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
Esempio n. 2
0
  @Override
  public String doInBackground() {
    if (StringUtil.isEmpty(leftFile.getName())) {
      return "left directoryName is empty";
    }

    if (!leftFile.exists()) {
      return "left directoryName(" + leftFile.getAbsolutePath() + ") doesn't exist";
    }

    if (!leftFile.isDirectory()) {
      return "left directoryName(" + leftFile.getName() + ") is not a directory";
    }

    if (StringUtil.isEmpty(rightFile.getName())) {
      return "right directoryName is empty";
    }

    if (!rightFile.exists()) {
      return "right directoryName(" + rightFile.getAbsolutePath() + ") doesn't exist";
    }

    if (!rightFile.isDirectory()) {
      return "right directoryName(" + rightFile.getName() + ") is not a directory";
    }

    contentId = "FolderDiffPanel:" + leftFile.getName() + "-" + rightFile.getName();
    contentPanel = JMeldPanel.getAlreadyOpen(mainPanel.getTabbedPane(), contentId);
    if (contentPanel == null) {
      diff = new DirectoryDiff(leftFile, rightFile, filter, DirectoryDiff.Mode.TWO_WAY);
      diff.diff();
    }

    return null;
  }