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