Dialogs throw exceptions if the get closed by the user

git-svn-id: svn://svn.jdownloader.org/jdownloader/trunk@13297 ebf7c1c2-ba36-0410-9fe8-c592906822b4
This commit is contained in:
coalado 2011-01-11 14:34:27 +00:00
parent 3e862d51d4
commit 13116a3d0f
21 changed files with 682 additions and 104 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry excluding="jd/plugins/optional/neembuu/|jd/plugins/optional/remoteserv/" kind="src" path="src"/>
<classpathentry excluding="jd/plugins/optional/neembuu/|jd/plugins/optional/remoteserv/|jd/plugins/optional/remoteserv/" kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes>
<attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="jd/ressourcen/libs/dbus"/>

22
src/DNS.java Normal file
View File

@ -0,0 +1,22 @@
import java.net.InetAddress;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.UnknownHostException;
public class DNS {
/**
* @param args
* @throws UnknownHostException
* @throws MalformedURLException
*/
public static void main(final String[] args) throws UnknownHostException, MalformedURLException {
final URL url = new URL(args[0]);
final InetAddress inetAddress = InetAddress.getByName(url.getHost());
System.out.println("getHostAddress " + inetAddress.getHostAddress());
System.out.println("getHostAddress " + inetAddress.getHostName());
}
}

316
src/jd/DDETimeUI.java Normal file
View File

