Search in sources :

Example 1 with BuddyPluginBeta

use of com.biglybt.plugin.net.buddy.BuddyPluginBeta in project BiglyBT by BiglySoftware.

the class SBC_ChatOverview method skinObjectHidden.

@Override
public Object skinObjectHidden(SWTSkinObject skinObject, Object params) {
    if (tv != null) {
        tv.delete();
        tv = null;
    }
    Utils.disposeSWTObjects(new Object[] { table_parent });
    BuddyPluginBeta beta = BuddyPluginUtils.getBetaPlugin();
    if (beta != null) {
        beta.removeListener(this);
        listener_added = false;
    }
    return super.skinObjectHidden(skinObject, params);
}
Also used : BuddyPluginBeta(com.biglybt.plugin.net.buddy.BuddyPluginBeta)

Example 2 with BuddyPluginBeta

use of com.biglybt.plugin.net.buddy.BuddyPluginBeta in project BiglyBT by BiglySoftware.

the class SBC_ChatOverview method openChat.

public static void openChat(String network, String key) {
    BuddyPluginBeta beta = BuddyPluginUtils.getBetaPlugin();
    if (beta != null) {
        try {
            ChatInstance chat = beta.getChat(network, key);
            chat.setAutoNotify(true);
            MdiEntry mdi_entry = createChatMdiEntry(chat);
            MultipleDocumentInterface mdi = UIFunctionsManager.getUIFunctions().getMDI();
            if (mdi != null) {
                mdi.showEntry(mdi_entry);
            }
        } catch (Throwable e) {
            Debug.out(e);
        }
    }
}
Also used : MdiEntry(com.biglybt.ui.mdi.MdiEntry) BuddyPluginBeta(com.biglybt.plugin.net.buddy.BuddyPluginBeta) MultipleDocumentInterface(com.biglybt.ui.mdi.MultipleDocumentInterface)

Example 3 with BuddyPluginBeta

use of com.biglybt.plugin.net.buddy.BuddyPluginBeta in project BiglyBT by BiglySoftware.

the class SBC_ChatOverview method skinObjectShown.

@Override
public Object skinObjectShown(SWTSkinObject skinObject, Object params) {
    super.skinObjectShown(skinObject, params);
    SWTSkinObject so_list = getSkinObject("chats-list");
    if (so_list != null) {
        initTable((Composite) so_list.getControl());
    } else {
        System.out.println("NO chats-list");
        return null;
    }
    if (tv == null) {
        return null;
    }
    BuddyPluginBeta beta = BuddyPluginUtils.getBetaPlugin();
    if (beta != null) {
        if (!listener_added) {
            listener_added = true;
            beta.addListener(this, true);
        }
    }
    return null;
}
Also used : SWTSkinObject(com.biglybt.ui.swt.skin.SWTSkinObject) BuddyPluginBeta(com.biglybt.plugin.net.buddy.BuddyPluginBeta)

Example 4 with BuddyPluginBeta

use of com.biglybt.plugin.net.buddy.BuddyPluginBeta in project BiglyBT by BiglySoftware.

the class SBC_ChatOverview method defaultSelected.

@Override
public void defaultSelected(TableRowCore[] rows, int stateMask) {
    if (rows.length == 1) {
        Object obj = rows[0].getDataSource();
        if (obj instanceof ChatInstance) {
            ChatInstance chat = (ChatInstance) obj;
            BuddyPluginBeta beta = BuddyPluginUtils.getBetaPlugin();
            if (beta != null) {
                try {
                    beta.showChat(chat.getClone());
                } catch (Throwable e) {
                    Debug.out(e);
                }
            }
        }
    }
}
Also used : SWTSkinObject(com.biglybt.ui.swt.skin.SWTSkinObject) BuddyPluginBeta(com.biglybt.plugin.net.buddy.BuddyPluginBeta)

Example 5 with BuddyPluginBeta

