Search in sources :

Example 1 with MdiEntryOpenListener

use of com.biglybt.ui.mdi.MdiEntryOpenListener in project BiglyBT by BiglySoftware.

the class UIFunctionsImpl method showURL.

/**
 * @param url
 * @param target
 */
private void showURL(final String url, String target) {
    if ("_blank".equalsIgnoreCase(target)) {
        Utils.launch(url);
        return;
    }
    if (target.startsWith("tab-")) {
        target = target.substring(4);
    }
    MultipleDocumentInterface mdi = UIFunctionsManager.getUIFunctions().getMDI();
    // by the caller
    if (mdi == null || !mdi.showEntryByID(target)) {
        Utils.launch(url);
        return;
    }
    MdiEntry entry = mdi.getEntry(target);
    entry.addListener(new MdiEntryOpenListener() {

        @Override
        public void mdiEntryOpen(MdiEntry entry) {
            entry.removeListener(this);
            mainWindow.setVisible(true, true);
            if (!(entry instanceof SideBarEntrySWT)) {
                return;
            }
            SideBarEntrySWT entrySWT = (SideBarEntrySWT) entry;
            SWTSkinObjectBrowser soBrowser = SWTSkinUtils.findBrowserSO(entrySWT.getSkinObject());
            if (soBrowser != null) {
                // ((SWTSkinObjectBrowser) skinObject).getBrowser().setVisible(false);
                if (url == null || url.length() == 0) {
                    soBrowser.restart();
                } else {
                    soBrowser.setURL(url);
                }
            }
        }
    });
}
Also used : MdiEntryOpenListener(com.biglybt.ui.mdi.MdiEntryOpenListener) BaseMdiEntry(com.biglybt.ui.swt.mdi.BaseMdiEntry) MdiEntry(com.biglybt.ui.mdi.MdiEntry) SideBarEntrySWT(com.biglybt.ui.swt.views.skin.sidebar.SideBarEntrySWT) MultipleDocumentInterface(com.biglybt.ui.mdi.MultipleDocumentInterface)

Aggregations

MdiEntry (com.biglybt.ui.mdi.MdiEntry)1 MdiEntryOpenListener (com.biglybt.ui.mdi.MdiEntryOpenListener)1 MultipleDocumentInterface (com.biglybt.ui.mdi.MultipleDocumentInterface)1 BaseMdiEntry (com.biglybt.ui.swt.mdi.BaseMdiEntry)1 SideBarEntrySWT (com.biglybt.ui.swt.views.skin.sidebar.SideBarEntrySWT)1