Package org.gudy.azureus2.core3.disk

Examples of org.gudy.azureus2.core3.disk.DiskManagerFileInfo


      out.println("Status: " + trackerclient.getStatusString());
    } else
      out.println("  Not available");
   
    out.println("- Files Info -");
    DiskManagerFileInfo files[] = dm.getDiskManagerFileInfo();
    if (files != null) {
      for (int i = 0; i < files.length; i++) {
        out.print(((i < 9) ? "   " : "  ") + Integer.toString(i + 1)
            + " (");
        String tmp = ">";
View Full Code Here


    for (int i = datasources.length - 1; i >= 0; i--) {
      if (datasources[i] instanceof DownloadManager) {
        DownloadManager dm = (DownloadManager) datasources[i];
        ManagerUtils.run(dm);
      } else if (datasources[i] instanceof DiskManagerFileInfo) {
        DiskManagerFileInfo info = (DiskManagerFileInfo) datasources[i];
        Utils.launch(info);
      }
    }
  }
View Full Code Here

  private static DiskManagerFileInfo[] toDMFI(Object[] objects) {
    int count = 0;
    DiskManagerFileInfo[] result = new DiskManagerFileInfo[objects.length];
    for (Object object : objects) {
      if (object instanceof DiskManagerFileInfo) {
        DiskManagerFileInfo fileInfo = (DiskManagerFileInfo) object;
        result[count++] = fileInfo;
      } else if (object instanceof SelectedContent) {
        SelectedContent sc = (SelectedContent) object;
        int fileIndex = sc.getFileIndex();
        if (fileIndex >= 0 && sc.getDownloadManager() != null) {
View Full Code Here

              canStop = true;
            }
          } else {
            DiskManagerFileInfo[] fileInfos = dm.getDiskManagerFileInfo();
            if (fileIndex < fileInfos.length) {
              DiskManagerFileInfo fileInfo = fileInfos[fileIndex];
              if (!canStart && (fileInfo.isSkipped())) {
                canStart = true;
              }
             
              if (!canStop && !fileInfo.isSkipped()) {
                canStop = true;
              }
             
              if (!canRemoveFileInfo && !fileInfo.isSkipped()) {
                int storageType = fileInfo.getStorageType();
                if (storageType == DiskManagerFileInfo.ST_LINEAR
                    || storageType == DiskManagerFileInfo.ST_COMPACT) {
                  canRemoveFileInfo = true;
                }
              }
             
              if (!canRunFileInfo
                  && fileInfo.getAccessMode() == DiskManagerFileInfo.READ
                  && fileInfo.getDownloaded() == fileInfo.getLength()
                  && fileInfo.getFile(true).exists()) {
                canRunFileInfo = true;
              }
            }
          }
        }
View Full Code Here

    Messages.setLanguageText(itemExplore, "MyTorrentsView.menu."
        + (use_open_containing_folder ? "open_parent_folder" : "explore"));
    itemExplore.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event event) {
        for (int i = data_sources.length - 1; i >= 0; i--) {
          DiskManagerFileInfo info = (DiskManagerFileInfo) data_sources[i];
          if (info != null) {
            ManagerUtils.open(info, use_open_containing_folder);
          }
        }
      }
    });
    itemExplore.setEnabled(hasSelection);

    MenuItem itemRenameOrRetarget = null, itemRename = null, itemRetarget = null;

    itemRenameOrRetarget = new MenuItem(menu, SWT.PUSH);
    Messages.setLanguageText(itemRenameOrRetarget, "FilesView.menu.rename");
    itemRenameOrRetarget.setData("rename", Boolean.valueOf(true));
    itemRenameOrRetarget.setData("retarget", Boolean.valueOf(true));

    itemRename = new MenuItem(menu, SWT.PUSH);
    itemRetarget = new MenuItem(menu, SWT.PUSH);
    Messages.setLanguageText(itemRename, "FilesView.menu.rename_only");
    Messages.setLanguageText(itemRetarget, "FilesView.menu.retarget");

    itemRename.setData("rename", Boolean.valueOf(true));
    itemRename.setData("retarget", Boolean.valueOf(false));
    itemRetarget.setData("rename", Boolean.valueOf(false));
    itemRetarget.setData("retarget", Boolean.valueOf(true));

    final MenuItem itemPriority = new MenuItem(menu, SWT.CASCADE);
    Messages.setLanguageText(itemPriority, "FilesView.menu.setpriority");

    final Menu menuPriority = new Menu(shell, SWT.DROP_DOWN);
    itemPriority.setMenu(menuPriority);

    final MenuItem itemHigh = new MenuItem(menuPriority, SWT.CASCADE);
    itemHigh.setData("Priority", PRIORITY_HIGH);
    Messages.setLanguageText(itemHigh, "FilesView.menu.setpriority.high");

    final MenuItem itemLow = new MenuItem(menuPriority, SWT.CASCADE);
    itemLow.setData("Priority", PRIORITY_NORMAL);
    Messages.setLanguageText(itemLow, "FilesView.menu.setpriority.normal");

    final MenuItem itemNumeric = new MenuItem(menuPriority, SWT.CASCADE);
    itemNumeric.setData("Priority", PRIORITY_NUMERIC);
    Messages.setLanguageText(itemNumeric, "FilesView.menu.setpriority.numeric");

    final MenuItem itemSkipped = new MenuItem(menuPriority, SWT.CASCADE);
    itemSkipped.setData("Priority", PRIORITY_SKIPPED);
    Messages.setLanguageText(itemSkipped, "FilesView.menu.setpriority.skipped");

    final MenuItem itemDelete = new MenuItem(menuPriority, SWT.CASCADE);
    itemDelete.setData("Priority", PRIORITY_DELETE);
    Messages.setLanguageText(itemDelete, "wizard.multitracker.delete"); // lazy but we're near release

    new MenuItem(menu, SWT.SEPARATOR);

    if (!hasSelection) {
      itemOpen.setEnabled(false);
      itemPriority.setEnabled(false);
      itemRenameOrRetarget.setEnabled(false);
      itemRename.setEnabled(false);
      itemRetarget.setEnabled(false);
      return;
    }

    boolean open = true;
    boolean all_compact = true;
    boolean all_skipped = true;
    boolean all_priority = true;
    boolean all_not_priority = true;

    DiskManagerFileInfo[] dmi_array = new DiskManagerFileInfo[data_sources.length];

    System.arraycopy(data_sources, 0, dmi_array, 0, data_sources.length);

    int[] storage_types = manager.getStorageType(dmi_array);

    for (int i = 0; i < dmi_array.length; i++) {

      DiskManagerFileInfo file_info = dmi_array[i];

      if (open && file_info.getAccessMode() != DiskManagerFileInfo.READ) {

        open = false;
      }

      if (all_compact && storage_types[i] != DiskManagerFileInfo.ST_COMPACT && storage_types[i] != DiskManagerFileInfo.ST_REORDER_COMPACT ) {
        all_compact = false;
      }

      if (all_skipped || all_priority || all_not_priority) {
        if (file_info.isSkipped()) {
          all_priority = false;
          all_not_priority = false;
        } else {
          all_skipped = false;

          // Only do this check if we need to.
          if (all_not_priority || all_priority) {
            if (file_info.getPriority() > 0 ) {
              all_not_priority = false;
            } else {
              all_priority = false;
            }
          }
        }
      }
    }

    // we can only open files if they are read-only

    itemOpen.setEnabled(open);

    // can't rename files for non-persistent downloads (e.g. shares) as these
    // are managed "externally"

    itemRenameOrRetarget.setEnabled(manager.isPersistent());
    itemRename.setEnabled(manager.isPersistent());
    itemRetarget.setEnabled(manager.isPersistent());

    itemSkipped.setEnabled(!all_skipped);

    itemHigh.setEnabled(!all_priority);

    itemLow.setEnabled(!all_not_priority);

    itemDelete.setEnabled(!all_compact);

    itemOpen.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event event) {
        for (int i = 0; i < data_sources.length; i++) {
          DiskManagerFileInfo info = (DiskManagerFileInfo) data_sources[i];
          if (info != null && info.getAccessMode() == DiskManagerFileInfo.READ) {
            Utils.launch(info);
          }
        }
      }
    });
