<commit_before>/*
 * Copyright 2000-2008 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.jetbrains.tfsIntegration.ui;

import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
import com.intellij.util.EventDispatcher;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.tfsIntegration.core.tfs.WorkspaceInfo;
import org.jetbrains.tfsIntegration.core.tfs.version.ChangesetVersionSpec;
import org.jetbrains.tfsIntegration.core.tfs.version.LatestVersionSpec;
import org.jetbrains.tfsIntegration.core.tfs.version.VersionSpecBase;
import org.jetbrains.tfsIntegration.exceptions.TfsException;
import org.jetbrains.tfsIntegration.stubs.versioncontrol.repository.BranchRelative;
import org.jetbrains.tfsIntegration.stubs.versioncontrol.repository.Changeset;
import org.jetbrains.tfsIntegration.stubs.versioncontrol.repository.Item;
import org.jetbrains.tfsIntegration.stubs.versioncontrol.repository.MergeCandidate;
import org.jetbrains.tfsIntegration.ui.servertree.ServerBrowserAction;
import org.jetbrains.tfsIntegration.ui.servertree.ServerBrowserDialog;
import org.jetbrains.tfsIntegration.ui.servertree.ServerTree;

import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.util.List;

public class MergeBranchForm {

  public interface Listener extends EventListener {
    void stateChanged(boolean canFinish);
  }

  private enum ChangesType {
    ALL {
      public String toString() {
        return "All changes up to a specific version";
      }},

    SELECTED {
      public String toString() {
        return "Selected changesets";
      }
    }
  }

  private TextFieldWithBrowseButton.NoPathCompletion mySourceField;
  private JComboBox myTargetCombo;
  private JComboBox myChangesTypeCombo;
  private final SelectRevisionForm mySelectRevisionForm;
  private JPanel myContentPanel;
  private JPanel myChangesetsPanel;
  private final Project myProject;
  private final WorkspaceInfo myWorkspace;
  private final JTable myChangesetsTable;
  private final ChangesetsTableModel myChangesetsTableModel;
  private final String myDialogTitle;
  private final EventDispatcher<Listener> myEventDispatcher = EventDispatcher.create(Listener.class);
  private boolean mySourceIsDirectory;
  private final FocusListener mySourceFieldFocusListener;

  public MergeBranchForm(final Project project,
                         final WorkspaceInfo workspace,
                         String initialSourcePath,
                         boolean initialSourcePathIsDirectory,
                         final String dialogTitle) {
    myProject = project;
    myWorkspace = workspace;
    myDialogTitle = dialogTitle;

    myChangesetsTableModel = new ChangesetsTableModel();
    myChangesetsTable = new JTable(myChangesetsTableModel);
    myChangesetsTable.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
    for (int i = 0; i < ChangesetsTableModel.Column.values().length; i++) {
      myChangesetsTable.getColumnModel().getColumn(i).setPreferredWidth(ChangesetsTableModel.Column.values()[i].getWidth());
    }
<commit_msg>JTable->JBTable<commit_after>/*
 * Copyright 2000-2008 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.jetbrains.tfsIntegration.ui;

import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
import com.intellij.ui.table.JBTable;
import com.intellij.util.EventDispatcher;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.tfsIntegration.core.tfs.WorkspaceInfo;
import org.jetbrains.tfsIntegration.core.tfs.version.ChangesetVersionSpec;
import org.jetbrains.tfsIntegration.core.tfs.version.LatestVersionSpec;
import org.jetbrains.tfsIntegration.core.tfs.version.VersionSpecBase;
import org.jetbrains.tfsIntegration.exceptions.TfsException;
import org.jetbrains.tfsIntegration.stubs.versioncontrol.repository.BranchRelative;
import org.jetbrains.tfsIntegration.stubs.versioncontrol.repository.Changeset;
import org.jetbrains.tfsIntegration.stubs.versioncontrol.repository.Item;
import org.jetbrains.tfsIntegration.stubs.versioncontrol.repository.MergeCandidate;
import org.jetbrains.tfsIntegration.ui.servertree.ServerBrowserAction;
import org.jetbrains.tfsIntegration.ui.servertree.ServerBrowserDialog;
import org.jetbrains.tfsIntegration.ui.servertree.ServerTree;

import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.util.List;

public class MergeBranchForm {

  public interface Listener extends EventListener {
    void stateChanged(boolean canFinish);
  }

  private enum ChangesType {
    ALL {
      public String toString() {
        return "All changes up to a specific version";
      }},

    SELECTED {
      public String toString() {
        return "Selected changesets";
      }
    }
  }

  private TextFieldWithBrowseButton.NoPathCompletion mySourceField;
  private JComboBox myTargetCombo;
  private JComboBox myChangesTypeCombo;
  private final SelectRevisionForm mySelectRevisionForm;
  private JPanel myContentPanel;
  private JPanel myChangesetsPanel;
  private final Project myProject;
  private final WorkspaceInfo myWorkspace;
  private final JTable myChangesetsTable;
  private final ChangesetsTableModel myChangesetsTableModel;
  private final String myDialogTitle;
  private final EventDispatcher<Listener> myEventDispatcher = EventDispatcher.create(Listener.class);
  private boolean mySourceIsDirectory;
  private final FocusListener mySourceFieldFocusListener;

  public MergeBranchForm(final Project project,
                         final WorkspaceInfo workspace,
                         String initialSourcePath,
                         boolean initialSourcePathIsDirectory,
                         final String dialogTitle) {
    myProject = project;
    myWorkspace = workspace;
    myDialogTitle = dialogTitle;

    myChangesetsTableModel = new ChangesetsTableModel();
    myChangesetsTable = new JBTable(myChangesetsTableModel);
    myChangesetsTable.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
    for (int i = 0; i < ChangesetsTableModel.Column.values().length; i++) {
      myChangesetsTable.getColumnModel().getColumn(i).setPreferredWidth(ChangesetsTableModel.Column.values()[i].getWidth());
    }

{'fraction_non_alphanumeric': 0.07686264239884771, 'fraction_numerical': 0.0034044781982453844, 'mean_word_length': 4.575182481751825, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '977335', 'n_tokens_mistral': 2141, 'n_tokens_neox': 2076, 'n_words': 506}