示例#1
0
  public void shareTorrent(final SelectedContentV3 currentContent, final String referer) {

    PlatformBuddyMessenger.startShare(
        referer, currentContent.isPlatformContent() ? currentContent.getHash() : null);

    if (!VuzeBuddyManager.isEnabled()) {
      VuzeBuddyManager.showDisabledDialog();
      return;
    }

    // TODO : Gudy : make sure that this private detection method is reliable enough
    if (currentContent.getDM() != null
        && (TorrentUtils.isReallyPrivate(currentContent.getDM().getTorrent()))) {
      Utils.openMessageBox(Utils.findAnyShell(), SWT.OK, "v3.share.private", (String[]) null);
      return;
    }

    SWTLoginUtils.waitForLogin(
        new SWTLoginUtils.loginWaitListener() {
          public void loginComplete() {
            if (null != sharePage) {
              try {
                // sharePage.setShareItem(currentContent, referer);

                ShareWizard wizard =
                    new ShareWizard(
                        UIFunctionsManagerSWT.getUIFunctionsSWT().getMainShell(),
                        SWT.DIALOG_TRIM | SWT.RESIZE);
                wizard.setText("Vuze - Wizard");
                wizard.setSize(500, 550);

                com.aelitis.azureus.ui.swt.shells.friends.SharePage newSharePage =
                    (com.aelitis.azureus.ui.swt.shells.friends.SharePage)
                        wizard.getPage(com.aelitis.azureus.ui.swt.shells.friends.SharePage.ID);
                newSharePage.setShareItem(currentContent, referer);

                /*
                 * Opens a centered free-floating shell
                 */

                UIFunctionsSWT uiFunctions = UIFunctionsManagerSWT.getUIFunctionsSWT();
                if (null == uiFunctions) {
                  /*
                   * Centers on the active monitor
                   */
                  Utils.centreWindow(wizard.getShell());
                } else {
                  /*
                   * Centers on the main application window
                   */
                  Utils.centerWindowRelativeTo(wizard.getShell(), uiFunctions.getMainShell());
                }

                wizard.open();

              } catch (Exception e) {
                e.printStackTrace();
              }
            }
          }
        });
  }