@ -0,0 +1,316 @@
package jd;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/*
* DDETimeUI.java
*
* Created on Nov 18, 2010, 9:10:29 PM
*/
/**
*
* @author deek
*/
public class DDETimeUI extends javax.swing.JFrame {
/**
* @param args
* the command line arguments
*/
public static void main(final String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new DDETimeUI().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JScrollPane PrimaryScrollPanel;
private javax.swing.JMenuItem createRecord;
private javax.swing.JPanel createRecordPanel;
private javax.swing.JPanel defaultPanel;
private javax.swing.JMenuItem generateReport;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel16;
private javax.swing.JLabel jLabel17;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JMenuBar jLoggedMenu;
private javax.swing.JMenu jMenu1;
private javax.swing.JMenu jMenu2;
private javax.swing.JMenu jMenu3;
private javax.swing.JMenu jMenu4;
private javax.swing.JMenu jMenu5;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JMenuItem jMenuItem1;
private javax.swing.JMenuItem jMenuItem2;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextArea jTextArea1;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField10;
private javax.swing.JTextField jTextField11;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField3;
private javax.swing.JTextField jTextField4;
private javax.swing.JTextField jTextField5;
private javax.swing.JTextField jTextField6;
private javax.swing.JTextField jTextField7;
private javax.swing.JTextField jTextField8;
private javax.swing.JTextField jTextField9;
private javax.swing.JPanel loginPanel;
private javax.swing.JPasswordField passWord;
private javax.swing.JMenuItem searchRecords;
private javax.swing.JTextField userName;
// End of variables declaration
/** Creates new form DDETimeUI */
public DDETimeUI() {
initComponents();
}
private void createRecordMouseReleased(final java.awt.event.MouseEvent evt) {
PrimaryScrollPanel.setViewportView(createRecordPanel);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
createRecordPanel = new javax.swing.JPanel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
jLabel9 = new javax.swing.JLabel();
jLabel10 = new javax.swing.JLabel();
jLabel11 = new javax.swing.JLabel();
jLabel12 = new javax.swing.JLabel();
jLabel13 = new javax.swing.JLabel();
jLabel14 = new javax.swing.JLabel();
jLabel15 = new javax.swing.JLabel();
jLabel16 = new javax.swing.JLabel();
jLabel17 = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
jTextField1 = new javax.swing.JTextField();
jTextField2 = new javax.swing.JTextField();
jTextField3 = new javax.swing.JTextField();
jTextField4 = new javax.swing.JTextField();
jTextField5 = new javax.swing.JTextField();
jTextField6 = new javax.swing.JTextField();
jTextField7 = new javax.swing.JTextField();
jTextField8 = new javax.swing.JTextField();
jTextField9 = new javax.swing.JTextField();
jTextField10 = new javax.swing.JTextField();
jTextField11 = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
defaultPanel = new javax.swing.JPanel();
jLoggedMenu = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();
jMenu2 = new javax.swing.JMenu();
createRecord = new javax.swing.JMenuItem();
searchRecords = new javax.swing.JMenuItem();
jMenu3 = new javax.swing.JMenu();
generateReport = new javax.swing.JMenuItem();
jMenu4 = new javax.swing.JMenu();
jMenuItem1 = new javax.swing.JMenuItem();
PrimaryScrollPanel = new javax.swing.JScrollPane();
loginPanel = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
userName = new javax.swing.JTextField();
passWord = new javax.swing.JPasswordField();
jButton3 = new javax.swing.JButton();
jMenuBar1 = new javax.swing.JMenuBar();
jMenu5 = new javax.swing.JMenu();
jMenuItem2 = new javax.swing.JMenuItem();
createRecordPanel.setPreferredSize(new java.awt.Dimension(657, 368));
jLabel3.setFont(new java.awt.Font("Tahoma", 1, 14));
jLabel3.setText("Record Name");
jLabel4.setText("Time Code");
jLabel5.setText("Assigner");
jLabel6.setText("Start Date");
jLabel7.setText("End Date");
jLabel8.setText("Case Numbers");
jLabel9.setText("Siebel");
jLabel10.setText("Hydra");
jLabel11.setText("QQ");
jLabel12.setText("Maestro");
jLabel13.setText("Hours");
jLabel14.setText("Business");
jLabel15.setText("Night");
jLabel16.setText("Weekend");
jLabel17.setText("Comments");
jTextArea1.setColumns(20);
jTextArea1.setRows(5);
jScrollPane1.setViewportView(jTextArea1);
jButton1.setText("Submit");
jButton2.setText("Cancel");
final javax.swing.GroupLayout createRecordPanelLayout = new javax.swing.GroupLayout(createRecordPanel);
createRecordPanel.setLayout(createRecordPanelLayout);
createRecordPanelLayout.setHorizontalGroup(createRecordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(
createRecordPanelLayout
.createSequentialGroup()
.addGroup(
createRecordPanelLayout
.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(createRecordPanelLayout.createSequentialGroup().addComponent(jLabel3).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 303, Short.MAX_VALUE).addComponent(jLabel8))
.addComponent(jLabel17)
.addGroup(
createRecordPanelLayout
.createSequentialGroup()
.addGroup(
createRecordPanelLayout
.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(
createRecordPanelLayout.createSequentialGroup().addGap(25, 25, 25).addGroup(createRecordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jLabel4).addComponent(jLabel5).addComponent(jLabel6).addComponent(jLabel7)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(createRecordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false).addComponent(jTextField2).addComponent(jTextField3).addComponent(jTextField4, javax.swing.GroupLayout.DEFAULT_SIZE, 124, Short.MAX_VALUE).addComponent(jTextField1)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 80, Short.MAX_VALUE)
.addGroup(createRecordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING).addComponent(jLabel12).addComponent(jLabel11).addComponent(jLabel10).addComponent(jLabel9))).addGroup(javax.swing.GroupLayout.Alignment.LEADING, createRecordPanelLayout.createSequentialGroup().addGap(27, 27, 27).addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 302, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(createRecordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(createRecordPanelLayout.createSequentialGroup().addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addGroup(createRecordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false).addComponent(jTextField8, javax.swing.GroupLayout.DEFAULT_SIZE, 125, Short.MAX_VALUE).addComponent(jTextField7).addComponent(jTextField6, javax.swing.GroupLayout.DEFAULT_SIZE, 125, Short.MAX_VALUE).addComponent(jTextField5))).addGroup(createRecordPanelLayout.createSequentialGroup().addGap(24, 24, 24).addGroup(createRecordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jButton2).addComponent(jButton1)))))
.addGroup(
createRecordPanelLayout.createSequentialGroup()
.addGroup(createRecordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING).addGroup(javax.swing.GroupLayout.Alignment.LEADING, createRecordPanelLayout.createSequentialGroup().addGroup(createRecordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jLabel16).addComponent(jLabel14).addComponent(jLabel15)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addGroup(createRecordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false).addComponent(jTextField9).addComponent(jTextField11).addComponent(jTextField10, javax.swing.GroupLayout.DEFAULT_SIZE, 67, Short.MAX_VALUE))).addGroup(javax.swing.GroupLayout.Alignment.LEADING, createRecordPanelLayout.createSequentialGroup().addGap(82, 82, 82).addComponent(jLabel13)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 347, Short.MAX_VALUE))).addContainerGap()));
createRecordPanelLayout.setVerticalGroup(createRecordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(
createRecordPanelLayout.createSequentialGroup().addGroup(createRecordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel3).addComponent(jLabel8)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(createRecordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel4).addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel9).addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(createRecordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel5).addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel10).addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(createRecordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel6).addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel11).addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(createRecordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel7).addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel12).addComponent(jTextField8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addGap(18, 18, 18).addComponent(jLabel13).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(createRecordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel14).addComponent(jTextField9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(createRecordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel15).addComponent(jTextField11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(createRecordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel16).addComponent(jTextField10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel17).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(createRecordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addGroup(createRecordPanelLayout.createSequentialGroup().addComponent(jButton1).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jButton2))).addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
final javax.swing.GroupLayout defaultPanelLayout = new javax.swing.GroupLayout(defaultPanel);
defaultPanel.setLayout(defaultPanelLayout);
defaultPanelLayout.setHorizontalGroup(defaultPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 155, Short.MAX_VALUE));
defaultPanelLayout.setVerticalGroup(defaultPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 138, Short.MAX_VALUE));
jMenu1.setText("File");
jLoggedMenu.add(jMenu1);
jMenu2.setText("Time");
createRecord.setText("Create Record");
createRecord.addMouseListener(new java.awt.event.MouseAdapter() {
@Override
public void mouseReleased(final java.awt.event.MouseEvent evt) {
createRecordMouseReleased(evt);
}
});
jMenu2.add(createRecord);
searchRecords.setText("Search Records");
jMenu2.add(searchRecords);
jLoggedMenu.add(jMenu2);
jMenu3.setText("Reports");
generateReport.setText("Generate Report");
jMenu3.add(generateReport);
jLoggedMenu.add(jMenu3);
jMenu4.setText("Admin");
jMenuItem1.setText("Build Workgroup");
jMenu4.add(jMenuItem1);
jLoggedMenu.add(jMenu4);
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setText("User Name");
jLabel2.setText("Password");
jButton3.setText("Login");
jButton3.addMouseListener(new java.awt.event.MouseAdapter() {
@Override
public void mouseReleased(final java.awt.event.MouseEvent evt) {
jButton3MouseReleased(evt);
}
});
final javax.swing.GroupLayout loginPanelLayout = new javax.swing.GroupLayout(loginPanel);
loginPanel.setLayout(loginPanelLayout);
loginPanelLayout.setHorizontalGroup(loginPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(loginPanelLayout.createSequentialGroup().addGap(81, 81, 81).addGroup(loginPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false).addGroup(loginPanelLayout.createSequentialGroup().addComponent(jLabel1).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(userName, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE)).addGroup(loginPanelLayout.createSequentialGroup().addComponent(jLabel2).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addGroup(loginPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jButton3).addComponent(passWord)))).addContainerGap(137, Short.MAX_VALUE)));
loginPanelLayout.setVerticalGroup(loginPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(loginPanelLayout.createSequentialGroup().addGap(83, 83, 83).addGroup(loginPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel1).addComponent(userName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(loginPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel2).addComponent(passWord, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addGap(18, 18, 18).addComponent(jButton3).addContainerGap(107, Short.MAX_VALUE)));
PrimaryScrollPanel.setViewportView(loginPanel);
jMenu5.setText("File");
jMenuItem2.setText("Log-In");
jMenu5.add(jMenuItem2);
jMenuBar1.add(jMenu5);
setJMenuBar(jMenuBar1);
final javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(PrimaryScrollPanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE));
layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(PrimaryScrollPanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 274, Short.MAX_VALUE));
pack();
}// </editor-fold>
private void jButton3MouseReleased(final java.awt.event.MouseEvent evt) {
PrimaryScrollPanel.setViewportView(defaultPanel);
setJMenuBar(jLoggedMenu);
// repaint();
}
}

View File

