use of com.intellij.util.ui.AdjustComponentWhenShown in project intellij-community by JetBrains.
the class ChangesBrowserDialog method initDialog.
private void initDialog(final Project project, final CommittedChangesTableModel changes, final Mode mode) {
myProject = project;
myChanges = changes;
myMode = mode;
setTitle(VcsBundle.message("dialog.title.changes.browser"));
setCancelButtonText(CommonBundle.getCloseButtonText());
final ModalityState currentState = ModalityState.current();
if ((mode != Mode.Choose) && (ModalityState.NON_MODAL.equals(currentState))) {
setModal(false);
}
myAppender = new AsynchConsumer<List<CommittedChangeList>>() {
public void finished() {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
if (ChangesBrowserDialog.this.isShowing()) {
myCommittedChangesBrowser.stopLoading();
}
}
});
}
public void consume(final List<CommittedChangeList> committedChangeLists) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
if (ChangesBrowserDialog.this.isShowing()) {
final boolean selectFirst = (myChanges.getRowCount() == 0) && (!committedChangeLists.isEmpty());
myChanges.addRows(committedChangeLists);
if (selectFirst) {
myCommittedChangesBrowser.selectFirstIfAny();
}
}
}
});
}
};
init();
if (myInitRunnable != null) {
new AdjustComponentWhenShown() {
@Override
protected boolean init() {
myInitRunnable.consume(ChangesBrowserDialog.this);
return true;
}
}.install(myCommittedChangesBrowser);
}
}
Aggregations