public void failed(String licence_key, PluginException error) { if (alreadyFailing) { return; } alreadyFailing = true; UIFunctionsManager.getUIFunctions() .promptUser( MessageText.getString("dlg.auth.install.failed.title"), MessageText.getString( "dlg.auth.install.failed.text", new String[] {licence_key, Debug.getNestedExceptionMessage(error)}), new String[] {MessageText.getString("Button.ok")}, 0, null, null, false, 0, new UserPrompterResultListener() { public void prompterClosed(int result) { alreadyFailing = false; } }); Logger.log(new LogAlert(true, "Error while installing " + licence_key, error)); box.close(0); licence.removeInstallationListener(this); }
static final int clickDockIcon(int nextHandler, int theEvent, int userData) { UIFunctions uiFunctions = UIFunctionsManager.getUIFunctions(); if (uiFunctions != null) { uiFunctions.bringToFront(); return noErr; } return eventNotHandledErr; }
static final int quitAppProc(int theAppleEvent, int reply, int handlerRefcon) { UIFunctions uiFunctions = UIFunctionsManager.getUIFunctions(); if (uiFunctions != null) { uiFunctions.dispose(false, false); } else { UIExitUtilsSWT.setSkipCloseCheck(true); Display.getDefault().dispose(); } return noErr; }
public void doSearch(String sSearchText, boolean toSubscribe) { if (sSearchText.length() == 0) { return; } if (checkForSpecialSearchTerm(sSearchText)) { return; } SearchResultsTabArea.SearchQuery sq = new SearchResultsTabArea.SearchQuery(sSearchText, toSubscribe); MultipleDocumentInterface mdi = UIFunctionsManager.getUIFunctions().getMDI(); String id = MultipleDocumentInterface.SIDEBAR_SECTION_SEARCH; MdiEntry existingEntry = mdi.getEntry(id); if (existingEntry != null && existingEntry.isAdded()) { SearchResultsTabArea searchClass = (SearchResultsTabArea) SkinViewManager.getByClass(SearchResultsTabArea.class); if (searchClass != null) { searchClass.anotherSearch(sSearchText, toSubscribe); } 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 ViewTitleInfo() { public Object getTitleInfoProperty(int propertyID) { if (propertyID == TITLE_TEXT) { SearchResultsTabArea searchClass = (SearchResultsTabArea) SkinViewManager.getByClass(SearchResultsTabArea.class); if (searchClass != null && searchClass.sq != null) { return searchClass.sq.term; } } return null; } }); } mdi.showEntryByID(id); }
// @see com.aelitis.azureus.ui.swt.UIFunctionsSWT#closePluginViews(java.lang.String) public void closePluginViews(String sViewID) { try { MultipleDocumentInterface mdi = UIFunctionsManager.getUIFunctions().getMDI(); if (mdi == null) { return; } mdi.closeEntry(sViewID); } catch (Exception e) { Logger.log(new LogEvent(LOGID, "closePluginViews", e)); } }
// @see com.aelitis.azureus.ui.swt.UIFunctionsSWT#closeAllDetails() public void closeAllDetails() { MultipleDocumentInterface mdi = UIFunctionsManager.getUIFunctions().getMDI(); if (mdi == null) { return; } MdiEntry[] sideBarEntries = mdi.getEntries(); for (int i = 0; i < sideBarEntries.length; i++) { MdiEntry entry = sideBarEntries[i]; String id = entry.getId(); if (id != null && id.startsWith("DMDetails_")) { mdi.closeEntry(id); } } }
// @see com.aelitis.azureus.ui.swt.UIFunctionsSWT#hasDetailViews() public boolean hasDetailViews() { MultipleDocumentInterface mdi = UIFunctionsManager.getUIFunctions().getMDI(); if (mdi == null) { return false; } MdiEntry[] sideBarEntries = mdi.getEntries(); for (int i = 0; i < sideBarEntries.length; i++) { MdiEntry entry = sideBarEntries[i]; String id = entry.getId(); if (id != null && id.startsWith("DMDetails_")) { return true; } } return false; }
/* (non-Javadoc) * @see com.aelitis.azureus.ui.swt.UIFunctionsSWT#closePluginView(org.gudy.azureus2.ui.swt.pluginsimpl.UISWTViewCore) */ public void closePluginView(UISWTViewCore view) { try { MultipleDocumentInterface mdi = UIFunctionsManager.getUIFunctions().getMDI(); if (mdi == null) { return; } String id; if (view instanceof UISWTViewImpl) { id = ((UISWTViewImpl) view).getViewID(); } else { id = view.getClass().getName(); int i = id.lastIndexOf('.'); if (i > 0) { id = id.substring(i + 1); } } mdi.closeEntry(id); } catch (Exception e) { Logger.log(new LogEvent(LOGID, "closePluginView", e)); } }
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); } }
static final int commandProc(int nextHandler, int theEvent, int userData) { try { int kind = ((Number) invoke(claOS, null, "GetEventKind", new Object[] {theEvent})).intValue(); if (kind == kEventProcessCommand) { Object command = claHICommand.newInstance(); // int GetEventParameter(int inEvent, int inName, int inDesiredType, // int[] outActualType, int inBufferSize, int[] outActualSize, HICommand outData); invoke( claOS, null, "GetEventParameter", new Class[] { int.class, int.class, int.class, int[].class, int.class, int[].class, claHICommand }, new Object[] { theEvent, kEventParamDirectObject, typeHICommand, null, claHICommand.getField("sizeof").getInt(command), null, command }); int commandID = claHICommand.getField("commandID").getInt(command); switch (commandID) { case kHICommandPreferences: { UIFunctions uiFunctions = UIFunctionsManager.getUIFunctions(); if (uiFunctions != null) { uiFunctions.openView(UIFunctions.VIEW_CONFIG, null); } return noErr; } case kHICommandAbout: AboutWindow.show(); return noErr; case kHICommandRestart: { UIFunctions uiFunctions = UIFunctionsManager.getUIFunctions(); if (uiFunctions != null) { uiFunctions.dispose(true, false); } return noErr; } case kHICommandWizard: new ConfigureWizard(false, ConfigureWizard.WIZARD_MODE_FULL); return noErr; case kHICommandNatTest: new NatTestWindow(); return noErr; case kHICommandSpeedTest: new SpeedTestWizard(); return noErr; case kAEQuitApplication: UIFunctions uiFunctions = UIFunctionsManager.getUIFunctions(); if (uiFunctions != null) { uiFunctions.dispose(false, false); return noErr; } else { UIExitUtilsSWT.setSkipCloseCheck(true); } default: break; } } } catch (Throwable t) { Debug.out(t); } return eventNotHandledErr; }
/** * @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); } } } }); }
private void _openView(int viewID, Object data) { switch (viewID) { case VIEW_CONSOLE: openView(SideBar.SIDEBAR_HEADER_PLUGINS, LoggerView.class, null, data, true); break; case VIEW_ALLPEERS: openView(SideBar.SIDEBAR_HEADER_TRANSFERS, PeersSuperView.class, null, data, true); break; case VIEW_PEERS_STATS: openView(SideBar.SIDEBAR_HEADER_PLUGINS, ClientStatsView.class, null, data, true); break; case VIEW_CONFIG: showConfig((data instanceof String) ? (String) data : null); break; case VIEW_DM_DETAILS: { String id = SideBar.SIDEBAR_TORRENT_DETAILS_PREFIX; if (data instanceof DownloadManager) { DownloadManager dm = (DownloadManager) data; TOTorrent torrent = dm.getTorrent(); if (torrent != null) { try { id += torrent.getHashWrapper().toBase32String(); } catch (TOTorrentException e) { e.printStackTrace(); } } } MultipleDocumentInterface mdi = UIFunctionsManager.getUIFunctions().getMDI(); if (mdi != null) { mdi.loadEntryByID(id, true, false, data); } } break; case VIEW_DM_MULTI_OPTIONS: openView(SideBar.SIDEBAR_HEADER_TRANSFERS, TorrentOptionsView.class, null, data, true); break; case VIEW_MYSHARES: openView(SideBar.SIDEBAR_HEADER_TRANSFERS, MySharesView.class, null, data, true); break; case VIEW_MYTORRENTS: { MultipleDocumentInterface mdi = UIFunctionsManager.getUIFunctions().getMDI(); if (mdi != null) { mdi.showEntryByID(SideBar.SIDEBAR_SECTION_LIBRARY); } } break; case VIEW_MYTRACKER: openView(SideBar.SIDEBAR_HEADER_TRANSFERS, MyTrackerView.class, null, data, true); break; case VIEW_TAGS_OVERVIEW: { MultipleDocumentInterface mdi = UIFunctionsManager.getUIFunctions().getMDI(); if (mdi != null) { mdi.showEntryByID(MultipleDocumentInterface.SIDEBAR_SECTION_TAGS); } break; } case VIEW_TAG: { if (data instanceof Tag) { Tag tag = (Tag) data; String id = "Tag." + tag.getTagType().getTagType() + "." + tag.getTagID(); MultipleDocumentInterface mdi = UIFunctionsManager.getUIFunctions().getMDI(); if (mdi != null) { mdi.loadEntryByID(id, true, false, data); } } break; } default: break; } }