Examples of DownloadManager


Examples of org.gudy.azureus2.core3.download.DownloadManager

    Object[] dataSources = tv.getSelectedDataSources(true);
    DownloadManager[] dms = getSelectedDownloads();
   
    if (dms.length == 0 && dataSources.length > 0) {
      List<DiskManagerFileInfo> listFileInfos = new ArrayList<DiskManagerFileInfo>();
      DownloadManager firstFileDM = null;
      for (Object ds : dataSources) {
        if (ds instanceof DiskManagerFileInfo) {
          DiskManagerFileInfo info = (DiskManagerFileInfo) ds;
          // for now, FilesViewMenuUtil.fillmenu can only handle one DM
          if (firstFileDM != null && !firstFileDM.equals(info.getDownloadManager())) {
            break;
          }
          firstFileDM = info.getDownloadManager();
          listFileInfos.add(info);
        }
View Full Code Here

Examples of org.gudy.azureus2.core3.download.DownloadManager

            boolean onlyDMs = true;
            StringBuffer sb = new StringBuffer();
            Object[] selectedDataSources = tv.getSelectedDataSources(true);
            for (Object ds : selectedDataSources) {
              if (ds instanceof DownloadManager) {
                DownloadManager dm = (DownloadManager) ds;
                TOTorrent torrent = dm.getTorrent();
                if (torrent != null) {
                  try {
                    sb.append(torrent.getHashWrapper().toBase32String());
                    sb.append('\n');
                  } catch (TOTorrentException e) {
                  }
                }
              } else if (ds instanceof DiskManagerFileInfo) {
                DiskManagerFileInfo fileInfo = (DiskManagerFileInfo) ds;
                DownloadManager dm = fileInfo.getDownloadManager();
                TOTorrent torrent = dm.getTorrent();
                if (torrent != null) {
                  try {
                    sb.append(torrent.getHashWrapper().toBase32String());
                    sb.append(';');
                    sb.append(fileInfo.getIndex());
                    sb.append('\n');
                    onlyDMs = false;
                  } catch (TOTorrentException e) {
                  }
                }
              }
            }
           
            eventData = (onlyDMs ? "DownloadManager\n" : "DiskManagerFileInfo\n") + sb.toString();
          }

          public void dragSetData(DragSourceEvent event) {
            // System.out.println("DragSetData");
            event.data = eventData;
          }
        });
      }

      dropTarget = tv.createDropTarget(DND.DROP_DEFAULT | DND.DROP_MOVE
          | DND.DROP_COPY | DND.DROP_LINK | DND.DROP_TARGET_MOVE);
      if (dropTarget != null) {
        dropTarget.setTransfer(new Transfer[] { HTMLTransfer.getInstance(),
            URLTransfer.getInstance(), FileTransfer.getInstance(),
            TextTransfer.getInstance() });

        dropTarget.addDropListener(new DropTargetAdapter() {
          Point enterPoint = null;
          public void dropAccept(DropTargetEvent event) {
            event.currentDataType = URLTransfer.pickBestType(event.dataTypes,
                event.currentDataType);
          }

          public void dragEnter(DropTargetEvent event) {
            // no event.data on dragOver, use drag_drop_line_start to determine
            // if ours
            if (drag_drop_line_start < 0) {
              if (event.detail != DND.DROP_COPY) {
                if ((event.operations & DND.DROP_LINK) > 0)
                  event.detail = DND.DROP_LINK;
                else if ((event.operations & DND.DROP_COPY) > 0)
                  event.detail = DND.DROP_COPY;
              }
            } else if (TextTransfer.getInstance().isSupportedType(
                event.currentDataType)) {
              event.detail = event.item == null ? DND.DROP_NONE : DND.DROP_MOVE;
              event.feedback = DND.FEEDBACK_SCROLL;
              enterPoint = new Point(event.x, event.y);
            }
          }

          public void dragOver(DropTargetEvent event) {
            if (drag_drop_line_start >= 0) {
              if (drag_drop_rows.length > 0
                  && !(drag_drop_rows[0].getDataSource(true) instanceof DownloadManager)) {
                event.detail = DND.DROP_NONE;
                return;
              }
              event.detail = event.item == null ? DND.DROP_NONE : DND.DROP_MOVE;
              event.feedback = DND.FEEDBACK_SCROLL
                  | ((enterPoint != null && enterPoint.y > event.y)
                      ? DND.FEEDBACK_INSERT_BEFORE : DND.FEEDBACK_INSERT_AFTER);
            }
          }

          public void drop(DropTargetEvent event) {
            if (!(event.data instanceof String)) {
              TorrentOpener.openDroppedTorrents(event, true);
              return;
            }
            String data = (String) event.data;
            if (data.startsWith("DiskManagerFileInfo\n")) {
              return;
            }
            if (!data.startsWith("DownloadManager\n")) {
              TorrentOpener.openDroppedTorrents(event, true);
              return;
            }

            event.detail = DND.DROP_NONE;
            // Torrent file from shell dropped
            if (drag_drop_line_start >= 0) { // event.data == null
              event.detail = DND.DROP_NONE;
              TableRowCore row = tv.getRow(event);
              if (row == null)
                return;
              if (row.getParentRowCore() != null) {
                row = row.getParentRowCore();
              }
              int drag_drop_line_end = row.getIndex();
              if (drag_drop_line_end != drag_drop_line_start) {
                DownloadManager dm = (DownloadManager) row.getDataSource(true);
                moveRowsTo(drag_drop_rows, dm.getPosition());
                event.detail = DND.DROP_MOVE;
              }
              drag_drop_line_start = -1;
              drag_drop_rows = null;
            }
View Full Code Here

Examples of org.gudy.azureus2.core3.download.DownloadManager

      TableRowCore row = rows[i];
      Object ds = row.getDataSource(true);
      if (!(ds instanceof DownloadManager)) {
        continue;
      }
      DownloadManager dm = (DownloadManager) ds;
      int iOldPos = dm.getPosition();
     
      globalManager.moveTo(dm, iNewPos);
      if (isSortAscending) {
        if (iOldPos > iNewPos)
          iNewPos++;
View Full Code Here

Examples of org.gudy.azureus2.core3.download.DownloadManager

      public int compare(DownloadManager a, DownloadManager b) {
        return a.getPosition() - b.getPosition();
      }
    });
    for (int i = dms.length - 1; i >= 0; i--) {
      DownloadManager dm = dms[i];
      if (dm.getGlobalManager().isMoveableDown(dm)) {
        dm.getGlobalManager().moveDown(dm);
      }
    }

    boolean bForceSort = tv.getSortColumn().getName().equals("#");
    tv.columnInvalidate("#");
View Full Code Here

Examples of org.gudy.azureus2.core3.download.DownloadManager

      public int compare(DownloadManager a, DownloadManager b) {
        return a.getPosition() - b.getPosition();
      }
    });
    for (int i = 0; i < dms.length; i++) {
      DownloadManager dm = dms[i];
      if (dm.getGlobalManager().isMoveableUp(dm)) {
        dm.getGlobalManager().moveUp(dm);
      }
    }

    boolean bForceSort = tv.getSortColumn().getName().equals("#");
    tv.columnInvalidate("#");
View Full Code Here

Examples of org.gudy.azureus2.core3.download.DownloadManager

      });
    }

    int count = globalManager.downloadManagerCount(isSeedingView);
    for (int i = 0; i < dms.length; i++) {
      DownloadManager dm = dms[i];
      int pos = dm.getPosition() + by;
      if (pos < i + 1)
        pos = i + 1;
      else if (pos > count - i)
        pos = count - i;

      newPositions[i] = pos;
    }

    for (int i = 0; i < dms.length; i++) {
      DownloadManager dm = dms[i];
      globalManager.moveTo(dm, newPositions[i]);
    }

    boolean bForceSort = tv.getSortColumn().getName().equals("#");
    tv.columnInvalidate("#");
