コード例 #1
0
  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);
  }
コード例 #2
0
  // @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));
    }
  }
コード例 #3
0
 // @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);
     }
   }
 }
コード例 #4
0
  // @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;
  }
コード例 #5
0
  /* (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));
    }
  }
コード例 #6
0
  /**
   * @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);
              }
            }
          }
        });
  }
コード例 #7
0
  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;
    }
  }