@ -62,6 +62,8 @@ import jd.utils.locale.JDL;
import org.appwork.utils.swing.dialog.ConfirmDialog;
import org.appwork.utils.swing.dialog.Dialog;
import org.appwork.utils.swing.dialog.DialogCanceledException;
import org.appwork.utils.swing.dialog.DialogClosedException;
import org.lobobrowser.util.OS;
/**
@ -255,7 +257,13 @@ public class JDInit {
}
});
Dialog.getInstance().showDialog(dialog);
try {
Dialog.getInstance().showDialog(dialog);
} catch (DialogClosedException e1) {
} catch (DialogCanceledException e1) {
}
}
}
this.submitVersion();

View File

@ -12,6 +12,8 @@ import org.appwork.utils.Hash;
import org.appwork.utils.locale.Loc;
import org.appwork.utils.swing.dialog.ConfirmDialog;
import org.appwork.utils.swing.dialog.Dialog;
import org.appwork.utils.swing.dialog.DialogCanceledException;
import org.appwork.utils.swing.dialog.DialogClosedException;
/**
* Checks files and resources, if they are valid. If not, user is asked if he
@ -31,8 +33,8 @@ public class CodeVerifier {
TRUSTED;
}
private final Storage storage;
private final Browser br;
private final Storage storage;
private final Browser br;
private static final CodeVerifier INSTANCE = new CodeVerifier();
@ -89,18 +91,15 @@ public class CodeVerifier {
}
};
Integer ret = Dialog.getInstance().showDialog(dialog);
// ask again!!
if (Dialog.isOK(ret)) {
Integer ret;
try {
ret = Dialog.getInstance().showDialog(dialog);
ret = Dialog.getInstance().showConfirmDialog(0, Loc.LF("jd.controlling.CodeVerifier.isJarAllowed.rlymessage", "The untrusted file %s will be loaded now.\r\nAre you sure that you want to load this file?", file.getName()));
if (Dialog.isOK(ret)) {
state = State.USER_DECIDED_TRUSTED;
this.storage.put(hash, state);
} else {
state = State.USER_DECIDED_NOT_TRUSTED;
}
} else {
} catch (DialogClosedException e) {
state = State.USER_DECIDED_NOT_TRUSTED;
this.storage.put(hash, state);
} catch (DialogCanceledException e) {
state = State.USER_DECIDED_NOT_TRUSTED;
this.storage.put(hash, state);
}

View File

@ -152,6 +152,7 @@ public class ReconnectPluginConfigGUI extends SwitchPanel implements ActionListe
@Override
protected void onHide() {
}
@Override

View File

@ -38,6 +38,8 @@ import org.appwork.utils.logging.Log;
import org.appwork.utils.os.CrossSystem;
import org.appwork.utils.swing.dialog.ConfirmDialog;
import org.appwork.utils.swing.dialog.Dialog;
import org.appwork.utils.swing.dialog.DialogCanceledException;
import org.appwork.utils.swing.dialog.DialogClosedException;
import org.appwork.utils.swing.dialog.ProgressDialog;
import org.appwork.utils.swing.dialog.ProgressDialog.ProgressGetter;
@ -144,7 +146,13 @@ public class ReconnectPluginController {
}
});
if (!Dialog.isOK(Dialog.getInstance().showDialog(cDialog))) { return; }
try {
Dialog.getInstance().showDialog(cDialog);
} catch (DialogClosedException e2) {
return;
} catch (DialogCanceledException e2) {
return;
}
// save plugin to restore it later
final RouterPlugin restore = this.getActivePlugin();
final ProgressDialog dialog = new ProgressDialog(new ProgressGetter() {
@ -197,11 +205,23 @@ public class ReconnectPluginController {
}, 0, Loc.L("jd.controlling.reconnect.ReconnectPluginController.autoFind.title", "Reconnect Wizard"), Loc.L("jd.controlling.reconnect.ReconnectPluginController.autoFind.progressdialog.message", "JDownloader now tries to find the correct settings to perform a reconnect.\r\nThis might take a few minutes. Please be patient!"), null);
Dialog.getInstance().showDialog(dialog);
try {
Dialog.getInstance().showDialog(dialog);
} catch (DialogClosedException e2) {
e2.printStackTrace();
} catch (DialogCanceledException e2) {
e2.printStackTrace();
}
if (this.getActivePlugin() != DummyRouterPlugin.getInstance()) {
Dialog.getInstance().showConfirmDialog(Dialog.BUTTONS_HIDE_CANCEL, Loc.L("jd.controlling.reconnect.ReconnectPluginController.autoFind.title", "Reconnect Wizard"), Loc.LF("jd.controlling.reconnect.ReconnectPluginController.autoFind.success", "Successfull!\r\nJDownloader performs the reconnect by using '%s'.", this.getActivePlugin().getName()), JDTheme.II("gui.images.ok", 32, 32), null, null);
try {
Dialog.getInstance().showConfirmDialog(Dialog.BUTTONS_HIDE_CANCEL, Loc.L("jd.controlling.reconnect.ReconnectPluginController.autoFind.title", "Reconnect Wizard"), Loc.LF("jd.controlling.reconnect.ReconnectPluginController.autoFind.success", "Successfull!\r\nJDownloader performs the reconnect by using '%s'.", this.getActivePlugin().getName()), JDTheme.II("gui.images.ok", 32, 32), null, null);
} catch (DialogClosedException e1) {
e1.printStackTrace();
} catch (DialogCanceledException e1) {
e1.printStackTrace();
}
} else {
this.setActivePlugin(restore);
@ -221,7 +241,13 @@ public class ReconnectPluginController {
});
Dialog.getInstance().showDialog(conDialog);
try {
Dialog.getInstance().showDialog(conDialog);
} catch (DialogClosedException e1) {
e1.printStackTrace();
} catch (DialogCanceledException e1) {
e1.printStackTrace();
}
}
}

View File

@ -15,6 +15,9 @@ import net.miginfocom.swing.MigLayout;
import org.appwork.utils.swing.dialog.ContainerDialog;
import org.appwork.utils.swing.dialog.Dialog;
import org.appwork.utils.swing.dialog.DialogCanceledException;
import org.appwork.utils.swing.dialog.DialogClosedException;
import org.appwork.utils.swing.dialog.DialogNoAnswerException;
public class LiveHeaderDetectionWizard {
@ -66,29 +69,32 @@ public class LiveHeaderDetectionWizard {
final ContainerDialog routerInfo = new ContainerDialog(0, "Enter Router Information", p, null, "Continue", null);
if (Dialog.isOK(Dialog.getInstance().showDialog(routerInfo))) {
try {
Dialog.getInstance().showDialog(routerInfo);
} catch (DialogNoAnswerException e) {
e.printStackTrace();
}
try {
if (this.txtUser.getText().trim().length() < 2 || this.txtPass.getText().trim().length() < 2) {
if (!Dialog.isOK(Dialog.getInstance().showConfirmDialog(0, "Warning", "Username and Password are not set. In most cases, \r\nthese information is required for a successfull reconnection.\r\n\r\nContinue anyway?"))) {
continue;
}
Dialog.getInstance().showConfirmDialog(0, "Warning", "Username and Password are not set. In most cases, \r\nthese information is required for a successfull reconnection.\r\n\r\nContinue anyway?");
}
if (!RouterUtils.checkPort(this.txtIP.getText().trim(), 80)) {
if (!Dialog.isOK(Dialog.getInstance().showConfirmDialog(0, "Warning", "There is no Webinterface at http://" + this.txtIP.getText() + "\r\nAre you sure that the Router IP is correct?\r\nA correct Router IP is required to find the correct settings.\r\n\r\nContinue anyway?"))) {
continue;
}
Dialog.getInstance().showConfirmDialog(0, "Warning", "There is no Webinterface at http://" + this.txtIP.getText() + "\r\nAre you sure that the Router IP is correct?\r\nA correct Router IP is required to find the correct settings.\r\n\r\nContinue anyway?");
}
ret = this.scanOfflineRouters(".*" + this.txtName.getText().trim().toLowerCase().replaceAll("\\W", ".*?") + ".*", ".*" + this.txtManufactor.getText().trim().toLowerCase().replaceAll("\\W", ".*?") + ".*");
if (ret <= 0) {
if (Dialog.isOK(Dialog.getInstance().showConfirmDialog(0, "Warning", "Could not find correct settings based on your inputs?\r\n\r\nTry again?"))) {
continue;
} else {
return -1;
}
Dialog.getInstance().showConfirmDialog(0, "Warning", "Could not find correct settings based on your inputs?\r\n\r\nTry again?");
} else {
return ret;
}
} catch (DialogClosedException e) {
return -1;
} catch (DialogCanceledException e) {
continue;
}
return -1;

View File

@ -59,6 +59,8 @@ import org.appwork.utils.logging.Log;
import org.appwork.utils.swing.EDTRunner;
import org.appwork.utils.swing.TextComponentChangeListener;
import org.appwork.utils.swing.dialog.Dialog;
import org.appwork.utils.swing.dialog.DialogCanceledException;
import org.appwork.utils.swing.dialog.DialogClosedException;
import org.appwork.utils.swing.dialog.InputDialog;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
@ -141,7 +143,13 @@ public class LiveHeaderReconnect extends RouterPlugin implements ActionListener,
} catch (final Exception e) {
e.printStackTrace();
Dialog.getInstance().showErrorDialog(e.getMessage());
try {
Dialog.getInstance().showErrorDialog(e.getMessage());
} catch (DialogClosedException e1) {
e1.printStackTrace();
} catch (DialogCanceledException e1) {
e1.printStackTrace();
}
RouterSender.getInstance().setRequested(false);
// do not ask in this session again
dosession = false;
@ -168,7 +176,13 @@ public class LiveHeaderReconnect extends RouterPlugin implements ActionListener,
RouterSender.getInstance().run();
} catch (final Exception e) {
Dialog.getInstance().showErrorDialog(e.getMessage());
try {
Dialog.getInstance().showErrorDialog(e.getMessage());
} catch (DialogClosedException e1) {
e1.printStackTrace();
} catch (DialogCanceledException e1) {
e1.printStackTrace();
}
}
}
}.start();
@ -357,7 +371,8 @@ public class LiveHeaderReconnect extends RouterPlugin implements ActionListener,
public void actionPerformed(final ActionEvent e) {
final ImportRouterDialog importDialog = new ImportRouterDialog(LiveHeaderReconnect.getLHScripts());
if (Dialog.isOK(Dialog.getInstance().showDialog(importDialog))) {
try {
Dialog.getInstance().showDialog(importDialog);
final String[] data = importDialog.getResult();
if (data != null) {
@ -370,6 +385,10 @@ public class LiveHeaderReconnect extends RouterPlugin implements ActionListener,
LiveHeaderReconnect.this.setRouterName(data[0] + " - " + data[1]);
}
} catch (DialogClosedException e1) {
e1.printStackTrace();
} catch (DialogCanceledException e1) {
e1.printStackTrace();
}
}
@ -381,20 +400,35 @@ public class LiveHeaderReconnect extends RouterPlugin implements ActionListener,
final InputDialog clrDialog = new InputDialog(Dialog.STYLE_LARGE | Dialog.STYLE_HIDE_ICON, "CLR Import", "Please enter a Liveheader script below.", "", null, null, null);
clrDialog.setPreferredSize(new Dimension(500, 400));
final String clr = Dialog.getInstance().showDialog(clrDialog);
if (clr == null) { return; }
try {
final String clr = Dialog.getInstance().showDialog(clrDialog);
if (clr == null) { return; }
final String[] ret = CLRConverter.createLiveHeader(clr);
if (ret != null) {
LiveHeaderReconnect.this.setRouterName(ret[0]);
dialog.setDefaultMessage(ret[1]);
final String[] ret = CLRConverter.createLiveHeader(clr);
if (ret != null) {
LiveHeaderReconnect.this.setRouterName(ret[0]);
dialog.setDefaultMessage(ret[1]);
}
} catch (DialogClosedException e1) {
e1.printStackTrace();
} catch (DialogCanceledException e1) {
e1.printStackTrace();
}
}
});
final String newScript = Dialog.getInstance().showDialog(dialog);
if (newScript != null) {
this.setScript(newScript);
String newScript;
try {
newScript = Dialog.getInstance().showDialog(dialog);
if (newScript != null) {
this.setScript(newScript);
}
} catch (DialogClosedException e1) {
e1.printStackTrace();
} catch (DialogCanceledException e1) {
e1.printStackTrace();
}
}
private void findIP() {
@ -867,21 +901,28 @@ public class LiveHeaderReconnect extends RouterPlugin implements ActionListener,
public Object runSave() {
final Gui jd = new Gui(LiveHeaderReconnect.this.getRouterIP());
Dialog.getInstance().showDialog(jd);
if (jd.saved) {
LiveHeaderReconnect.this.setRouterIP(jd.ip);
try {
Dialog.getInstance().showDialog(jd);
if (jd.saved) {
LiveHeaderReconnect.this.setRouterIP(jd.ip);
if (jd.user != null) {
LiveHeaderReconnect.this.setUser(jd.user);
}
if (jd.pass != null) {
LiveHeaderReconnect.this.setPassword(jd.pass);
if (jd.user != null) {
LiveHeaderReconnect.this.setUser(jd.user);
}
if (jd.pass != null) {
LiveHeaderReconnect.this.setPassword(jd.pass);
}
LiveHeaderReconnect.this.setScript(jd.methode);
setName("Router Recorder Custom Script");
}
LiveHeaderReconnect.this.setScript(jd.methode);
setName("Router Recorder Custom Script");
} catch (DialogClosedException e) {
e.printStackTrace();
} catch (DialogCanceledException e) {
e.printStackTrace();
}
return null;
}

View File

@ -44,6 +44,8 @@ import org.appwork.utils.Hash;
import org.appwork.utils.locale.Loc;
import org.appwork.utils.swing.dialog.ContainerDialog;
import org.appwork.utils.swing.dialog.Dialog;
import org.appwork.utils.swing.dialog.DialogCanceledException;
import org.appwork.utils.swing.dialog.DialogClosedException;
import org.appwork.utils.swing.dialog.ProgressDialog;
import org.appwork.utils.swing.dialog.ProgressDialog.ProgressGetter;
@ -153,7 +155,13 @@ public class RouterSender {
but.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
Dialog.getInstance().showMessageDialog(0, name + ":" + tooltip, dialog);
try {
Dialog.getInstance().showMessageDialog(0, name + ":" + tooltip, dialog);
} catch (DialogClosedException e1) {
e1.printStackTrace();
} catch (DialogCanceledException e1) {
e1.printStackTrace();
}
}
});
@ -171,7 +179,15 @@ public class RouterSender {
*/
private String choose(final String routerName2, final String upnpName, final String what) {
final String[] options = new String[] { routerName2, upnpName };
final int ret = Dialog.getInstance().showComboDialog(Dialog.STYLE_HIDE_ICON, "Choose correct " + what, "Please choose the correct " + what, options, 0, null, null, null, null);
int ret;
try {
ret = Dialog.getInstance().showComboDialog(Dialog.STYLE_HIDE_ICON, "Choose correct " + what, "Please choose the correct " + what, options, 0, null, null, null, null);
} catch (DialogClosedException e) {
return routerName2;
} catch (DialogCanceledException e) {
return routerName2;
}
if (ret < 0) { return routerName2; }
return options[ret];
@ -473,7 +489,13 @@ public class RouterSender {
}
}, 0, Loc.L("jd.controlling.reconnect.plugins.upnp.UPNPRouterPlugin.actionPerformed.wizard.title", "UPNP Router Wizard"), Loc.L("jd.controlling.reconnect.plugins.upnp.UPNPRouterPlugin.actionPerformed.wizard.find.message", "Scanning all network interfaces"), null);
Dialog.getInstance().showDialog(dialog);
try {
Dialog.getInstance().showDialog(dialog);
} catch (DialogClosedException e) {
e.printStackTrace();
} catch (DialogCanceledException e) {
e.printStackTrace();
}
}
for (final UpnpRouterDevice d : this.devices) {

View File

@ -47,6 +47,8 @@ import net.miginfocom.swing.MigLayout;
import org.appwork.utils.swing.dialog.AbstractDialog;
import org.appwork.utils.swing.dialog.Dialog;
import org.appwork.utils.swing.dialog.DialogCanceledException;
import org.appwork.utils.swing.dialog.DialogClosedException;
public class Gui extends AbstractDialog<Object> {
@ -332,7 +334,13 @@ public class Gui extends AbstractDialog<Object> {
} catch (final Exception e1) {
JDLogger.exception(e1);
}
Dialog.getInstance().showDialog(new JDRRInfoPopup());
try {
Dialog.getInstance().showDialog(new JDRRInfoPopup());
} catch (DialogClosedException e) {
e.printStackTrace();
} catch (DialogCanceledException e) {
e.printStackTrace();
}
return;
}
}

