private void rewindToEndActionPerformed( java.awt.event.ActionEvent evt) // GEN-FIRST:event_rewindToEndActionPerformed { // GEN-HEADEREND:event_rewindToEndActionPerformed try { Game activeGame = this.getActiveTabGame(); if (!activeGame.rewindToEnd()) { JOptionPane.showMessageDialog(null, Settings.lang("noMoreUndoMovesInMemory")); } } catch (ArrayIndexOutOfBoundsException exc) { JOptionPane.showMessageDialog(null, Settings.lang("activeTabDoesNotExists")); } catch (UnsupportedOperationException exc) { JOptionPane.showMessageDialog(null, exc.getMessage()); } } // GEN-LAST:event_rewindToEndActionPerformed
public void openLink(String link) { if (WWUtil.isEmpty(link)) return; try { try { // See if the link is a URL, and invoke the browser if it is URL url = new URL(link.replace(" ", "%20")); Desktop.getDesktop().browse(url.toURI()); return; } catch (MalformedURLException ignored) { // just means that the link is not a URL } // It's not a URL, so see if it's a file and invoke the desktop to open it if it is. File file = new File(link); if (file.exists()) { Desktop.getDesktop().open(new File(link)); return; } String message = "Cannot open resource. It's not a valid file or URL."; Util.getLogger().log(Level.SEVERE, message); this.showErrorDialog(null, "No Reconocido V\u00ednculo", message); } catch (UnsupportedOperationException e) { String message = "Unable to open resource.\n" + link + (e.getMessage() != null ? "\n" + e.getMessage() : ""); Util.getLogger().log(Level.SEVERE, message, e); this.showErrorDialog(e, "Error Opening Resource", message); } catch (IOException e) { String message = "I/O error while opening resource.\n" + link + (e.getMessage() != null ? ".\n" + e.getMessage() : ""); Util.getLogger().log(Level.SEVERE, message, e); this.showErrorDialog(e, "I/O Error", message); } catch (Exception e) { String message = "Error attempting to open resource.\n" + link + (e.getMessage() != null ? "\n" + e.getMessage() : ""); Util.getLogger().log(Level.SEVERE, message); this.showMessageDialog(message, "Error Opening Resource", JOptionPane.ERROR_MESSAGE); } }
private void moveBackItemActionPerformed( java.awt.event.ActionEvent evt) // GEN-FIRST:event_moveBackItemActionPerformed { // GEN-HEADEREND:event_moveBackItemActionPerformed if (getGui() != null && getGui().getGame() != null) { getGui().getGame().undo(); } else { try { Game activeGame = this.getActiveTabGame(); if (!activeGame.undo()) { JOptionPane.showMessageDialog(null, Settings.lang("noMoreUndoMovesInMemory")); } } catch (java.lang.ArrayIndexOutOfBoundsException exc) { JOptionPane.showMessageDialog(null, Settings.lang("activeTabDoesNotExists")); } catch (UnsupportedOperationException exc) { JOptionPane.showMessageDialog(null, exc.getMessage()); } } } // GEN-LAST:event_moveBackItemActionPerformed