View Full Code Here

    }

    boolean paused = false;
    try {
      for (int i = 0; i < datasources.length; i++) {
        final DiskManagerFileInfo fileInfo = (DiskManagerFileInfo) datasources[i];
        File existing_file = fileInfo.getFile(true);
        File f_target = null;
        if (rename_it && retarget_it) {
          String s_target = askForRetargetedFilename(fileInfo);
          if (s_target != null)
            f_target = new File(s_target);
View Full Code Here

    info.setProficiency(TableColumnInfo.PROFICIENCY_BEGINNER);
  }

  public void refresh(TableCell cell) {
   
    DiskManagerFileInfo fileInfo = (DiskManagerFileInfo)cell.getDataSource();
 
    long percent = 0;
 
    if (fileInfo != null ){
      long bytesDownloaded = fileInfo.getDownloaded();
   
    if ( bytesDownloaded < 0 ){
     
      percent = -1; // unknown skeleton value
     
    }else if ( fileInfo.getLength() != 0 ){

      percent = (1000 * bytesDownloaded) / fileInfo.getLength();
    }else{
     
      percent = 1000;
    }
   
View Full Code Here

    });
    info.setProficiency(TableColumnInfo.PROFICIENCY_INTERMEDIATE);
  }

  public void refresh(TableCell cell) {
    DiskManagerFileInfo fileInfo = (DiskManagerFileInfo)cell.getDataSource();
    cell.setText(determineFileExt(fileInfo));
  }
View Full Code Here

    });
    info.setProficiency(TableColumnInfo.PROFICIENCY_BEGINNER);
  }

  public void refresh(TableCell cell) {
    DiskManagerFileInfo fileInfo = (DiskManagerFileInfo)cell.getDataSource();
    long value = (fileInfo == null) ? 0 : fileInfo.getLength();

    if( !cell.setSortValue( value ) && cell.isValid() ) {
      return;
    }
   
View Full Code Here

    });
    info.setProficiency(TableColumnInfo.PROFICIENCY_INTERMEDIATE);
  }

  public void refresh(TableCell cell) {
    DiskManagerFileInfo fileInfo   = (DiskManagerFileInfo)cell.getDataSource();
 
    //   dm may be null if this is a skeleton file view
 
    DiskManager      dm      = fileInfo==null?null:fileInfo.getDiskManager();
 
    int remaining = 0;
   
    if( fileInfo != null && dm != null ) {
      int start = fileInfo.getFirstPieceNumber();
      int end = start + fileInfo.getNbPieces();
      DiskManagerPiece[] pieces = dm.getPieces();
      for( int i = start; i < end; i++ ) {
        if( !pieces[ i ].isDone() )  remaining++;
      }
    }else{
View Full Code Here

TOP

Related Classes of org.gudy.azureus2.core3.disk.DiskManagerFileInfo

Copyright © 2018 www.massapicom. 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.