Search in sources :

Example 1 with SkinViewManagerListener

use of com.biglybt.ui.swt.views.skin.SkinViewManager.SkinViewManagerListener in project BiglyBT by BiglySoftware.

the class DeviceManagerUI method uiAttachedAndCoreRunning.

private void uiAttachedAndCoreRunning(Core core) {
    Utils.execSWTThread(new AERunnable() {

        @Override
        public void runSupport() {
            MultipleDocumentInterfaceSWT mdi = UIFunctionsManagerSWT.getUIFunctionsSWT().getMDISWT();
            if (mdi != null) {
                setupUI(mdi);
            } else {
                SkinViewManager.addListener(new SkinViewManagerListener() {

                    @Override
                    public void skinViewAdded(SkinView skinview) {
                        if (skinview instanceof SideBar) {
                            setupUI((SideBar) skinview);
                            SkinViewManager.RemoveListener(this);
                        }
                    }
                });
            }
        }
    });
    canCloseListener = new canCloseListener() {

        @Override
        public boolean canClose() {
            try {
                if (device_manager == null) {
                    return (true);
                }
                if (!device_manager.isTranscodeManagerInitialized()) {
                    return true;
                }
                final TranscodeJob job = device_manager.getTranscodeManager().getQueue().getCurrentJob();
                if (job == null || job.getState() != TranscodeJob.ST_RUNNING) {
                    return (true);
                }
                if (job.getTranscodeFile().getDevice().isHidden()) {
                    return (true);
                }
                String title = MessageText.getString("device.quit.transcoding.title");
                String text = MessageText.getString("device.quit.transcoding.text", new String[] { job.getName(), job.getTarget().getDevice().getName(), String.valueOf(job.getPercentComplete()) });
                MessageBoxShell mb = new MessageBoxShell(title, text, new String[] { MessageText.getString("UpdateWindow.quit"), MessageText.getString("Content.alert.notuploaded.button.abort") }, 1);
                mb.open(null);
                mb.waitUntilClosed();
                return mb.getResult() == 0;
            } catch (Throwable e) {
                Debug.out(e);
                return true;
            }
        }
    };
    UIExitUtilsSWT.addListener(canCloseListener);
}
Also used : SkinViewManagerListener(com.biglybt.ui.swt.views.skin.SkinViewManager.SkinViewManagerListener) MessageBoxShell(com.biglybt.ui.swt.shells.MessageBoxShell) MultipleDocumentInterfaceSWT(com.biglybt.ui.swt.mdi.MultipleDocumentInterfaceSWT) SkinView(com.biglybt.ui.swt.views.skin.SkinView) SideBar(com.biglybt.ui.swt.views.skin.sidebar.SideBar) UIExitUtilsSWT.canCloseListener(com.biglybt.ui.swt.UIExitUtilsSWT.canCloseListener)

Aggregations

UIExitUtilsSWT.canCloseListener (com.biglybt.ui.swt.UIExitUtilsSWT.canCloseListener)1 MultipleDocumentInterfaceSWT (com.biglybt.ui.swt.mdi.MultipleDocumentInterfaceSWT)1 MessageBoxShell (com.biglybt.ui.swt.shells.MessageBoxShell)1 SkinView (com.biglybt.ui.swt.views.skin.SkinView)1 SkinViewManagerListener (com.biglybt.ui.swt.views.skin.SkinViewManager.SkinViewManagerListener)1 SideBar (com.biglybt.ui.swt.views.skin.sidebar.SideBar)1