Package org.gudy.azureus2.platform.win32.access.impl

Examples of org.gudy.azureus2.platform.win32.access.impl.Test


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

        // Constants.isWindows etc
     
      if ( file.getName().endsWith( ".exe" )){
       
        try{
          AEWin32Access accessor = AEWin32Manager.getAccessor(true);
         
          // accessor.createProcess( , false );
         
          String  s_args = null;
         
          if ( args.length > 0 ){
         
            s_args = "";
           
            for ( String s: args ){
             
              s_args += (s_args.length()==0?"":" ") + s;
            }
          }
         
          accessor.shellExecute(
            null,
            file.getAbsolutePath(),
            s_args,
            SystemProperties.getApplicationPath(),
            AEWin32Access.SW_NORMAL );
View Full Code Here

  public static void
  main(
    String[]  args )
  {
    try{
      AEWin32Access access = AEWin32Manager.getAccessor(true);
     
      String  app_data = access.getUserAppData();
     
      System.out.println( "AppData = " + app_data );
 
      String  local_app_data = access.getLocalAppData();
     
      System.out.println( "Local AppData = " + local_app_data );

     
      List availableDrives = AEWin32AccessInterface.getAvailableDrives();
View Full Code Here

      }
    }

    try {
      int result;
      AEWin32Access accessor = AEWin32Manager.getAccessor(true);
      if (accessor == null) {
        result = -123;
      } else {
        if (azRunner != null) {
          // create a batch file to run the updater, then to restart azureus
          // bceause the updater would restart azureus as administrator user
          // and confuse the user
          fileRestart = FileUtil.getUserFile("restart.bat");
          String s = "title Azureus Updater Runner\r\n";
          s += exeUpdater + " \"updateonly\"";
          for (int i = 1; i < parameters.length; i++) {
            s += " \"" + parameters[i].replaceAll("\\\"", "") + "\"";
          }
          s += "\r\n";
          s += "start \"\" \"" + azRunner + "\"";
         
          byte[]  bytes;
         
          String  encoding = FileUtil.getScriptCharsetEncoding();
         
          if ( encoding == null ){
            bytes = s.getBytes();
          }else{
            try{
              bytes = s.getBytes( encoding );
            }catch( Throwable e){
              e.printStackTrace();
             
              bytes = s.getBytes();
            }
          }
          FileUtil.writeBytesAsFile(fileRestart.getAbsolutePath(),bytes);

          result = accessor.shellExecute(null, fileRestart.getAbsolutePath(),
              null, SystemProperties.getApplicationPath(),
              AEWin32Access.SW_SHOWMINIMIZED);
        } else {
          String execEXE = "\"-J" + getClassPath().replaceAll("\\\"", "")
              + "\" ";

          for (int i = 0; i < properties.length; i++) {
            execEXE += "\"-J" + properties[i].replaceAll("\\\"", "") + "\" ";
          }

          for (int i = 0; i < parameters.length; i++) {
            execEXE += " \"" + parameters[i].replaceAll("\\\"", "") + "\"";
          }

          log.println("Launch via " + exeUpdater + " params " + execEXE);
          result = accessor.shellExecute(null, exeUpdater, execEXE,
              SystemProperties.getApplicationPath(), AEWin32Access.SW_NORMAL);
        }
      }

      /*
 
View Full Code Here

  /**
   * Get the location of Windows Media Player executable
   * @return
   */
  public static String getWMP() {
    AEWin32Access accessor = AEWin32Manager.getAccessor(true);
    if (accessor == null) {
      return null;
    }
    try {
      return accessor.readStringValue(AEWin32Access.HKEY_LOCAL_MACHINE,
          "SOFTWARE\\Microsoft\\Multimedia\\WMPlayer", "Player.Path");
    } catch (Exception e) {
    }
    return null;
  }
View Full Code Here

    try{
      byte[]  search_key = ((DDBaseKeyImpl)key).getBytes();
     
      Download   download = null;
       
      PluginInterface pi = PluginInitializer.getDefaultInterface();
                 
      String  search_sha1 = pi.getUtilities().getFormatters().encodeBytesToString( search_key );
     
      if ( ta_sha1 == null ){
       
        ta_sha1 = pi.getTorrentManager().getPluginAttribute( "DDBaseTTTorrent::sha1");
      }
       
        // gotta look for the sha1(hash)
     
      Download[]  downloads = pi.getDownloadManager().getDownloads();
     
      for (int i=0;i<downloads.length;i++){
       
        Download  dl = downloads[i];
       
        if ( dl.getTorrent() == null ){
         
          continue;
        }
       
        String  sha1 = dl.getAttribute( ta_sha1 );
       
        if ( sha1 == null ){
         
          sha1 = pi.getUtilities().getFormatters().encodeBytesToString(
                new SHA1Simple().calculateHash( dl.getTorrent().getHash()));
         
          dl.setAttribute( ta_sha1, sha1 );
        }
       
        if ( sha1.equals( search_sha1 )){
         
          download  = dl;
                   
          break;
        }
      }
       
      if ( download == null ){
       
        synchronized( this ){
         
          if ( external_downloads != null ){
           
            for (int i=0;i<external_downloads.size();i++){
             
              Download  dl = (Download)external_downloads.get(i);
             
              if ( dl.getTorrent() == null ){
               
                continue;
              }
             
              String  sha1 = dl.getAttribute( ta_sha1 );
             
              if ( sha1 == null ){
               
                sha1 = pi.getUtilities().getFormatters().encodeBytesToString(
                      new SHA1Simple().calculateHash( dl.getTorrent().getHash()));
               
                dl.setAttribute( ta_sha1, sha1 );
              }
             
              if ( sha1.equals( search_sha1 )){
               
                download  = dl;
                         
                break;
              }
            }
          }
        }
      }
     
      String  originator = contact.getName();
     
      if ( download == null ){
       
        String msg = "TorrentDownload: request from " + originator + " for '" + pi.getUtilities().getFormatters().encodeBytesToString( search_key ) + "' not found";
       
        if ( TRACE ){
         
          System.out.println( msg );
        }
View Full Code Here

  private long last_recheck_time;
 
  protected UpdateMonitor(AzureusCore _azureus_core) {
    azCore = _azureus_core;

    PluginInterface defPI = PluginInitializer.getDefaultInterface();
    UpdateManager um = defPI.getUpdateManager();

    um.addListener(new UpdateManagerListener() {
      public void checkInstanceCreated(UpdateCheckInstance instance) {
        instance.addListener(UpdateMonitor.this);
       
View Full Code Here

TOP

Related Classes of org.gudy.azureus2.platform.win32.access.impl.Test

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.