use of com.biglybt.plugin.net.buddy.BuddyPluginBeta in project BiglyBT by BiglySoftware.

the class SBC_ChatOverview method preInitialize.

public static void preInitialize() {
    UIManager ui_manager = PluginInitializer.getDefaultInterface().getUIManager();
    ui_manager.addUIListener(new UIManagerListener() {

        @Override
        public void UIAttached(UIInstance instance) {
            final MultipleDocumentInterface mdi = UIFunctionsManager.getUIFunctions().getMDI();
            if (mdi == null) {
                return;
            }
            mdi.registerEntry("Chat_.*", new MdiEntryCreationListener2() {

                @Override
                public MdiEntry createMDiEntry(MultipleDocumentInterface mdi, String id, Object datasource, Map<?, ?> params) {
                    ChatInstance chat = null;
                    if (datasource instanceof ChatInstance) {
                        chat = (ChatInstance) datasource;
                        try {
                            chat = chat.getClone();
                        } catch (Throwable e) {
                            chat = null;
                            Debug.out(e);
                        }
                    } else if (id.length() > 7) {
                        BuddyPluginBeta beta = BuddyPluginUtils.getBetaPlugin();
                        if (beta != null) {
                            try {
                                String[] bits = id.substring(5).split(":");
                                String network = AENetworkClassifier.internalise(bits[0]);
                                String key = new String(Base32.decode(bits[1]), "UTF-8");
                                chat = beta.getChat(network, key);
                            } catch (Throwable e) {
                                Debug.out(e);
                            }
                        }
                    }
                    if (chat != null) {
                        chat.setAutoNotify(true);
                        return (createChatMdiEntry(chat));
                    }
                    return (null);
                }
            });
        }

        @Override
        public void UIDetached(UIInstance instance) {
        }
    });
}
Also used : MdiEntryCreationListener2(com.biglybt.ui.mdi.MdiEntryCreationListener2) UIManager(com.biglybt.pif.ui.UIManager) SWTSkinObject(com.biglybt.ui.swt.skin.SWTSkinObject) MultipleDocumentInterface(com.biglybt.ui.mdi.MultipleDocumentInterface) BuddyPluginBeta(com.biglybt.plugin.net.buddy.BuddyPluginBeta) UIManagerListener(com.biglybt.pif.ui.UIManagerListener) Map(java.util.Map) TreeMap(java.util.TreeMap) UIInstance(com.biglybt.pif.ui.UIInstance)

Aggregations

BuddyPluginBeta (com.biglybt.plugin.net.buddy.BuddyPluginBeta)9 SWTSkinObject (com.biglybt.ui.swt.skin.SWTSkinObject)3 Download (com.biglybt.pif.download.Download)2 UIInstance (com.biglybt.pif.ui.UIInstance)2 UIManager (com.biglybt.pif.ui.UIManager)2 MdiEntry (com.biglybt.ui.mdi.MdiEntry)2 MultipleDocumentInterface (com.biglybt.ui.mdi.MultipleDocumentInterface)2 TreeMap (java.util.TreeMap)2 ParameterListener (com.biglybt.core.config.ParameterListener)1 DownloadHistoryEvent (com.biglybt.core.history.DownloadHistoryEvent)1 DownloadHistoryListener (com.biglybt.core.history.DownloadHistoryListener)1 DownloadHistoryManager (com.biglybt.core.history.DownloadHistoryManager)1 TRHost (com.biglybt.core.tracker.host.TRHost)1 TRHostListener (com.biglybt.core.tracker.host.TRHostListener)1 TRHostTorrent (com.biglybt.core.tracker.host.TRHostTorrent)1 AsyncController (com.biglybt.core.util.AsyncController)1 TimerEvent (com.biglybt.core.util.TimerEvent)1 TimerEventPerformer (com.biglybt.core.util.TimerEventPerformer)1 TimerEventPeriodic (com.biglybt.core.util.TimerEventPeriodic)1 PluginInterface (com.biglybt.pif.PluginInterface)1