private static void addFreeBurnUI() { final MultipleDocumentInterface mdi = UIFunctionsManager.getUIFunctions().getMDI(); MdiEntry existingEntry = mdi.getEntry(MultipleDocumentInterface.SIDEBAR_HEADER_DVD); if (existingEntry != null) { // abandon all hope, something already added DVD stuff return; } mdi.registerEntry( MultipleDocumentInterface.SIDEBAR_SECTION_BURN_INFO, new MdiEntryCreationListener() { public MdiEntry createMDiEntry(String id) { MdiEntry entryAbout = mdi.createEntryFromSkinRef( MultipleDocumentInterface.SIDEBAR_HEADER_DVD, MultipleDocumentInterface.SIDEBAR_SECTION_BURN_INFO, "main.burn.ftux", MessageText.getString("mdi.entry.about.dvdburn"), null, null, false, null); entryAbout.setImageLeftID("image.sidebar.dvdburn"); entryAbout.setExpanded(true); entryAbout.addListener( new MdiEntryDropListener() { public boolean mdiEntryDrop(MdiEntry entry, Object droppedObject) { openTrialAskWindow(); return true; } }); MenuManager menuManager = PluginInitializer.getDefaultInterface().getUIManager().getMenuManager(); MenuItem menuHide = menuManager.addMenuItem( "Sidebar." + MultipleDocumentInterface.SIDEBAR_SECTION_BURN_INFO, "popup.error.hide"); menuHide.addListener( new MenuItemListener() { public void selected(MenuItem menu, Object target) { mdi.closeEntry(MultipleDocumentInterface.SIDEBAR_SECTION_BURN_INFO); } }); return entryAbout; } }); mdi.addListener( new MdiEntryLoadedListener() { public void mdiEntryLoaded(MdiEntry entry) { if (!entry.getId().equals(MultipleDocumentInterface.SIDEBAR_HEADER_DVD)) { return; } MdiEntryVitalityImage addSub = entry.addVitalityImage("image.sidebar.subs.add"); addSub.addListener( new MdiEntryVitalityImageListener() { public void mdiEntryVitalityImage_clicked(int x, int y) { openTrialAskWindow(); } }); } }); mdi.registerEntry( MultipleDocumentInterface.SIDEBAR_SECTION_PLUS, new MdiEntryCreationListener() { public MdiEntry createMDiEntry(String id) { String title = MessageText.getString( FeatureManagerUI.hasFullLicence() ? "mdi.entry.plus.full" : "mdi.entry.plus.free"); String placeBelow = mdi.getEntry(MultipleDocumentInterface.SIDEBAR_SECTION_WELCOME) == null ? "" : MultipleDocumentInterface.SIDEBAR_SECTION_WELCOME; MdiEntry entry = mdi.createEntryFromSkinRef( MultipleDocumentInterface.SIDEBAR_HEADER_VUZE, MultipleDocumentInterface.SIDEBAR_SECTION_PLUS, "main.area.plus", title, null, null, true, placeBelow); entry.setImageLeftID("image.sidebar.plus"); return entry; } }); if (ConfigurationChecker.isNewVersion() && !ConfigurationChecker.isNewInstall() && !hasFullLicence()) { SBC_PlusFTUX.setSourceRef("startup"); mdi.showEntryByID(MultipleDocumentInterface.SIDEBAR_SECTION_PLUS); } }
/** * @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(); if (MultipleDocumentInterface.SIDEBAR_SECTION_PLUS.equals(target)) { SBC_PlusFTUX.setSourceRef(url.substring(1)); mdi.showEntryByID(target); return; } // Note; We don't setSourceRef on ContentNetwork here like we do // everywhere else because the source ref should already be set // by the caller if (mdi == null || !mdi.showEntryByID(target)) { Utils.launch(url); return; } MdiEntry entry = mdi.getEntry(target); entry.addListener( new MdiEntryOpenListener() { 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 { String fullURL = url; if (UrlFilter.getInstance().urlCanRPC(url)) { // 4010 Tux: This shouldn't be.. either determine ContentNetwork from // url or target, or do something.. fullURL = ConstantsVuze.getDefaultContentNetwork().appendURLSuffix(url, false, true); } soBrowser.setURL(fullURL); } } } }); }