Package org.gudy.azureus2.plugins.download

Examples of org.gudy.azureus2.plugins.download.Download


  public static MenuItem addBetaMenuItem(Menu menuParent) {
    final MenuItem menuItem = addMenuItem(menuParent, MENU_ID_BETA_PROG,
        new Listener() {
          public void handleEvent(Event e) {
            new BetaWizard();
      }
    });

    COConfigurationManager.addAndFireParameterListener(
        "Beta Programme Enabled", new ParameterListener() {
View Full Code Here


    }
  }
 
  private void buildHeaderArea() {
    if (cCategories == null) {
      cCategories = new CompositeMinSize(cTableParentPanel, SWT.NONE);
      ((CompositeMinSize) cCategories).setMinSize(new Point(SWT.DEFAULT, 24));
      GridData gridData = new GridData(SWT.RIGHT, SWT.TOP, true, false);
      cCategories.setLayoutData(gridData);
      cCategories.moveAbove(null);
    }else if ( cCategories.isDisposed()){
View Full Code Here

        // wiki link
     
      gridData = new GridData();
      gridData.horizontalSpan = 2;

      LinkLabel link = new LinkLabelgJVM, gridData, "ConfigView.label.please.visit.here",
                      "http://wiki.vuze.com/w/Java_VM_memory_usage");
     
        // info
     
      label = new Label(gJVM, SWT.NULL);
View Full Code Here

                  Debug.out( "Shell doesn't exist" );
                 
                  return( null );
                }
               
                StringListChooser chooser = new StringListChooser( shell );
               
                chooser.setTitle( decision_name );
                chooser.setText( decision_description );
               
                for (int i=0;i<options.length;i++){
                 
                  chooser.addOption( options[i] );
                }
               
                String  result = chooser.open();
               
                return( result );
              }
             
              return( null );
View Full Code Here

  }

  public static MenuItem addConfigWizardMenuItem(Menu menu) {
    return addMenuItem(menu, MENU_ID_CONFIGURE, new Listener() {
      public void handleEvent(Event e) {
        new ConfigureWizard(false,ConfigureWizard.WIZARD_MODE_FULL);
      }
    });
  }
View Full Code Here

  public static MenuItem addExportMenuItem(Menu menuParent) {
    MenuItem file_export = addMenuItem(menuParent, MENU_ID_EXPORT,
        new Listener() {
          public void handleEvent(Event e) {
            new ExportTorrentWizard();
          }
        });
    return file_export;
  }
View Full Code Here

  public static MenuItem addImportMenuItem(Menu menuParent) {
    MenuItem file_import = addMenuItem(menuParent, MENU_ID_IMPORT,
        new Listener() {
          public void handleEvent(Event e) {
            new ImportTorrentWizard();
          }
        });
    return file_import;
  }
