Package org.gudy.azureus2.platform

Examples of org.gudy.azureus2.platform.PlatformManager


          }
        }
      }
             
      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

      new BooleanParameter(gDeletion, sCurConfigID, "ConfigView.section.file.delete.torrent").setLayoutData(gridData);
    }

   
    try {
      final PlatformManager platform = PlatformManagerFactory.getPlatformManager();

      if (platform.hasCapability(PlatformManagerCapabilities.RecoverableFileDelete)) {
        sCurConfigID = "Move Deleted Data To Recycle Bin";
        allConfigIDs.add(sCurConfigID);

        gridData = new GridData();
        gridData.horizontalSpan = 2;
View Full Code Here

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

    final PlatformManager platform = PlatformManagerFactory.getPlatformManager();
   
      // ***** auto open group
   
    Group gAutoOpen = new Group(cDisplay, SWT.NULL);
    Messages.setLanguageText(gAutoOpen, LBLKEY_PREFIX + "autoopen");
    layout = new GridLayout(3, false);
    gAutoOpen.setLayout(layout);
    gAutoOpen.setLayoutData(new GridData( GridData.FILL_HORIZONTAL ));


    label = new Label(gAutoOpen, SWT.NULL);
    Messages.setLanguageText(label, LBLKEY_PREFIX + "autoopen.detailstab");
    new BooleanParameter(gAutoOpen, "Open Details", LBLKEY_PREFIX
        + "autoopen.dl");
    new BooleanParameter(gAutoOpen, "Open Seeding Details", LBLKEY_PREFIX
        + "autoopen.cd");


    label = new Label(gAutoOpen, SWT.NULL);
    Messages.setLanguageText(label, LBLKEY_PREFIX + "autoopen.downloadbars");
    new BooleanParameter(gAutoOpen, "Open Bar Incomplete", LBLKEY_PREFIX + "autoopen.dl");
    new BooleanParameter(gAutoOpen, "Open Bar Complete", LBLKEY_PREFIX + "autoopen.cd");
   
      // ****
   
    new BooleanParameter(cDisplay, "Remember transfer bar location", LBLKEY_PREFIX + "transferbar.remember_location");

    Group gSysTray = new Group(cDisplay, SWT.NULL);
    Messages.setLanguageText(gSysTray, LBLKEY_PREFIX + "systray");
    layout = new GridLayout();
    gSysTray.setLayout(layout);
    gSysTray.setLayoutData(new GridData( GridData.FILL_HORIZONTAL ));

    BooleanParameter est = new BooleanParameter(gSysTray, "Enable System Tray",
        KEY_PREFIX + "enabletray");

    BooleanParameter ctt = new BooleanParameter(gSysTray, "Close To Tray",
        LBLKEY_PREFIX + "closetotray");
    BooleanParameter mtt = new BooleanParameter(gSysTray, "Minimize To Tray",
        LBLKEY_PREFIX + "minimizetotray");
    BooleanParameter esttt = new BooleanParameter(gSysTray, "ui.systray.tooltip.enable",
        "ConfigView.label.enableSystrayToolTip");

    est.setAdditionalActionPerformer(new ChangeSelectionActionPerformer(
        ctt.getControls()));
    est.setAdditionalActionPerformer(new ChangeSelectionActionPerformer(
        mtt.getControls()));
    est.setAdditionalActionPerformer(new ChangeSelectionActionPerformer(
        esttt.getControls()));
   
        /**
         * Default download / upload limits available in the UI.
         */
        Group limit_group = new Group(cDisplay, SWT.NULL);
        Messages.setLanguageText(limit_group, LBLKEY_PREFIX + "set_ui_transfer_speeds");
        layout = new GridLayout();
        layout.numColumns = 2;
        limit_group.setLayout(layout);
        limit_group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
       
        Label limit_group_label = new Label(limit_group, SWT.WRAP);
        limit_group_label.setLayoutData(Utils.getWrappableLabelGridData(2, GridData.GRAB_HORIZONTAL));
        Messages.setLanguageText(limit_group_label, LBLKEY_PREFIX + "set_ui_transfer_speeds.description");
       
        String[] limit_types = new String[] {"download", "upload"};
        final String limit_type_prefix = "config.ui.speed.partitions.manual.";
        for (int i=0; i<limit_types.length; i++) {
          final BooleanParameter bp = new BooleanParameter(limit_group, limit_type_prefix + limit_types[i] + ".enabled", false, LBLKEY_PREFIX + "set_ui_transfer_speeds.description." + limit_types[i]);
          final StringParameter sp = new StringParameter(limit_group, limit_type_prefix + limit_types[i] + ".values", "");
          IAdditionalActionPerformer iaap = new GenericActionPerformer(new Control[] {}) {
            public void performAction() {
              sp.getControl().setEnabled(bp.isSelected())
            }
          };
         
            gridData = new GridData();
            gridData.widthHint = 150;
            sp.setLayoutData(gridData);
          iaap.performAction();
          bp.setAdditionalActionPerformer(iaap);
        }

    new BooleanParameter(cDisplay, "Send Version Info", LBLKEY_PREFIX
        + "allowSendVersion");

    Composite cArea = new Composite(cDisplay, SWT.NULL);
    layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.numColumns = 2;
    cArea.setLayout(layout);
    cArea.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
   
    new LinkLabel(cArea, LBLKEY_PREFIX + "version.info.link",
        "http://wiki.vuze.com/w/Version.azureusplatform.com");

    if (!Constants.isOSX) {

      BooleanParameter confirm = new BooleanParameter(cArea,
          "confirmationOnExit",
          "ConfigView.section.style.confirmationOnExit");
      gridData = new GridData();
      gridData.horizontalSpan = 2;
      confirm.setLayoutData(gridData);
    }
   
    cArea = new Composite(cDisplay, SWT.NULL);
    layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.numColumns = 2;
    cArea.setLayout(layout);
    cArea.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    // clear remembered decisions

    final Label clear_label = new Label(cArea, SWT.NULL);
    Messages.setLanguageText(clear_label, KEY_PREFIX + "cleardecisions");

    final Button clear_decisions = new Button(cArea, SWT.PUSH);
    Messages.setLanguageText(clear_decisions, KEY_PREFIX
        + "cleardecisionsbutton");

    clear_decisions.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event event) {

        COConfigurationManager.setParameter("MessageBoxWindow.decisions",
            new HashMap());
      }
    });

    final Label clear_tracker_label = new Label(cArea, SWT.NULL);
    Messages.setLanguageText(clear_tracker_label, KEY_PREFIX + "cleartrackers");

    final Button clear_tracker_button = new Button(cArea, SWT.PUSH);
    Messages.setLanguageText(clear_tracker_button, KEY_PREFIX
        + "cleartrackersbutton");
   
    clear_tracker_button.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event event) {
        TrackersUtil.getInstance().clearAllTrackers(true);
      }
    });
   
    final Label clear_save_path_label = new Label(cArea, SWT.NULL);
    Messages.setLanguageText(clear_save_path_label, KEY_PREFIX + "clearsavepaths");

    final Button clear_save_path_button = new Button(cArea, SWT.PUSH);
    Messages.setLanguageText(clear_save_path_button, KEY_PREFIX
        + "clearsavepathsbutton");
   
    clear_save_path_button.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event event) {
        COConfigurationManager.setParameter("saveTo_list", new StringListImpl());
      }
    });
   
    decisions_parameter_listener = new ParameterListener() {
      public void parameterChanged(String parameterName) {
        if (clear_decisions.isDisposed()) {

          // tidy up from previous incarnations

          COConfigurationManager.removeParameterListener(
              "MessageBoxWindow.decisions", this);

        } else {

          boolean enabled = COConfigurationManager.getMapParameter(
              "MessageBoxWindow.decisions", new HashMap()).size() > 0;

          clear_label.setEnabled(enabled);
          clear_decisions.setEnabled(enabled);
        }
      }
    };

    decisions_parameter_listener.parameterChanged(null);

    COConfigurationManager.addParameterListener("MessageBoxWindow.decisions",
        decisions_parameter_listener);

    // drag-drop
    /* gone to comply with whateverooo
    label = new Label(cArea, SWT.NULL);
    Messages.setLanguageText(label, "ConfigView.section.style.dropdiraction");

    String[] drop_options = {
        "ConfigView.section.style.dropdiraction.opentorrents",
        "ConfigView.section.style.dropdiraction.sharefolder",
        "ConfigView.section.style.dropdiraction.sharefoldercontents",
        "ConfigView.section.style.dropdiraction.sharefoldercontentsrecursive", };

    String dropLabels[] = new String[drop_options.length];
    String dropValues[] = new String[drop_options.length];
    for (int i = 0; i < drop_options.length; i++) {

      dropLabels[i] = MessageText.getString(drop_options[i]);
      dropValues[i] = "" + i;
    }
    new StringListParameter(cArea, "config.style.dropdiraction",
        dropLabels, dropValues);
    */
   
    // reset associations

    if (platform.hasCapability(PlatformManagerCapabilities.RegisterFileAssociations)) {

      Composite cResetAssoc = new Composite(cArea, SWT.NULL);
      layout = new GridLayout();
      layout.marginHeight = 0;
      layout.marginWidth = 0;
      layout.numColumns = 2;
      cResetAssoc.setLayout(layout);
      cResetAssoc.setLayoutData(new GridData());

      label = new Label(cResetAssoc, SWT.NULL);
      Messages.setLanguageText(label, KEY_PREFIX + "resetassoc");

      Button reset = new Button(cResetAssoc, SWT.PUSH);
      Messages.setLanguageText(reset, KEY_PREFIX + "resetassocbutton"); //$NON-NLS-1$

      reset.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event event) {

          try {
            platform.registerApplication();

          } catch (PlatformManagerException e) {

            Logger.log(new LogAlert(LogAlert.UNREPEATABLE,
                "Failed to register application", e));
View Full Code Here

      f = f.getParentFile();

    if (f == null)
      return;

    PlatformManager mgr = PlatformManagerFactory.getPlatformManager();

    if (mgr.hasCapability(PlatformManagerCapabilities.ShowFileInBrowser)) {
      try {
        PlatformManagerFactory.getPlatformManager().showFile(f.toString());
        return;
      } catch (PlatformManagerException e) {
        Debug.printStackTrace(e);
View Full Code Here

    boolean    force_no_recycle )
  {
    if ( COConfigurationManager.getBooleanParameter("Move Deleted Data To Recycle Bin" ) && !force_no_recycle ){
     
      try{
          final PlatformManager  platform  = PlatformManagerFactory.getPlatformManager();
         
          if (platform.hasCapability(PlatformManagerCapabilities.RecoverableFileDelete)){
           
            platform.performRecoverableFileDelete( file.getAbsolutePath());
         
            return( true );
           
          }else{
           
View Full Code Here

                  
                   increase_tried = true;
                
                   if ( COConfigurationManager.getBooleanParameter( "jvm.heap.auto.increase.enable", true )){

                     PlatformManager platform = PlatformManagerFactory.getPlatformManager();
 
                     if ( platform.hasCapability( PlatformManagerCapabilities.AccessExplicitVMOptions )){
                      
                       try{
                         String[] options = platform.getExplicitVMOptions();
 
                         long  max_mem = getJVMLongOption( options, "-Xmx" );
 
                         if ( max_mem <= 0 ){
                          
                           max_mem = getMaxHeapMB()*MB;
                         }
                        
                         final long HEAP_AUTO_INCREASE_MAX   = 256*MB;
                         final long HEAP_AUTO_INCREASE_BY  = 16*MB;
                        
                         if ( max_mem > 0 && max_mem < HEAP_AUTO_INCREASE_MAX ){
                                                                    
                           max_mem += HEAP_AUTO_INCREASE_BY;
                          
                           if ( max_mem > HEAP_AUTO_INCREASE_MAX ){
                            
                             max_mem = HEAP_AUTO_INCREASE_MAX;
                           }
                          
                           long  last_increase = COConfigurationManager.getLongParameter( "jvm.heap.auto.increase.last", 0 );
                          
                           if ( max_mem > last_increase ){
                            
                             COConfigurationManager.setParameter( "jvm.heap.auto.increase.last", max_mem );
                                
                             options = setJVMLongOption( options, "-Xmx", max_mem );
                            
                             platform.setExplicitVMOptions( options );
                            
                              Logger.logTextResource(
                                  new LogAlert(
                                    LogAlert.REPEATABLE,
                                    LogAlert.AT_WARNING,
View Full Code Here

    if (sFile == null || sFile.trim().length() == 0) {
      return;
    }
   
    if (!Constants.isWindows && new File(sFile).isDirectory()) {
      PlatformManager mgr = PlatformManagerFactory.getPlatformManager();
      if (mgr.hasCapability(PlatformManagerCapabilities.ShowFileInBrowser)) {
        try {
          PlatformManagerFactory.getPlatformManager().showFile(sFile);
          return;
        } catch (PlatformManagerException e) {
        }
View Full Code Here

TOP

Related Classes of org.gudy.azureus2.platform.PlatformManager

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.