View Full Code Here

Examples of org.gudy.azureus2.core3.download.DownloadManager

    Object[] managers = globalManager.getDownloadManagers().toArray();
    List<DownloadManager> listRemoves = new ArrayList<DownloadManager>();
    List<DownloadManager> listAdds = new ArrayList<DownloadManager>();
   
    for (int i = 0; i < managers.length; i++) {
      DownloadManager dm = (DownloadManager) managers[i];
   
      boolean bHave = tv.isUnfilteredDataSourceAdded(dm);
      if (!isOurDownloadManager(dm)) {
        if (bHave) {
          listRemoves.add(dm);
View Full Code Here

Examples of org.gudy.azureus2.core3.download.DownloadManager

    Object ds = rowCore.getDataSource(true);
    if (!(ds instanceof DownloadManager)) {
      return;
    }

    DownloadManager dm = (DownloadManager) ds;
    if (rowCore.getSubItemCount() == 0 && dm.getTorrent() != null
        && !dm.getTorrent().isSimpleTorrent() && rowCore.isVisible()
        && dm.getNumFileInfos() > 0) {
      DiskManagerFileInfoSet fileInfos = dm.getDiskManagerFileInfoSet();
      if (fileInfos != null) {
        DiskManagerFileInfo[] files = fileInfos.getFiles();
        boolean copied = false;
        int pos = 0;
        for (int i = 0; i < files.length; i++) {
View Full Code Here

Examples of org.gudy.azureus2.core3.download.DownloadManager

    // required a core, so we assume there's a core here

    List dms = AzureusCoreFactory.getSingleton().getGlobalManager().getDownloadManagers();

    for (int i = 0; i < dms.size(); i++) {
      DownloadManager dm = (DownloadManager) dms.get(i);

      try {
        byte[] share_hash = null;

        if (share.getType() == ShareResource.ST_DIR) {

          share_hash = ((ShareResourceDir) share).getItem().getTorrent().getHash();

        } else if (share.getType() == ShareResource.ST_FILE) {

          share_hash = ((ShareResourceFile) share).getItem().getTorrent().getHash();
        }

        if (Arrays.equals(share_hash, dm.getTorrent().getHash())) {

          UIFunctions uiFunctions = UIFunctionsManager.getUIFunctions();
          if (uiFunctions != null) {
            uiFunctions.openView(UIFunctions.VIEW_DM_DETAILS, dm);
          }
View Full Code Here

Examples of org.gudy.azureus2.core3.download.DownloadManager

        }
      }
    } catch (Exception e) {
    }

    DownloadManager existingDownload = null;
    if (sExistingName == null) {
      // Check if torrent already exists in gm, and add if not
      existingDownload = (gm == null) ? null : gm.getDownloadManager(torrent);
      if (existingDownload != null) {
        sExistingName = existingDownload.getDisplayName();
      }
    }

    if (sExistingName == null) {
      info = new TorrentInfo(torrentFile.getAbsolutePath(), torrent,
          bDeleteFileOnCancel);
      info.sOriginatingLocation = sOriginatingLocation;
      torrentList.add(info);

    } else {

      final String sfExistingName = sExistingName;
      final DownloadManager fExistingDownload = existingDownload;
      Utils.execSWTThread(new AERunnable() {
        public void runSupport() {
          Shell mainShell = UIFunctionsManagerSWT.getUIFunctionsSWT().getMainShell();
          if (Display.getDefault().getActiveShell() == null || !mainShell.isVisible() || mainShell.getMinimized() ) {
            new MessageSlideShell(Display.getCurrent(), SWT.ICON_INFORMATION,
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.