View File

@ -56,6 +56,8 @@ import org.appwork.utils.logging.Log;
import org.appwork.utils.swing.EDTRunner;
import org.appwork.utils.swing.dialog.ConfirmDialog;
import org.appwork.utils.swing.dialog.Dialog;
import org.appwork.utils.swing.dialog.DialogCanceledException;
import org.appwork.utils.swing.dialog.DialogClosedException;
import org.appwork.utils.swing.dialog.ProgressDialog;
import org.appwork.utils.swing.dialog.ProgressDialog.ProgressGetter;
import org.w3c.dom.Document;
@ -111,11 +113,18 @@ public class UPNPRouterPlugin extends RouterPlugin implements ActionListener, IP
Loc.L("jd.controlling.reconnect.plugins.upnp.UPNPRouterPlugin.actionPerformed.wizard.find.message", "Scanning all network interfaces"), null);
dialog.setPreferredSize(new Dimension(500, 150));
Dialog.getInstance().showDialog(dialog);
if (this.devices != null && this.devices.size() > 0) {
try {
Dialog.getInstance().showDialog(dialog);
if (this.devices != null && this.devices.size() > 0) {
this.autoFind();
this.autoFind();
}
} catch (DialogClosedException e1) {
e1.printStackTrace();
} catch (DialogCanceledException e1) {
e1.printStackTrace();
}
} else if (e.getSource() == this.find) {
final ProgressDialog dialog = new ProgressDialog(new ProgressGetter() {
@ -157,7 +166,13 @@ public class UPNPRouterPlugin extends RouterPlugin implements ActionListener, IP
}, 0, "Looking for routers", "Wait while JDownloader is looking for router interfaces", null);
Dialog.getInstance().showDialog(dialog);
try {
Dialog.getInstance().showDialog(dialog);
} catch (DialogClosedException e1) {
e1.printStackTrace();
} catch (DialogCanceledException e1) {
e1.printStackTrace();
}
}
}

