in plugin/src/com/microsoft/alm/plugin/idea/tfvc/ui/MergeBranchForm.java [164:271]
public MergeBranchForm(final Project project,
final ServerContext serverContext,
String initialSourcePath,
boolean initialSourcePathIsDirectory,
final String dialogTitle,
final MergeBranchDialog.BranchListProvider branchListProvider) {
this.project = project;
this.serverContext = serverContext;
this.dialogTitle = dialogTitle;
this.branchListProvider = branchListProvider;
sourceBranchLabel.setLabelFor(sourceText.getChildComponent());
//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());
//}
//mySelectRevisionForm = new SelectRevisionForm();
//changesetsPanel.add(mySelectRevisionForm.getPanel(), ChangesType.ALL.toString());
//changesetsPanel.add(ScrollPaneFactory.createScrollPane(myChangesetsTable), ChangesType.SELECTED.toString());
sourceText.setText(initialSourcePath);
mySourceIsDirectory = initialSourcePathIsDirectory;
sourceText.getButton().addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
final ServerBrowserDialog dialog =
new ServerBrowserDialog(TfPluginBundle.message(TfPluginBundle.KEY_TFVC_MERGE_BRANCH_BROWSE_TITLE),
project, serverContext, sourceText.getText(), false, false);
if (dialog.showAndGet()) {
final TfsTreeForm.SelectedItem selectedItem = dialog.getSelectedItem();
sourceText.setText(selectedItem != null ? selectedItem.path : null);
mySourceIsDirectory = selectedItem == null || selectedItem.isDirectory;
}
updateOnSourceChange();
}
});
mySourceFieldFocusListener = new FocusAdapter() {
public void focusLost(final FocusEvent e) {
mySourceIsDirectory = true;
// TODO (JETBRAINS) don't do it on focus out, rather provide a 'Refresh' button
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
updateOnSourceChange();
}
}, ModalityState.current());
}
};
sourceText.getTextField().addFocusListener(mySourceFieldFocusListener);
targetCombo.setModel(new DefaultComboBoxModel());
// targetCombo.setRenderer(new DefaultListCellRenderer() {
// public Component getListCellRendererComponent(final JList list,
// final Object value,
// final int index,
// final boolean isSelected,
// final boolean cellHasFocus) {
// final Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
// if (value != null) {
// Item item = (Item)value;
// setText(item.getItem());
// }
// return c;
// }
// });
targetCombo.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
if (changesTypeCombo.getSelectedItem() == ChangesType.SELECTED) {
updateChangesetsTable();
}
}
});
changesTypeCombo.setModel(new DefaultComboBoxModel(ChangesType.values()));
changesTypeCombo.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
if (changesTypeCombo.getSelectedItem() == ChangesType.SELECTED) {
updateChangesetsTable();
}
((CardLayout) changesetsPanel.getLayout()).show(changesetsPanel, changesTypeCombo.getSelectedItem().toString());
fireStateChanged();
}
});
//myChangesetsTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
// public void valueChanged(final ListSelectionEvent e) {
// fireStateChanged();
// }
//});
//changesTypeCombo.setSelectedIndex(0);
//mySelectRevisionForm.init(project, workspace, initialSourcePath, initialSourcePathIsDirectory);
changesTypeCombo.setVisible(false);
changesToMergePanel.setVisible(false);
// Preinitialize the combo with the branches
updateOnSourceChange();
this.targetCombo.setSelectedItem(null);
}