Search in sources :

Example 16 with MessageBoxShell

use of com.biglybt.ui.swt.shells.MessageBoxShell in project BiglyBT by BiglySoftware.

the class Utils method reportError.

public static void reportError(Throwable e) {
    MessageBoxShell mb = new MessageBoxShell(MessageText.getString("ConfigView.section.security.op.error.title"), MessageText.getString("ConfigView.section.security.op.error", new String[] { Debug.getNestedExceptionMessage(e) }), new String[] { MessageText.getString("Button.ok") }, 0);
    mb.open(null);
}
Also used : MessageBoxShell(com.biglybt.ui.swt.shells.MessageBoxShell)

Example 17 with MessageBoxShell

use of com.biglybt.ui.swt.shells.MessageBoxShell in project BiglyBT by BiglySoftware.

the class Utils method setQuickViewActive.

public static void setQuickViewActive(DiskManagerFileInfo file, boolean active) {
    synchronized (quick_view_active) {
        if (!active) {
            quick_view_active.remove(file);
            return;
        }
        if (quick_view_active.contains(file)) {
            return;
        }
        String ext = file.getExtension().toLowerCase();
        boolean file_complete = file.getDownloaded() == file.getLength();
        if (ext.equals(".rar")) {
            quick_view_active.add(file);
            quickViewRAR(file);
        } else {
            if (file_complete) {
                quickView(file);
            } else {
                quick_view_active.add(file);
                if (file.isSkipped()) {
                    file.setSkipped(false);
                }
                file.setPriority(1);
                DiskManagerFileInfo[] all_files = file.getDownloadManager().getDiskManagerFileInfoSet().getFiles();
                for (DiskManagerFileInfo f : all_files) {
                    if (!quick_view_active.contains(f)) {
                        f.setPriority(0);
                    }
                }
                if (quick_view_event == null) {
                    quick_view_event = SimpleTimer.addPeriodicEvent("qv_checker", 5 * 1000, new TimerEventPerformer() {

                        @Override
                        public void perform(TimerEvent event) {
                            synchronized (quick_view_active) {
                                Iterator<DiskManagerFileInfo> it = quick_view_active.iterator();
                                while (it.hasNext()) {
                                    DiskManagerFileInfo file = it.next();
                                    if (file.getDownloadManager().isDestroyed()) {
                                        it.remove();
                                    } else {
                                        if (file.getDownloaded() == file.getLength()) {
                                            quickView(file);
                                            it.remove();
                                        }
                                    }
                                }
                                if (quick_view_active.isEmpty()) {
                                    quick_view_event.cancel();
                                    quick_view_event = null;
                                }
                            }
                        }
                    });
                }
            }
        }
        if (!file_complete) {
            execSWTThreadLater(10, new Runnable() {

                @Override
                public void run() {
                    MessageBoxShell mb = new MessageBoxShell(SWT.OK, MessageText.getString("quick.view.scheduled.title"), MessageText.getString("quick.view.scheduled.text"));
                    mb.setDefaultButtonUsingStyle(SWT.OK);
                    mb.setRemember("quick.view.inform.activated.id", false, MessageText.getString("label.dont.show.again"));
                    mb.setLeftImage(SWT.ICON_INFORMATION);
                    mb.open(null);
                }
            });
        }
    }
}
Also used : DiskManagerFileInfo(com.biglybt.core.disk.DiskManagerFileInfo) SWTRunnable(com.biglybt.ui.swt.utils.SWTRunnable) MessageBoxShell(com.biglybt.ui.swt.shells.MessageBoxShell)

Example 18 with MessageBoxShell

use of com.biglybt.ui.swt.shells.MessageBoxShell in project BiglyBT by BiglySoftware.

the class BetaWizard method onClose.

@Override
public void onClose() {
    super.onClose();
    if (finished) {
        COConfigurationManager.setParameter("Beta Programme Enabled", beta_enabled);
        if (!beta_enabled && Constants.IS_CVS_VERSION) {
            MessageBoxShell mb = new MessageBoxShell(SWT.ICON_INFORMATION | SWT.OK, MessageText.getString("beta.wizard.disable.title"), MessageText.getString("beta.wizard.disable.text"));
            mb.open(null);
        } else if (beta_enabled && !beta_was_enabled) {
            UpdateMonitor.getSingleton(CoreFactory.getSingleton()).performCheck(true, false, false, new UpdateCheckInstanceListener() {

                @Override
                public void cancelled(UpdateCheckInstance instance) {
                }

                @Override
                public void complete(UpdateCheckInstance instance) {
                }
            });
        }
    }
}
Also used : UpdateCheckInstance(com.biglybt.pif.update.UpdateCheckInstance) UpdateCheckInstanceListener(com.biglybt.pif.update.UpdateCheckInstanceListener) MessageBoxShell(com.biglybt.ui.swt.shells.MessageBoxShell)

