1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-11-04 08:25:03 -05:00

* ignore double click action if nothing is selected

This commit is contained in:
Reinhard Pointner 2012-08-11 06:48:54 +00:00
parent 23f747c18b
commit b5cdd5fd63

View File

@ -182,8 +182,10 @@ public class RenamePanel extends JComponent {
getWindow(evt.getSource()).setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); getWindow(evt.getSource()).setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
try { try {
JList list = (JList) evt.getSource(); JList list = (JList) evt.getSource();
File item = (File) list.getSelectedValue(); if (list.getSelectedIndex() >= 0) {
Desktop.getDesktop().browse(item.getParentFile().toURI()); File item = (File) list.getSelectedValue();
Desktop.getDesktop().browse(item.getParentFile().toURI());
}
} catch (Exception e) { } catch (Exception e) {
Logger.getLogger(RenamePanel.class.getName()).log(Level.WARNING, e.getMessage()); Logger.getLogger(RenamePanel.class.getName()).log(Level.WARNING, e.getMessage());
} finally { } finally {
@ -201,14 +203,16 @@ public class RenamePanel extends JComponent {
if (evt.getClickCount() == 2) { if (evt.getClickCount() == 2) {
try { try {
JList list = (JList) evt.getSource(); JList list = (JList) evt.getSource();
Object item = ((FormattedFuture) list.getSelectedValue()).getMatch().getValue(); if (list.getSelectedIndex() >= 0) {
if (item instanceof Movie) { Object item = ((FormattedFuture) list.getSelectedValue()).getMatch().getValue();
getWindow(evt.getSource()).setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if (item instanceof Movie) {
Movie m = (Movie) item; getWindow(evt.getSource()).setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
if (m.getTmdbId() > 0) { Movie m = (Movie) item;
Desktop.getDesktop().browse(WebServices.TMDb.getMoviePageLink(m.getTmdbId())); if (m.getTmdbId() > 0) {
} else if (m.getImdbId() > 0) { Desktop.getDesktop().browse(WebServices.TMDb.getMoviePageLink(m.getTmdbId()));
Desktop.getDesktop().browse(WebServices.IMDb.getMoviePageLink(m.getImdbId())); } else if (m.getImdbId() > 0) {
Desktop.getDesktop().browse(WebServices.IMDb.getMoviePageLink(m.getImdbId()));
}
} }
} }
} catch (Exception e) { } catch (Exception e) {