}
public void displayScratchesListPopup(List<Scratch> scratches, final UserDataHolder userDataHolder) {
ScratchListPopupStep popupStep = new ScratchListPopupStep(scratches, takeProjectFrom(userDataHolder));
popupStep.setDefaultOptionIndex(scratchListSelectedIndex);
ScratchListPopup popup = new ScratchListPopup(popupStep) {
@Override protected void onNewScratch() {
SwingUtilities.invokeLater(new Runnable() {
@Override public void run() {
mrScratchManager().userWantsToEnterNewScratchName(userDataHolder);
}
});
}
@Override protected void onRenameScratch(final Scratch scratch) {
SwingUtilities.invokeLater(new Runnable() {
@Override public void run() {
mrScratchManager().userWantsToEditScratchName(scratch);
}
});
}
@Override protected void onScratchDelete(Scratch scratch) {
mrScratchManager().userAttemptedToDeleteScratch(scratch);
}
@Override protected void onScratchDeleteWithoutPrompt(Scratch scratch) {
mrScratchManager().userWantsToDeleteScratch(scratch);
}
@Override protected void onScratchMoved(Scratch scratch, int shift) {
mrScratchManager().userMovedScratch(scratch, shift);
}
@Override public void dispose() {
scratchListSelectedIndex = getSelectedIndex();
super.dispose();
}
};
popup.showCenteredInCurrentWindow(takeProjectFrom(userDataHolder));
}