Example 19 with MessageBoxShell

use of com.biglybt.ui.swt.shells.MessageBoxShell in project BiglyBT by BiglySoftware.

the class UIExitUtilsSWT method getExitConfirmation.

/**
 * @return true, if the user choosed OK in the exit dialog
 *
 * @author Rene Leonhardt
 */
private static boolean getExitConfirmation(boolean for_restart) {
    MessageBoxShell mb = new MessageBoxShell(SWT.ICON_WARNING | SWT.YES | SWT.NO, for_restart ? "MainWindow.dialog.restartconfirmation" : "MainWindow.dialog.exitconfirmation", (String[]) null);
    mb.open(null);
    return mb.waitUntilClosed() == SWT.YES;
}
Also used : MessageBoxShell(com.biglybt.ui.swt.shells.MessageBoxShell)

Example 20 with MessageBoxShell

use of com.biglybt.ui.swt.shells.MessageBoxShell in project BiglyBT by BiglySoftware.

the class MenuFactory method JSONToBencode.

private static void JSONToBencode() {
    final Shell shell = Utils.findAnyShell();
    FileDialog dialog = new FileDialog(shell, SWT.SYSTEM_MODAL | SWT.OPEN);
    dialog.setFilterExtensions(new String[] { "*.json", Constants.FILE_WILDCARD });
    dialog.setFilterNames(new String[] { "*.json", Constants.FILE_WILDCARD });
    dialog.setFilterPath(TorrentOpener.getFilterPathTorrent());
    dialog.setText(MessageText.getString("json.file.browse"));
    String str = dialog.open();
    if (str != null) {
        try {
            String json = FileUtil.readFileAsString(new File(str), -1, "UTF-8");
            if (json == null) {
                throw (new Exception("JSON decode failed"));
            }
            final Map map = BDecoder.decodeFromJSON(json);
            Utils.execSWTThreadLater(1, new Runnable() {

                @Override
                public void run() {
                    FileDialog dialog2 = new FileDialog(shell, SWT.SYSTEM_MODAL | SWT.SAVE);
                    dialog2.setFilterPath(TorrentOpener.getFilterPathTorrent());
                    dialog2.setFilterExtensions(new String[] { "*.config", "*.torrent", "*.tor", Constants.FILE_WILDCARD });
                    String str2 = dialog2.open();
                    if (str2 != null) {
                        if (!str2.contains(".")) {
                            str2 += ".config";
                        }
                        try {
                            byte[] bytes = BEncoder.encode(map);
                            FileUtil.writeBytesAsFile(str2, bytes);
                        } catch (Throwable e) {
                            MessageBoxShell mb = new MessageBoxShell(SWT.ERROR, MessageText.getString("ConfigView.section.security.resetkey.error.title"), Debug.getNestedExceptionMessage(e));
                            mb.setParent(shell);
                            mb.open(null);
                        }
                    }
                }
            });
        } catch (Throwable e) {
            MessageBoxShell mb = new MessageBoxShell(SWT.ERROR, MessageText.getString("ConfigView.section.security.resetkey.error.title"), Debug.getNestedExceptionMessage(e));
            mb.setParent(shell);
            mb.open(null);
        }
    }
}
Also used : MessageBoxShell(com.biglybt.ui.swt.shells.MessageBoxShell) MessageBoxShell(com.biglybt.ui.swt.shells.MessageBoxShell) TOTorrentFile(com.biglybt.core.torrent.TOTorrentFile) File(java.io.File) Map(java.util.Map) HashMap(java.util.HashMap)

Aggregations

MessageBoxShell (com.biglybt.ui.swt.shells.MessageBoxShell)53 UserPrompterResultListener (com.biglybt.ui.UserPrompterResultListener)24 File (java.io.File)10 ArrayList (java.util.ArrayList)7 GridData (org.eclipse.swt.layout.GridData)7 DownloadManager (com.biglybt.core.download.DownloadManager)6 UIInputReceiverListener (com.biglybt.pif.ui.UIInputReceiverListener)6 GridLayout (org.eclipse.swt.layout.GridLayout)6 Map (java.util.Map)5 TOTorrent (com.biglybt.core.torrent.TOTorrent)4 TOTorrentFile (com.biglybt.core.torrent.TOTorrentFile)4 AERunnable (com.biglybt.core.util.AERunnable)4 UIInputReceiver (com.biglybt.pif.ui.UIInputReceiver)4 UIFunctionsSWT (com.biglybt.ui.swt.UIFunctionsSWT)4 URL (java.net.URL)4 HashMap (java.util.HashMap)4 List (java.util.List)4 MouseAdapter (org.eclipse.swt.events.MouseAdapter)4 MouseEvent (org.eclipse.swt.events.MouseEvent)4 Point (org.eclipse.swt.graphics.Point)4