Package org.gudy.azureus2.plugins

Examples of org.gudy.azureus2.plugins.PluginConfig


          }
        }
      }
             
      try{
        PlatformManager  pm = PlatformManagerFactory.getPlatformManager();
         
        if ( pm.hasCapability( PlatformManagerCapabilities.CopyFilePermissions )){
         
          String  parent_str = parent.getAbsolutePath();
                   
          PlatformManagerFactory.getPlatformManager().copyFilePermissions(
              parent_str, from_file_or_resource );
View Full Code Here


    layout.numColumns = 1;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    cDisplay.setLayout(layout);

    final PlatformManager platform = PlatformManagerFactory.getPlatformManager();
   
    int userMode = COConfigurationManager.getIntParameter("User Mode");
   
      // ***** start group
   
    boolean can_ral = platform.hasCapability(PlatformManagerCapabilities.RunAtLogin );
       
    if ( can_ral ){
     
      Group gStartStop = new Group(cDisplay, SWT.NULL);
      Messages.setLanguageText(gStartStop, LBLKEY_PREFIX + "start");
      layout = new GridLayout(2, false);
      gStartStop.setLayout(layout);
      gStartStop.setLayoutData(new GridData( GridData.FILL_HORIZONTAL ));
 
      if ( can_ral ){
 
        gridData = new GridData();
        gridData.horizontalSpan = 2;
        BooleanParameter start_on_login = new BooleanParameter(gStartStop, "Start On Login", LBLKEY_PREFIX + "start.onlogin");
       
        try{
          start_on_login.setSelected( platform.getRunAtLogin());
         
          start_on_login.addChangeListener(
            new ParameterChangeAdapter()
            {
              public void
              booleanParameterChanging(
                Parameter p,
                boolean toValue)
              {
                try{
                  platform.setRunAtLogin( toValue );
                 
                }catch( Throwable e ){
                 
                  Debug.out( e );
                }
              }
            });
         
        }catch( Throwable e ){
         
          start_on_login.setEnabled( false );
         
          Debug.out( e );
        }
       
        start_on_login.setLayoutData(gridData);
      }
     
    }
       
    if ( userMode > 0 ){
       
      Group gPR = new Group(cDisplay, SWT.NULL);
      Messages.setLanguageText(gPR, LBLKEY_PREFIX + "pauseresume");
      layout = new GridLayout(2, false);
      gPR.setLayout(layout);
      gPR.setLayoutData(new GridData( GridData.FILL_HORIZONTAL ));

      gridData = new GridData();
      gridData.horizontalSpan = 2;
      BooleanParameter pauseOnExit = new BooleanParameter(gPR,
          "Pause Downloads On Exit", "ConfigView.label.pause.downloads.on.exit");
      pauseOnExit.setLayoutData(gridData);
 
      gridData = new GridData();
      gridData.horizontalSpan = 2;
      BooleanParameter resumeOnStart = new BooleanParameter(gPR,
          "Resume Downloads On Start", "ConfigView.label.resume.downloads.on.start");
      resumeOnStart.setLayoutData(gridData);
    }
   
    if ( userMode >= 0 ){
     
      Group gStop = new Group(cDisplay, SWT.NULL);
      Messages.setLanguageText(gStop, LBLKEY_PREFIX + "stop");
      layout = new GridLayout(2, false);
      gStop.setLayout(layout);
      gStop.setLayoutData(new GridData( GridData.FILL_HORIZONTAL ));

        // done downloading
     
      gridData = new GridData();
      label = new Label(gStop, SWT.NULL);
        Messages.setLanguageText(label, "ConfigView.label.stop.downcomp");
        label.setLayoutData( gridData );
     
        int  shutdown_types = platform.getShutdownTypes();
       
      List<String>  l_action_values = new ArrayList<String>();
      List<String>  l_action_descs   = new ArrayList<String>();

      l_action_values.add( "Nothing" );
      l_action_values.add( "QuitVuze" );
     
      if (( shutdown_types & PlatformManager.SD_SLEEP ) != 0 ){
       
        l_action_values.add( "Sleep" );
      }
      if (( shutdown_types & PlatformManager.SD_HIBERNATE ) != 0 ){
       
        l_action_values.add( "Hibernate" );
      }
      if (( shutdown_types & PlatformManager.SD_SHUTDOWN ) != 0 ){
       
        l_action_values.add( "Shutdown" );
      }
     
      String[] action_values = l_action_values.toArray( new String[ l_action_values.size()]);
         
      for ( String s: action_values ){
       
        l_action_descs.add( MessageText.getString( "ConfigView.label.stop." + s ));
      }
     
      String[] action_descs = l_action_descs.toArray( new String[ l_action_descs.size()]);

      new StringListParameter(gStop, "On Downloading Complete Do", "Nothing", action_descs, action_values );

        // done seeding
     
      gridData = new GridData();
        label = new Label(gStop, SWT.NULL);
        Messages.setLanguageText(label, "ConfigView.label.stop.seedcomp");
        label.setLayoutData( gridData );
             
      new StringListParameter(gStop, "On Seeding Complete Do", "Nothing", action_descs, action_values );
     
      gridData = new GridData();
      gridData.horizontalSpan = 2;
      BooleanParameter resetOnTrigger =
        new BooleanParameter(
          gStop, "Stop Triggers Auto Reset",
          "!" + MessageText.getString(
            "ConfigView.label.stop.autoreset",
            new String[]{ MessageText.getString( "ConfigView.label.stop.Nothing" )})+ "!");
       
      resetOnTrigger.setLayoutData(gridData);
    }
   
    if ( userMode > 0 && platform.hasCapability( PlatformManagerCapabilities.AccessExplicitVMOptions )){
     
      Group gJVM = new Group(cDisplay, SWT.NULL);
      Messages.setLanguageText(gJVM, LBLKEY_PREFIX + "jvm");
      layout = new GridLayout(2, false);
      gJVM.setLayout(layout);
      gJVM.setLayoutData(new GridData( GridData.FILL_HORIZONTAL ));
     
        // 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);
      Messages.setLanguageText(label, "jvm.info");
      gridData = new GridData();
      gridData.horizontalSpan = 2;
      label.setLayoutData( gridData );
     
      try{
        final File option_file = platform.getVMOptionFile();
        
        final Group gJVMOptions = new Group(gJVM, SWT.NULL);
        layout = new GridLayout(3, false);
        gJVMOptions.setLayout(layout);
        gridData = new GridData( GridData.FILL_HORIZONTAL );
        gridData.horizontalSpan = 2;
        gJVMOptions.setLayoutData( gridData );
       
        buildOptions( cDisplay, platform, gJVMOptions, false );
       
          // show option file
       
        label = new Label(gJVM, SWT.NULL);
        Messages.setLanguageText(label, "jvm.show.file", new String[]{ option_file.getAbsolutePath() });

        Button show_folder_button = new Button( gJVM, SWT.PUSH );
       
         Messages.setLanguageText( show_folder_button, "MyTorrentsView.menu.explore");
        
         show_folder_button.addSelectionListener(
           new SelectionAdapter()
           {
             public void
             widgetSelected(
               SelectionEvent e )
             {
               ManagerUtils.open( option_file );
             }
           });

         label = new Label(gJVM, SWT.NULL);     
        Messages.setLanguageText(label, "jvm.reset");

        Button reset_button = new Button( gJVM, SWT.PUSH );
       
         Messages.setLanguageText( reset_button, "Button.reset");
        
         reset_button.addSelectionListener(
           new SelectionAdapter()
           {
             public void
             widgetSelected(
               SelectionEvent event )
             {
               try{
                 platform.setExplicitVMOptions( new String[0] );
                
                 buildOptions( cDisplay, platform, gJVMOptions, true );
                
               }catch( Throwable e ){
                
View Full Code Here

    return cSection;

  }

  private void enableTOSRegistrySetting(boolean enable) {
    PlatformManager mgr = PlatformManagerFactory.getPlatformManager();

    if (mgr.hasCapability(PlatformManagerCapabilities.SetTCPTOSEnabled)) {
      //see http://wiki.vuze.com/w/AdvancedNetworkSettings
      try {
        mgr.setTCPTOSEnabled(enable);
      } catch (PlatformManagerException pe) {
        Debug.printStackTrace(pe);
      }
    }
  }
View Full Code Here

  public static void
  checkDumpsAndNatives()
  {
    try{
      PlatformManager  p_man = PlatformManagerFactory.getPlatformManager();
     
      if (   p_man.getPlatformType() == PlatformManager.PT_WINDOWS &&
          p_man.hasCapability( PlatformManagerCapabilities.TestNativeAvailability )){ 

        for (int i=0;i<bad_dlls.length;i++){
         
          String  dll   = bad_dlls[i][0];
          String  load  = bad_dlls[i][1];
         
          if ( load.equalsIgnoreCase( "n" )){
           
            continue;
          }
         
          if ( !COConfigurationManager.getBooleanParameter( "platform.win32.dll_found." + dll, false )){
               
            try{
              if ( p_man.testNativeAvailability( dll + ".dll" )){
               
                COConfigurationManager.setParameter( "platform.win32.dll_found." + dll, true );
 
                String  detail = MessageText.getString( "platform.win32.baddll." + dll );
               
View Full Code Here

    formData.right = new FormAttachment(100, 0);
    formData.bottom = new FormAttachment(100, 0);
    formData.top = new FormAttachment(sash);
    child2.setLayoutData(formData);

    final PluginConfig pc = plugin.getPluginInterface().getPluginconfig();
   
    sash.setData( "PCT", new Float( pc.getPluginFloatParameter( "swt.sash.position", 0.7f )));
   
    sash.addSelectionListener(
      new SelectionAdapter()
      {
        public void
        widgetSelected(
          SelectionEvent e )
        {
          if (e.detail == SWT.DRAG){
            return;
          }
         
          child1Data.height = e.y + e.height - SASH_WIDTH;
         
          form.layout();
 
          Float l = new Float((double)child1.getBounds().height / form.getBounds().height);
         
          sash.setData( "PCT", l );
         
          pc.setPluginParameter( "swt.sash.position", l.floatValue());
        }
      });

    form.addListener(
      SWT.Resize,
View Full Code Here

     * For Linux: Requires a setting in the config section that allows for that program to be run
     * @param PluginInterface pluginInterface
     * @param String URL_to_open
     */
    public static void open(String URL_to_open){
        PluginConfig config_getter = View.getPluginInterface().getPluginconfig();
        String URLopener = null;
        if (View.getPluginInterface().getUtilities().isLinux()){
            URLopener = config_getter.getPluginStringParameter("azcvsupdater_url_commandline","firefox");
            URL_to_open = URLopener + " " + URL_to_open;
            Program.launch(URL_to_open);
        } else if (View.getPluginInterface().getUtilities().isOSX()){
            URLopener = "open";
            //URL_to_open = URLopener + " " + URL_to_open;
View Full Code Here

     
    if ( id == 0 ){
   
      synchronized( this ){
       
        PluginConfig config = plugin_interface.getPluginconfig();
     
        id = config.getPluginLongParameter( "xmui.next.id", 1 );
       
        config.setPluginParameter( "xmui.next.id", id + 1 );
      }
     
      d.setLongAttribute( t_id, id );
    }
   
View Full Code Here

       
      // http://trac.transmissionbt.com/browser/trunk/doc/rpc-spec.txt
       
    if ( method.equals( "session-get" ) || method.equals( "session-set" )){
             
      PluginConfig pc = plugin_interface.getPluginconfig();
     
      String   save_dir   = pc.getCoreStringParameter( PluginConfig.CORE_PARAM_STRING_DEFAULT_SAVE_PATH );
      int    tcp_port   = pc.getCoreIntParameter( PluginConfig.CORE_PARAM_INT_INCOMING_TCP_PORT );
      int    up_limit   = pc.getCoreIntParameter( PluginConfig.CORE_PARAM_INT_MAX_UPLOAD_SPEED_KBYTES_PER_SEC );
      int    down_limit   = pc.getCoreIntParameter( PluginConfig.CORE_PARAM_INT_MAX_DOWNLOAD_SPEED_KBYTES_PER_SEC );
      int    glob_con  = pc.getCoreIntParameter( PluginConfig.CORE_PARAM_INT_MAX_CONNECTIONS_GLOBAL );
      int    tor_con   = pc.getCoreIntParameter( PluginConfig.CORE_PARAM_INT_MAX_CONNECTIONS_PER_TORRENT );
     
      boolean auto_speed_on = pc.getCoreBooleanParameter( PluginConfig.CORE_PARAM_BOOLEAN_AUTO_SPEED_ON ) ||
                  pc.getCoreBooleanParameter( PluginConfig.CORE_PARAM_BOOLEAN_AUTO_SPEED_SEEDING_ON );
           
     
      boolean require_enc = COConfigurationManager.getBooleanParameter("network.transport.encrypted.require");
     
      if ( method.equals( "session-set" )){
       
        checkUpdatePermissions();
       
        for( Map.Entry<String,Object> arg: ((Map<String,Object>)args).entrySet()){
         
          String  key = arg.getKey();
          Object  val  = arg.getValue();
         
          if ( key.equals( "speed-limit-down-enabled" )){
               
            boolean enabled = getBoolean( val );
           
            if ( !enabled && down_limit != 0 ){
             
              down_limit = 0;
             
              pc.setCoreIntParameter( PluginConfig.CORE_PARAM_INT_MAX_DOWNLOAD_SPEED_KBYTES_PER_SEC, 0 );
            }
          }else if ( key.equals( "speed-limit-down" )){
         
            int  limit = ((Number)val).intValue();
           
            if ( limit != down_limit ){
             
              down_limit = limit;
             
              pc.setCoreIntParameter( PluginConfig.CORE_PARAM_INT_MAX_DOWNLOAD_SPEED_KBYTES_PER_SEC, limit );
            }
          }else if ( key.equals( "speed-limit-up-enabled" )){
           
            if ( auto_speed_on ){
             
              pc.setCoreBooleanParameter( PluginConfig.CORE_PARAM_BOOLEAN_AUTO_SPEED_ON, false );
              pc.setCoreBooleanParameter( PluginConfig.CORE_PARAM_BOOLEAN_AUTO_SPEED_SEEDING_ON, false );
            }
           
            boolean enabled = getBoolean( val );
           
            if ( !enabled && up_limit != 0 ){
             
              up_limit = 0;
             
              pc.setCoreIntParameter( PluginConfig.CORE_PARAM_INT_MAX_UPLOAD_SPEED_KBYTES_PER_SEC, 0 );
            }
          }else if ( key.equals( "speed-limit-up" )){
         
            if ( auto_speed_on ){
             
              pc.setCoreBooleanParameter( PluginConfig.CORE_PARAM_BOOLEAN_AUTO_SPEED_ON, false );
              pc.setCoreBooleanParameter( PluginConfig.CORE_PARAM_BOOLEAN_AUTO_SPEED_SEEDING_ON, false );
            }

            int  limit = ((Number)val).intValue();
           
            if ( limit != up_limit ){
             
              up_limit = limit;
             
              pc.setCoreIntParameter( PluginConfig.CORE_PARAM_INT_MAX_UPLOAD_SPEED_KBYTES_PER_SEC, limit );
            }
          }else if ( key.equals( "download-dir" )){

            String  dir = (String)val;
           
            if ( !save_dir.equals( dir )){
             
              save_dir = dir;
             
              pc.setCoreStringParameter( PluginConfig.CORE_PARAM_STRING_DEFAULT_SAVE_PATH, dir );
            }
          }else if ( key.equals( "peer-port" ) || key.equals( "port" )){
           
            int  port = ((Number)val).intValue();

            if ( port != tcp_port ){
             
              tcp_port = port;
             
              pc.setCoreIntParameter( PluginConfig.CORE_PARAM_INT_INCOMING_TCP_PORT, port );
            }
          }else if ( key.equals( "encryption" )){
           
            String  value = (String)val;
           
View Full Code Here


   
    public static void torrent_save(final String url, final String filename, final PluginInterface pluginInterface){
        try{
          PluginConfig config_getter = pluginInterface.getPluginconfig();
          dir = config_getter.getPluginStringParameter("AutoDownload_dir");
            /*final String dir = pluginInterface.getPluginDirectoryName()
        + System.getProperty("file.separator")
        + "torrents"
        + System.getProperty("file.separator");*/
          if(!dir.endsWith(System.getProperty("file.separator"))){
View Full Code Here

                  for (int i = 0; i < files.length ; i++){
                    if(torrent_table != null && !torrent_table.isDisposed()){
                        if(filter.equals("")){
                            TableItem item = new TableItem(torrent_table,SWT.NULL);
                            item.setText(0,files[i].getName());
                            PluginConfig config_getter = pluginInterface.getPluginconfig();
                            boolean time_get = config_getter.getPluginBooleanParameter("MilitaryTime");
                            String date_of_file = Time.formatTime(Long.toString(files[i].lastModified()), time_get);
                            item.setText(1,date_of_file);
                            boolean tableCounter;
                            int tableTotal = torrent_table.getItemCount();
                            if (tableTotal%2==0) {
                             tableCounter=false;
                           } else {
                             tableCounter=true;
                           }
                            if(!tableCounter){
                                item.setBackground(View.gray_color);
                            }
                        }else{
                            if(string_Contains(files[i].getName(),filter)){
                                TableItem item = new TableItem(torrent_table,SWT.NULL);
                                item.setText(0,files[i].getName());
                                PluginConfig config_getter = pluginInterface.getPluginconfig();
                                boolean time_get = config_getter.getPluginBooleanParameter("MilitaryTime");
                                String date_of_file = Time.formatTime(Long.toString(files[i].lastModified()), time_get);
                                item.setText(1,date_of_file);
                                boolean tableCounter;
                                int tableTotal = torrent_table.getItemCount();
                                if (tableTotal%2==0) {
View Full Code Here

TOP

Related Classes of org.gudy.azureus2.plugins.PluginConfig

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.