View File

@ -34,6 +34,8 @@ import jd.utils.locale.JDL;
import org.appwork.utils.BinaryLogic;
import org.appwork.utils.swing.dialog.Dialog;
import org.appwork.utils.swing.dialog.DialogCanceledException;
import org.appwork.utils.swing.dialog.DialogClosedException;
public class UserIO {
@ -256,11 +258,25 @@ public class UserIO {
}
public String requestCaptchaDialog(final int flag, final String host, final ImageIcon icon, final File captchafile, final String suggestion, final String explain) {
return Dialog.getInstance().showDialog(new CaptchaDialog(flag | Dialog.LOGIC_COUNTDOWN, host, captchafile, suggestion, explain));
try {
return Dialog.getInstance().showDialog(new CaptchaDialog(flag | Dialog.LOGIC_COUNTDOWN, host, captchafile, suggestion, explain));
} catch (DialogClosedException e) {
e.printStackTrace();
} catch (DialogCanceledException e) {
e.printStackTrace();
}
return null;
}
public Point requestClickPositionDialog(final File imagefile, final String title, final String explain) {
return Dialog.getInstance().showDialog(new ClickPositionDialog(0, imagefile, title, explain));
try {
return Dialog.getInstance().showDialog(new ClickPositionDialog(0, imagefile, title, explain));
} catch (DialogClosedException e) {
e.printStackTrace();
} catch (DialogCanceledException e) {
e.printStackTrace();
}
return null;
}
/**
@ -280,7 +296,14 @@ public class UserIO {
* @return
*/
public int requestComboDialog(final int flag, final String title, final String question, final Object[] options, final int defaultSelection, final ImageIcon icon, final String okText, final String cancelText, final ListCellRenderer renderer) {
return Dialog.getInstance().showComboDialog(this.convertFlagToAWDialog(flag), title, question, options, defaultSelection, icon, okText, cancelText, renderer);
try {
return Dialog.getInstance().showComboDialog(this.convertFlagToAWDialog(flag), title, question, options, defaultSelection, icon, okText, cancelText, renderer);
} catch (DialogClosedException e) {
e.printStackTrace();
} catch (DialogCanceledException e) {
e.printStackTrace();
}
return -1;
}
public int requestConfirmDialog(final int flag, final String question) {
@ -292,7 +315,13 @@ public class UserIO {
}
public int requestConfirmDialog(final int flag, final String title, final String message, final ImageIcon icon, final String okOption, final String cancelOption) {
return this.convertAWAnswer(Dialog.getInstance().showConfirmDialog(this.convertFlagToAWDialog(flag), title, message, icon, okOption, cancelOption));
try {
return this.convertAWAnswer(Dialog.getInstance().showConfirmDialog(this.convertFlagToAWDialog(flag), title, message, icon, okOption, cancelOption));
} catch (DialogClosedException e) {
return UserIO.RETURN_CANCEL;
} catch (DialogCanceledException e) {
return UserIO.RETURN_CANCEL;
}
}
public File[] requestFileChooser(final String id, final String title, final Integer fileSelectionMode, final FileFilter fileFilter, final Boolean multiSelection) {
@ -322,7 +351,14 @@ public class UserIO {
*/
public File[] requestFileChooser(final String id, final String title, final Integer fileSelectionMode, final FileFilter fileFilter, final Boolean multiSelection, final File startDirectory, final Integer dialogType) {
return Dialog.getInstance().showFileChooser(id, title, fileSelectionMode == null ? -1 : fileSelectionMode, fileFilter, multiSelection == null ? false : multiSelection, dialogType == null ? -1 : dialogType, null);
try {
return Dialog.getInstance().showFileChooser(id, title, fileSelectionMode == null ? -1 : fileSelectionMode, fileFilter, multiSelection == null ? false : multiSelection, dialogType == null ? -1 : dialogType, null);
} catch (DialogCanceledException e) {
e.printStackTrace();
} catch (DialogClosedException e) {
e.printStackTrace();
}
return null;
}
/**
@ -340,7 +376,14 @@ public class UserIO {
}
public String requestInputDialog(final int flag, final String title, final String message, final String defaultMessage, final ImageIcon icon, final String okOption, final String cancelOption) {
return Dialog.getInstance().showInputDialog(this.convertFlagToAWDialog(flag), title, message, defaultMessage, icon, okOption, cancelOption);
try {
return Dialog.getInstance().showInputDialog(this.convertFlagToAWDialog(flag), title, message, defaultMessage, icon, okOption, cancelOption);
} catch (DialogClosedException e) {
e.printStackTrace();
} catch (DialogCanceledException e) {
e.printStackTrace();
}
return null;
}
public String requestInputDialog(final String message) {
@ -373,7 +416,14 @@ public class UserIO {
* @return
*/
public String requestTextAreaDialog(final String title, final String message, final String def) {
return Dialog.getInstance().showTextAreaDialog(title, message, def);
try {
return Dialog.getInstance().showTextAreaDialog(title, message, def);
} catch (DialogClosedException e) {
e.printStackTrace();
} catch (DialogCanceledException e) {
e.printStackTrace();
}
return null;
}
}

View File

@ -35,7 +35,6 @@ import jd.controlling.AccountController;
import jd.gui.UserIO;
import jd.gui.swing.jdgui.actions.ActionController;
import jd.gui.swing.jdgui.views.settings.JDLabelListRenderer;
import jd.nutils.JDFlags;
import jd.plugins.Account;
import jd.plugins.PluginForHost;
import jd.utils.JDTheme;
@ -45,6 +44,8 @@ import net.miginfocom.swing.MigLayout;
import org.appwork.utils.swing.dialog.AbstractDialog;
import org.appwork.utils.swing.dialog.Dialog;
import org.appwork.utils.swing.dialog.DialogCanceledException;
import org.appwork.utils.swing.dialog.DialogClosedException;
public class AccountDialog extends AbstractDialog<Integer> {
@ -55,10 +56,17 @@ public class AccountDialog extends AbstractDialog<Integer> {
public static void showDialog(final PluginForHost pluginForHost) {
final AccountDialog dialog = new AccountDialog(pluginForHost);
if (JDFlags.hasAllFlags(Dialog.getInstance().showDialog(dialog), Dialog.RETURN_OK)) {
try {
Dialog.getInstance().showDialog(dialog);
final Account ac = new Account(dialog.getUsername(), dialog.getPassword());
AccountController.getInstance().addAccount(dialog.getHoster().getPlugin(), ac);
} catch (DialogClosedException e) {
e.printStackTrace();
} catch (DialogCanceledException e) {
e.printStackTrace();
}
}
private JComboBox hoster;

View File

@ -25,7 +25,6 @@ import javax.swing.JPanel;
import jd.gui.UserIO;
import jd.gui.swing.components.linkbutton.JLink;
import jd.nutils.JDFlags;
import jd.plugins.DownloadLink;
import jd.plugins.PluginForHost;
import jd.utils.locale.JDL;
@ -33,6 +32,8 @@ import net.miginfocom.swing.MigLayout;
import org.appwork.utils.swing.dialog.AbstractDialog;
import org.appwork.utils.swing.dialog.Dialog;
import org.appwork.utils.swing.dialog.DialogCanceledException;
import org.appwork.utils.swing.dialog.DialogClosedException;
/**
* Dieser Dialog wird angezeigt, wenn ein Download mit einem Plugin getätigt
@ -53,10 +54,17 @@ public class AgbDialog extends AbstractDialog<Integer> {
public static void showDialog(final DownloadLink downloadLink) {
if (downloadLink.getDefaultPlugin() == null) { return; }
final AgbDialog dialog = new AgbDialog(downloadLink.getDefaultPlugin());
try {
Dialog.getInstance().showDialog(dialog);
if (JDFlags.hasAllFlags(Dialog.getInstance().showDialog(dialog), UserIO.RETURN_OK) && dialog.isAccepted()) {
downloadLink.getDefaultPlugin().setAGBChecked(true);
downloadLink.getLinkStatus().reset();
if (dialog.isAccepted()) {
downloadLink.getDefaultPlugin().setAGBChecked(true);
downloadLink.getLinkStatus().reset();
}
} catch (DialogClosedException e) {
e.printStackTrace();
} catch (DialogCanceledException e) {
e.printStackTrace();
}
}

View File

@ -32,6 +32,8 @@ import net.miginfocom.swing.MigLayout;
import org.appwork.utils.os.CrossSystem;
import org.appwork.utils.swing.dialog.AbstractDialog;
import org.appwork.utils.swing.dialog.Dialog;
import org.appwork.utils.swing.dialog.DialogCanceledException;
import org.appwork.utils.swing.dialog.DialogClosedException;
public class InstallerDialog extends AbstractDialog<Object> {
@ -39,9 +41,16 @@ public class InstallerDialog extends AbstractDialog<Object> {
public static boolean showDialog(final File dlFolder) {
final InstallerDialog dialog = new InstallerDialog(dlFolder);
try {
Dialog.getInstance().showDialog(dialog);
return JDUtilities.getConfiguration().getStringProperty(Configuration.PARAM_DOWNLOAD_DIRECTORY, null) != null;
Dialog.getInstance().showDialog(dialog);
return JDUtilities.getConfiguration().getStringProperty(Configuration.PARAM_DOWNLOAD_DIRECTORY, null) != null;
} catch (DialogClosedException e) {
e.printStackTrace();
} catch (DialogCanceledException e) {
e.printStackTrace();
}
return false;
}
private String language = null;

View File

@ -30,11 +30,11 @@ import jd.parser.html.HTMLParser;
import jd.plugins.Account;
import jd.plugins.AccountInfo;
import jd.plugins.DownloadLink;
import jd.plugins.DownloadLink.AvailableStatus;
import jd.plugins.HostPlugin;
import jd.plugins.LinkStatus;
import jd.plugins.PluginException;
import jd.plugins.PluginForHost;
import jd.plugins.DownloadLink.AvailableStatus;
@HostPlugin(revision = "$Revision$", interfaceVersion = 2, names = { "share.cx" }, urls = { "http://[\\w\\.]*?share\\.cx/(files/)?\\d+" }, flags = { 2 })
public class ShareCx extends PluginForHost {
@ -65,6 +65,7 @@ public class ShareCx extends PluginForHost {
requestFileInformation(downloadLink);
this.setBrowserExclusive();
br.getPage(downloadLink.getDownloadURL());
br.getPage("http://www.share.cx/cms/download");
br.setFollowRedirects(false);
Form dlform0 = br.getForm(0);
if (dlform0 == null) {

View File

@ -7,6 +7,8 @@ import javax.swing.AbstractAction;
import jd.plugins.optional.jdpremserv.controlling.UserController;
import org.appwork.utils.swing.dialog.Dialog;
import org.appwork.utils.swing.dialog.DialogCanceledException;
import org.appwork.utils.swing.dialog.DialogClosedException;
public class AddUserAction extends AbstractAction {
@ -22,9 +24,16 @@ public class AddUserAction extends AbstractAction {
}
public void actionPerformed(ActionEvent arg0) {
String username = Dialog.getInstance().showInputDialog(0, "Username", "");
String password = Dialog.getInstance().showInputDialog(0, "Password", "");
UserController.getInstance().addUser(username, password);
String username;
try {
username = Dialog.getInstance().showInputDialog(0, "Username", "");
String password = Dialog.getInstance().showInputDialog(0, "Password", "");
UserController.getInstance().addUser(username, password);
} catch (DialogClosedException e) {
e.printStackTrace();
} catch (DialogCanceledException e) {
e.printStackTrace();
}
}
}

View File

@ -11,6 +11,8 @@ import jd.plugins.optional.jdpremserv.model.PremServUser;
import org.appwork.utils.formatter.SizeFormatter;
import org.appwork.utils.swing.dialog.Dialog;
import org.appwork.utils.swing.dialog.DialogCanceledException;
import org.appwork.utils.swing.dialog.DialogClosedException;
public class EditHosterUserAction extends AbstractAction {
@ -38,19 +40,27 @@ public class EditHosterUserAction extends AbstractAction {
sb.append(SizeFormatter.formatBytes(hoster.getTraffic()));
sb.append("\r\n");
}
String ret = Dialog.getInstance().showInputDialog(Dialog.STYLE_LARGE | Dialog.STYLE_HIDE_ICON, "SetHoster for " + obj.getUsername(), "Format: domain.com,trafficpermonth\r\n", sb.toString(), null, null, null);
if (ret == null) return;
hosters = new HashMap<String, PremServHoster>();
String ret;
try {
ret = Dialog.getInstance().showInputDialog(Dialog.STYLE_LARGE | Dialog.STYLE_HIDE_ICON, "SetHoster for " + obj.getUsername(), "Format: domain.com,trafficpermonth\r\n", sb.toString(), null, null, null);
for (String s : Regex.getLines(ret)) {
String[] p = s.split("\\,");
if (ret == null) return;
hosters = new HashMap<String, PremServHoster>();
if (p.length == 2) {
PremServHoster h = new PremServHoster(p[0], SizeFormatter.getSize(p[1].trim()));
hosters.put(h.getDomain(), h);
for (String s : Regex.getLines(ret)) {
String[] p = s.split("\\,");
if (p.length == 2) {
PremServHoster h = new PremServHoster(p[0], SizeFormatter.getSize(p[1].trim()));
hosters.put(h.getDomain(), h);
}
}
obj.setHosters(hosters);
} catch (DialogClosedException e) {
e.printStackTrace();
} catch (DialogCanceledException e) {
e.printStackTrace();
}
obj.setHosters(hosters);
}
}

View File

@ -8,6 +8,8 @@ import jd.plugins.optional.jdpremserv.model.PremServUser;
import org.appwork.utils.formatter.SizeFormatter;
import org.appwork.utils.swing.dialog.Dialog;
import org.appwork.utils.swing.dialog.DialogCanceledException;
import org.appwork.utils.swing.dialog.DialogClosedException;
public class EditTrafficUserAction extends AbstractAction {
@ -27,9 +29,17 @@ public class EditTrafficUserAction extends AbstractAction {
public void actionPerformed(ActionEvent arg0) {
String ret = Dialog.getInstance().showInputDialog(0, "Set Max Traffic for " + obj.getUsername(), "Format: 1,34GB", SizeFormatter.formatBytes(obj.getAllowedTrafficPerMonth()), null, null, null);
if (ret == null) return;
obj.setAllowedTrafficPerMonth(SizeFormatter.getSize(ret));
String ret;
try {
ret = Dialog.getInstance().showInputDialog(0, "Set Max Traffic for " + obj.getUsername(), "Format: 1,34GB", SizeFormatter.formatBytes(obj.getAllowedTrafficPerMonth()), null, null, null);
if (ret == null) return;
obj.setAllowedTrafficPerMonth(SizeFormatter.getSize(ret));
} catch (DialogClosedException e) {
e.printStackTrace();
} catch (DialogCanceledException e) {
e.printStackTrace();
}
}
}

View File

@ -66,6 +66,8 @@ import jd.utils.locale.JDL;
import net.miginfocom.swing.MigLayout;
import org.appwork.utils.swing.dialog.Dialog;
import org.appwork.utils.swing.dialog.DialogCanceledException;
import org.appwork.utils.swing.dialog.DialogClosedException;
import org.appwork.utils.swing.table.ExtRowHighlighter;
import org.appwork.utils.swing.table.ExtTable;
import org.appwork.utils.swing.table.SelectionHighlighter;
@ -174,18 +176,25 @@ public class LFEGui extends SwitchPanel implements ActionListener {
UserIO.getInstance().requestMessageDialog("Started JDownloader in KEY DEBUG Mode");
} else if (e.getSource() == this.mnuAdd) {
final String[] result = Dialog.getInstance().showDialog(new TwoTextFieldDialog(JDL.L(LFEGui.LOCALE_PREFIX + "addKey.title", "Add new key"), JDL.L(LFEGui.LOCALE_PREFIX + "addKey.message1", "Type in the name of the key:"), "", JDL.L(LFEGui.LOCALE_PREFIX + "addKey.message2", "Type in the translated message of the key:"), ""));
if (result == null || result[0].equals("")) { return; }
result[0] = result[0].toLowerCase();
for (final KeyInfo ki : this.data) {
if (ki.getKey().equals(result[0])) {
UserIO.getInstance().requestMessageDialog(JDL.LF(LFEGui.LOCALE_PREFIX + "addKey.error.message", "The key '%s' is already in use!", result[0]));
return;
String[] result;
try {
result = Dialog.getInstance().showDialog(new TwoTextFieldDialog(JDL.L(LFEGui.LOCALE_PREFIX + "addKey.title", "Add new key"), JDL.L(LFEGui.LOCALE_PREFIX + "addKey.message1", "Type in the name of the key:"), "", JDL.L(LFEGui.LOCALE_PREFIX + "addKey.message2", "Type in the translated message of the key:"), ""));
if (result == null || result[0].equals("")) { return; }
result[0] = result[0].toLowerCase();
for (final KeyInfo ki : this.data) {
if (ki.getKey().equals(result[0])) {
UserIO.getInstance().requestMessageDialog(JDL.LF(LFEGui.LOCALE_PREFIX + "addKey.error.message", "The key '%s' is already in use!", result[0]));
return;
}
}
this.data.add(new KeyInfo(result[0].toLowerCase(), null, result[1], this.languageENKeysFromFile.get(result[0].toLowerCase())));
this.tableModel.refreshData();
this.updateKeyChart();
} catch (DialogClosedException e1) {
e1.printStackTrace();
} catch (DialogCanceledException e1) {
e1.printStackTrace();
}
this.data.add(new KeyInfo(result[0].toLowerCase(), null, result[1], this.languageENKeysFromFile.get(result[0].toLowerCase())));
this.tableModel.refreshData();
this.updateKeyChart();
} else if (e.getSource() == this.mnuDelete || e.getSource() == this.mnuContextDelete) {
@ -751,7 +760,7 @@ public class LFEGui extends SwitchPanel implements ActionListener {
out.close();
if (upload) {
String message = UserIO.getInstance().requestInputDialog(0, "Enter change description", "Please enter a short description for your changes (in english).", "", null, null, null);
if ((message == null)||(message.trim() == "")) {
if ((message == null) || (message.trim() == "")) {
message = "Updated language file (" + this.lngKey + ")";
}
if (!this.commit(file, message, null)) {