use of com.biglybt.ui.mdi.MultipleDocumentInterface in project BiglyBT by BiglySoftware.
the class ColumnSubscriptionName method cellMouseTrigger.
@Override
public void cellMouseTrigger(TableCellMouseEvent event) {
if (event.eventType == TableCellMouseEvent.EVENT_MOUSEUP && event.button == 1) {
TableCell cell = event.cell;
int cellWidth = cell.getWidth();
if (event.x > cellWidth - imageWidth - 5 && event.x < cellWidth - 5) {
Subscription sub = (Subscription) cell.getDataSource();
if (sub != null && !sub.isSearchTemplate()) {
String key = "Subscription_" + ByteFormatter.encodeString(sub.getPublicKey());
MultipleDocumentInterface mdi = UIFunctionsManager.getUIFunctions().getMDI();
if (mdi != null) {
mdi.showEntryByID(key);
}
}
}
}
}
use of com.biglybt.ui.mdi.MultipleDocumentInterface in project BiglyBT by BiglySoftware.
the class SearchHandler method handleSearch.
public static void handleSearch(String sSearchText, boolean toSubscribe) {
if (!toSubscribe) {
try {
if (COConfigurationManager.getBooleanParameter("rcm.overall.enabled", true) && COConfigurationManager.getBooleanParameter("Plugin.aercm.rcm.search.enable", false) && COConfigurationManager.getBooleanParameter("search.showRCMView") && CoreFactory.isCoreRunning()) {
final PluginInterface pi = CoreFactory.getSingleton().getPluginManager().getPluginInterfaceByID("aercm");
if (pi != null && pi.getPluginState().isOperational() && pi.getIPC().canInvoke("lookupByExpression", new Object[] { "" })) {
pi.getIPC().invoke("lookupByExpression", new Object[] { sSearchText });
}
}
} catch (Throwable e) {
Debug.out(e);
}
}
SearchResultsTabArea.SearchQuery sq = new SearchResultsTabArea.SearchQuery(sSearchText, toSubscribe);
MultipleDocumentInterface mdi = UIFunctionsManager.getUIFunctions().getMDI();
String id = MultipleDocumentInterface.SIDEBAR_SECTION_SEARCH + "." + Integer.toHexString(sSearchText.hashCode()) + (toSubscribe ? ".s" : "");
MdiEntry existingEntry = mdi.getEntry(id);
if (existingEntry != null && existingEntry.isAdded()) {
SearchResultsTabArea searchClass = (SearchResultsTabArea) SkinViewManager.getByClass(SearchResultsTabArea.class);
if (searchClass != null) {
searchClass.anotherSearch(sSearchText, toSubscribe);
}
existingEntry.setDatasource(sq);
mdi.showEntry(existingEntry);
return;
}
final MdiEntry entry = mdi.createEntryFromSkinRef(MultipleDocumentInterface.SIDEBAR_HEADER_DISCOVERY, id, "main.area.searchresultstab", sSearchText, null, sq, true, MultipleDocumentInterface.SIDEBAR_POS_FIRST);
if (entry != null) {
entry.setImageLeftID("image.sidebar.search");
entry.setDatasource(sq);
entry.setViewTitleInfo(new ViewTitleInfoImplementation());
}
mdi.showEntryByID(id);
}
use of com.biglybt.ui.mdi.MultipleDocumentInterface in project BiglyBT by BiglySoftware.
the class DevicesFTUX method _doInstall.
protected void _doInstall(Core core, boolean itunes) {
List<InstallablePlugin> plugins = new ArrayList<>(2);
final PluginInstaller installer = core.getPluginManager().getPluginInstaller();
StandardPlugin vuze_plugin = null;
try {
vuze_plugin = installer.getStandardPlugin("vuzexcode");
} catch (Throwable ignored) {
}
if (vuze_plugin != null && !vuze_plugin.isAlreadyInstalled()) {
plugins.add(vuze_plugin);
}
if (itunes) {
StandardPlugin itunes_plugin = null;
try {
itunes_plugin = installer.getStandardPlugin("azitunes");
} catch (Throwable ignored) {
}
if (itunes_plugin != null && !itunes_plugin.isAlreadyInstalled()) {
plugins.add(itunes_plugin);
}
}
if (plugins.size() == 0) {
close();
return;
}
InstallablePlugin[] installablePlugins = plugins.toArray(new InstallablePlugin[0]);
try {
install_area_parent.setVisible(true);
install_area_parent.moveAbove(null);
Map<Integer, Object> properties = new HashMap<>();
properties.put(UpdateCheckInstance.PT_UI_STYLE, UpdateCheckInstance.PT_UI_STYLE_SIMPLE);
properties.put(UpdateCheckInstance.PT_UI_PARENT_SWT_COMPOSITE, install_area);
properties.put(UpdateCheckInstance.PT_UI_DISABLE_ON_SUCCESS_SLIDEY, true);
installer.install(installablePlugins, false, properties, new PluginInstallationListener() {
@Override
public void completed() {
close();
MultipleDocumentInterface mdi = UIFunctionsManager.getUIFunctions().getMDI();
MdiEntry entry = mdi.getEntry(SideBar.SIDEBAR_HEADER_DEVICES);
MdiEntryVitalityImage[] vitalityImages = entry.getVitalityImages();
for (MdiEntryVitalityImage vi : vitalityImages) {
if (vi.getImageID().contains("turnon")) {
vi.setVisible(false);
}
}
List<Runnable> to_fire;
synchronized (to_fire_on_complete) {
to_fire = new ArrayList<>(to_fire_on_complete);
to_fire_on_complete.clear();
}
for (Runnable r : to_fire) {
if (r != null) {
try {
Utils.execSWTThread(r);
} catch (Throwable e) {
Debug.out(e);
}
}
}
}
@Override
public void cancelled() {
close();
}
@Override
public void failed(PluginException e) {
Debug.out(e);
// Utils.openMessageBox(Utils.findAnyShell(), SWT.OK, "Error",
// e.toString());
close();
}
});
} catch (Throwable e) {
Debug.printStackTrace(e);
}
}
use of com.biglybt.ui.mdi.MultipleDocumentInterface in project BiglyBT by BiglySoftware.
the class MenuFactory method addCloseTabMenuItem.
public static MenuItem addCloseTabMenuItem(Menu menu) {
final MenuItem menuItem = addMenuItem(menu, MENU_ID_CLOSE_TAB, new Listener() {
@Override
public void handleEvent(Event event) {
MultipleDocumentInterface mdi = UIFunctionsManager.getUIFunctions().getMDI();
if (mdi != null) {
MdiEntry currentEntry = mdi.getCurrentEntry();
if (currentEntry != null && currentEntry.isCloseable()) {
mdi.closeEntry(currentEntry.getId());
}
}
}
});
menu.addMenuListener(new MenuListener() {
@Override
public void menuShown(MenuEvent e) {
MultipleDocumentInterface mdi = UIFunctionsManager.getUIFunctions().getMDI();
if (mdi != null) {
MdiEntry currentEntry = mdi.getCurrentEntry();
if (currentEntry != null && currentEntry.isCloseable()) {
menuItem.setEnabled(true);
return;
}
}
menuItem.setEnabled(false);
}
@Override
public void menuHidden(MenuEvent e) {
}
});
return menuItem;
}
use of com.biglybt.ui.mdi.MultipleDocumentInterface in project BiglyBT by BiglySoftware.
the class ChatMDIEntry method setupMdiEntry.
private void setupMdiEntry() {
mdi_entry.setViewTitleInfo(this);
MdiEntryDropListener drop_listener = new MdiEntryDropListener() {
@Override
public boolean mdiEntryDrop(MdiEntry entry, Object payload) {
if (payload instanceof String[]) {
String[] derp = (String[]) payload;
if (derp.length > 0) {
payload = derp[0];
}
}
if (!(payload instanceof String)) {
return false;
}
MultipleDocumentInterface mdi = UIFunctionsManager.getUIFunctions().getMDI();
if (mdi != null) {
String drop = (String) payload;
if (view == null) {
drop_outstanding = drop;
} else {
view.handleDrop(drop);
}
mdi.showEntry(mdi_entry);
return (true);
} else {
return (false);
}
}
};
mdi_entry.addListener(drop_listener);
mdi_entry.addListener(new MdiCloseListener() {
@Override
public void mdiEntryClosed(MdiEntry entry, boolean user) {
chat.removeListener(adapter);
chat.destroy();
}
});
/*
UIManager ui_manager = PluginInitializer.getDefaultInterface().getUIManager();
MenuManager menu_manager = ui_manager.getMenuManager();
MenuItem menu_item;
menu_item = menu_manager.addMenuItem( "sidebar." + mdi_entry.getId(), "dasd.ad.ad." );
menu_item.setDisposeWithUIDetach(UIInstance.UIT_SWT);
menu_item.addListener(
new MenuItemListener()
{
@Override
public void
selected(
MenuItem menu, Object target )
{
}
});
*/
mdi_entry.setImageLeftID("image.sidebar.chat-overview");
chat.addListener(adapter);
}
Aggregations