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);
}
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);
}
});
}
}
}
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) {
}
});
}
}
}
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;
}
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);
}
}
}
Aggregations