Search in sources :

Example 11 with MultipleDocumentInterface

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);
                }
            }
        }
    }
}
Also used : MultipleDocumentInterface(com.biglybt.ui.mdi.MultipleDocumentInterface) Subscription(com.biglybt.core.subs.Subscription)

Example 12 with MultipleDocumentInterface

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);
}
Also used : MdiEntry(com.biglybt.ui.mdi.MdiEntry) PluginInterface(com.biglybt.pif.PluginInterface) MultipleDocumentInterface(com.biglybt.ui.mdi.MultipleDocumentInterface)

Example 13 with MultipleDocumentInterface

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);
    }
}
Also used : HashMap(java.util.HashMap) PluginException(com.biglybt.pif.PluginException) ArrayList(java.util.ArrayList) StandardPlugin(com.biglybt.pif.installer.StandardPlugin) MultipleDocumentInterface(com.biglybt.ui.mdi.MultipleDocumentInterface) InstallablePlugin(com.biglybt.pif.installer.InstallablePlugin) PluginInstaller(com.biglybt.pif.installer.PluginInstaller) PluginInstallationListener(com.biglybt.pif.installer.PluginInstallationListener) MdiEntry(com.biglybt.ui.mdi.MdiEntry) AERunnable(com.biglybt.core.util.AERunnable) ArrayList(java.util.ArrayList) List(java.util.List) MdiEntryVitalityImage(com.biglybt.ui.mdi.MdiEntryVitalityImage)

Example 14 with MultipleDocumentInterface

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;
}
Also used : UpdateCheckInstanceListener(com.biglybt.pif.update.UpdateCheckInstanceListener) ParameterListener(com.biglybt.core.config.ParameterListener) UIInputReceiverListener(com.biglybt.pif.ui.UIInputReceiverListener) CoreRunningListener(com.biglybt.core.CoreRunningListener) MdiEntry(com.biglybt.ui.mdi.MdiEntry) MultipleDocumentInterface(com.biglybt.ui.mdi.MultipleDocumentInterface)

Example 15 with MultipleDocumentInterface

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);
}
Also used : MdiEntry(com.biglybt.ui.mdi.MdiEntry) MultipleDocumentInterface(com.biglybt.ui.mdi.MultipleDocumentInterface) MdiCloseListener(com.biglybt.ui.mdi.MdiCloseListener) MdiEntryDropListener(com.biglybt.ui.mdi.MdiEntryDropListener)

Aggregations

MultipleDocumentInterface (com.biglybt.ui.mdi.MultipleDocumentInterface)27 MdiEntry (com.biglybt.ui.mdi.MdiEntry)15 SWTSkinObject (com.biglybt.ui.swt.skin.SWTSkinObject)6 PluginInterface (com.biglybt.pif.PluginInterface)5 Point (org.eclipse.swt.graphics.Point)5 ParameterListener (com.biglybt.core.config.ParameterListener)4 UIManager (com.biglybt.pif.ui.UIManager)4 MdiListener (com.biglybt.ui.mdi.MdiListener)4 ArrayList (java.util.ArrayList)4 Event (org.eclipse.swt.widgets.Event)4 Listener (org.eclipse.swt.widgets.Listener)4 CoreRunningListener (com.biglybt.core.CoreRunningListener)3 Subscription (com.biglybt.core.subs.Subscription)3 BaseMdiEntry (com.biglybt.ui.swt.mdi.BaseMdiEntry)3 GlobalManager (com.biglybt.core.global.GlobalManager)2 LogEvent (com.biglybt.core.logging.LogEvent)2 UIManagerListener (com.biglybt.pif.ui.UIManagerListener)2 UIPluginViewToolBarListener (com.biglybt.pif.ui.UIPluginViewToolBarListener)2 TableColumnCreationListener (com.biglybt.pif.ui.tables.TableColumnCreationListener)2 UIFunctions (com.biglybt.ui.UIFunctions)2