View Full Code Here

      /*
       * Add a listener to the reporter for a cancel event and cancel the update
       * check instance if the event is detected
       */
      updateReporter.addListener(new IProgressReporterListener() {

        public int report(IProgressReport progressReport) {
          if (progressReport.getReportType() == REPORT_TYPE_DONE
              || progressReport.getReportType() == REPORT_TYPE_ERROR) {
            return RETVAL_OK_TO_DISPOSE;
View Full Code Here

              if ( pos != -1 ){
               
                param_name = param_name.substring( 0, pos ).trim();
              }
             
              MessageBoxShell mb =
                new MessageBoxShell(
                  SWT.ICON_ERROR | SWT.OK,
                  MessageText.getString( "ConfigView.section.invalid.value.title"),
                  MessageText.getString(
                    "ConfigView.section.invalid.value",
                    new String[]{ val, param_name, Debug.getNestedExceptionMessage(e)}));
             
                  mb.setParent( parent.getShell());
                  mb.open(null);
            }
          }
        });
     
      label = new Label(area, SWT.NULL);
      gridData = new GridData(GridData.FILL_HORIZONTAL);
      label.setLayoutData(gridData);
     
      Long max_heap_mb = AEMemoryMonitor.getMaxHeapMB();
     
      if ( max_heap_mb > 0 ){
       
        Messages.setLanguageText(label,  "jvm.max.mem.current", new String[]{ DisplayFormatters.formatByteCountToKiBEtc( max_heap_mb*1024*1024, true )});
      }
    }
   
    {
        // min mem
     
      final int MIN_MIN_JVM = 8*1024*1024;
 
      long  min_mem = AEMemoryMonitor.getJVMLongOption( options, "-Xms" );
 
      GridData gridData = new GridData();
      Label label = new Label(area, SWT.NULL);
      label.setLayoutData(gridData);
      Messages.setLanguageText(label,  "jvm.min.mem", new String[]{encodeDisplayLong(MIN_MIN_JVM)});
 
      gridData = new GridData();
      gridData.widthHint = 125;
      final StringParameter min_vm = new StringParameter(area, "jvm.min.mem", "", false );
      min_vm.setLayoutData(gridData);
       
      min_vm.setValue( min_mem == -1?"":encodeDisplayLong( min_mem ));
     
      min_vm.addChangeListener(
        new ParameterChangeAdapter()
        {
          private String  last_value;
         
          public void
          parameterChanged(
            Parameter  p,
            boolean    caused_internally )
          {
            if ( min_vm.isDisposed()){
             
              min_vm.removeChangeListener( this );
             
              return;
            }
           
            String val = min_vm.getValue();
           
            if ( last_value != null && last_value.equals( val )){
             
              return;
            }
           
            last_value = val;
                     
            try{
              long min_mem = decodeDisplayLong( val );
             
              if ( min_mem < MIN_MIN_JVM ){
               
                throw( new Exception( "Min=" + encodeDisplayLong( MIN_MIN_JVM )));
              }
                         
              String[] options = platform.getExplicitVMOptions();
             
              options = AEMemoryMonitor.setJVMLongOption( options, "-Xms", min_mem );
 
              long  max_mem = AEMemoryMonitor.getJVMLongOption( options, "-Xmx" );
 
              if ( max_mem == -1 || max_mem < min_mem ){
               
                options = AEMemoryMonitor.setJVMLongOption( options, "-Xmx", min_mem );
              }
             
              platform.setExplicitVMOptions( options );
             
              buildOptions( parent, platform, area, true );
             
            }catch( Throwable e ){
             
              String param_name = MessageText.getString( "jvm.min.mem" );
             
              int  pos = param_name.indexOf( '[' );
             
              if ( pos != -1 ){
               
                param_name = param_name.substring( 0, pos ).trim();
              }
             
              MessageBoxShell mb =
                new MessageBoxShell(
                  SWT.ICON_ERROR | SWT.OK,
                  MessageText.getString( "ConfigView.section.invalid.value.title"),
                  MessageText.getString(
                    "ConfigView.section.invalid.value",
                    new String[]{ val, param_name, Debug.getNestedExceptionMessage(e)}));
             
                  mb.setParent( parent.getShell());
                  mb.open(null);
            }
          }
        });
     
      label = new Label(area, SWT.NULL);
      gridData = new GridData(GridData.FILL_HORIZONTAL);
      label.setLayoutData(gridData);
    }
   
    {
        // max DIRECT mem
     
      final int MIN_DIRECT_JVM = 32*1024*1024;
     
      final String OPTION_KEY = "-XX:MaxDirectMemorySize=";
     
      long  max_direct = AEMemoryMonitor.getJVMLongOption( options, OPTION_KEY );
 
      GridData gridData = new GridData();
      Label label = new Label(area, SWT.NULL);
      label.setLayoutData(gridData);
      Messages.setLanguageText(label,  "jvm.max.direct.mem", new String[]{encodeDisplayLong(MIN_DIRECT_JVM)});
 
      gridData = new GridData();
      gridData.widthHint = 125;
      final StringParameter max_direct_vm = new StringParameter(area, "jvm.max.direct.mem", "", false );
      max_direct_vm.setLayoutData(gridData);
       
      max_direct_vm.setValue( max_direct == -1?"":encodeDisplayLong( max_direct ));
     
      max_direct_vm.addChangeListener(
        new ParameterChangeAdapter()
        {
          private String  last_value;
         
          public void
          parameterChanged(
            Parameter  p,
            boolean    caused_internally )
          {
            if ( max_direct_vm.isDisposed()){
             
              max_direct_vm.removeChangeListener( this );
             
              return;
            }
           
            String val = max_direct_vm.getValue();
           
            if ( last_value != null && last_value.equals( val )){
             
              return;
            }
           
            last_value = val;
                     
            try{
              long max_direct = decodeDisplayLong( val );
             
              if ( max_direct < MIN_DIRECT_JVM ){
               
                throw( new Exception( "Min=" + encodeDisplayLong( MIN_DIRECT_JVM )));
              }
                         
              String[] options = platform.getExplicitVMOptions();
             
              options = AEMemoryMonitor.setJVMLongOption( options, OPTION_KEY, max_direct );
               
              platform.setExplicitVMOptions( options );
             
              buildOptions( parent, platform, area, true );
             
            }catch( Throwable e ){
             
              String param_name = MessageText.getString( "jvm.max.direct.mem" );
             
              int  pos = param_name.indexOf( '[' );
             
              if ( pos != -1 ){
               
                param_name = param_name.substring( 0, pos ).trim();
              }
             
              MessageBoxShell mb =
                new MessageBoxShell(
                  SWT.ICON_ERROR | SWT.OK,
                  MessageText.getString( "ConfigView.section.invalid.value.title"),
                  MessageText.getString(
                    "ConfigView.section.invalid.value",
                    new String[]{ val, param_name, Debug.getNestedExceptionMessage(e)}));
             
                  mb.setParent( parent.getShell());
                  mb.open(null);
            }
          }
        });
     
      label = new Label(area, SWT.NULL);
View Full Code Here

      if (dataReceive >= 1024) {
        maxBandwidth = dataReceive / 1024;
      }
    }

    SpeedScaleShell speedScale = new SpeedScaleShell() {
      public String getStringValue(int value, String sValue) {
        if (sValue != null) {
          return prefix + ": " + sValue;
        }
        if (value == 0) {
          return MessageText.getString("MyTorrentsView.menu.setSpeed.unlimited");
        }
        if (value == -1) {
          return MessageText.getString("ConfigView.auto");
        }
        return prefix
            + ": "
            + (value == 0 ? MessageText.getString("ConfigView.unlimited")
                : DisplayFormatters.formatByteCountToKiBEtcPerSec(
                    getValue() * 1024, true));
      }
    };
    int max = unlim ? (isUpSpeed ? 100 : 800) : maxBandwidth * 5;
    if (max < 50) {
      max = 50;
    }
    speedScale.setMaxValue(max);
    speedScale.setMaxTextValue(9999999);

    final String config_prefix = "config.ui.speed.partitions.manual."
        + (isUpSpeed ? "upload" : "download") + ".";
    int lastValue = COConfigurationManager.getIntParameter(config_prefix
        + "last", -10);

    Integer[] speed_limits;
    if (COConfigurationManager.getBooleanParameter(config_prefix + "enabled",
        false)) {
      speed_limits = parseSpeedPartitionString(COConfigurationManager.getStringParameter(
          config_prefix + "values", ""));
    } else {
      speed_limits = getGenericSpeedList(6, maxBandwidth);
    }
    if (speed_limits != null) {
      for (int i = 0; i < speed_limits.length; i++) {
        int value = speed_limits[i].intValue();
        if (value > 0) {
          speedScale.addOption(DisplayFormatters.formatByteCountToKiBEtcPerSec(
              value * 1024, true), value);
          if (value == lastValue) {
            lastValue = -10;
          }
        }
      }
    }
    speedScale.addOption(
        MessageText.getString("MyTorrentsView.menu.setSpeed.unlimited"), 0);
    speedScale.addOption(MessageText.getString("ConfigView.auto"), -1);

    if (lastValue > 0) {
      speedScale.addOption(DisplayFormatters.formatByteCountToKiBEtcPerSec(
          lastValue * 1024, true), lastValue);
    }

    // SWT BUG: on windows/linux, if mouse is down on shell open, all mouse events
    // will not reflect this
    if (speedScale.open(auto ? -1 : maxBandwidth, Constants.isWindows
        || Constants.isLinux)) {
      int value = speedScale.getValue();

      if (!speedScale.wasMenuChosen() || lastValue == value) {
        COConfigurationManager.setParameter(config_prefix + "last",
            maxBandwidth);
      }

      if (value >= 0) {
View Full Code Here

TOP

Related Classes of org.gudy.azureus2.plugins.download.Download

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.