当前位置: 首页>>代码示例>>Java>>正文


Java PlatformManager.hasCapability方法代码示例

本文整理汇总了Java中org.gudy.azureus2.platform.PlatformManager.hasCapability方法的典型用法代码示例。如果您正苦于以下问题:Java PlatformManager.hasCapability方法的具体用法?Java PlatformManager.hasCapability怎么用?Java PlatformManager.hasCapability使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.gudy.azureus2.platform.PlatformManager的用法示例。


在下文中一共展示了PlatformManager.hasCapability方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: open

import org.gudy.azureus2.platform.PlatformManager; //导入方法依赖的package包/类
public static void open(File f) {
	while (f != null && !f.exists())
		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);
		}
	}

	if (f.isDirectory()) {
		Utils.launch(f.toString()); // default launcher
	} else {
		Utils.launch(f.getParent().toString());
	}
}
 
开发者ID:AcademicTorrents,项目名称:AcademicTorrents-Downloader,代码行数:25,代码来源:ManagerUtils.java

示例2: checkAssociations

import org.gudy.azureus2.platform.PlatformManager; //导入方法依赖的package包/类
public static void
checkAssociations()
{  
	try{

	    PlatformManager	platform  = PlatformManagerFactory.getPlatformManager();
	    
	    if ( platform.hasCapability(PlatformManagerCapabilities.RegisterFileAssociations) ){
    	
	    	if ( COConfigurationManager.getBooleanParameter( "config.interface.checkassoc")){
	    		
	    		if ( !platform.isApplicationRegistered()){
	    		
	    			new AssociationChecker(  platform );
	    		}
	    	}
	    }
	}catch( Throwable e ){
		
		// Debug.printStackTrace( e );
	}
}
 
开发者ID:AcademicTorrents,项目名称:AcademicTorrents-Downloader,代码行数:23,代码来源:AssociationChecker.java

示例3: deleteWithRecycle

import org.gudy.azureus2.platform.PlatformManager; //导入方法依赖的package包/类
public static boolean
deleteWithRecycle(
	File		file,
	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{
		    	
		    	return( file.delete());
		    }
		}catch( PlatformManagerException e ){
			
			return( file.delete());
		}
	}else{
		
		return( file.delete());
	}
}
 
开发者ID:thangbn,项目名称:Direct-File-Downloader,代码行数:30,代码来源:FileUtil.java

示例4: canTraceRoute

import org.gudy.azureus2.platform.PlatformManager; //导入方法依赖的package包/类
public boolean
canTraceRoute()
{
	PlatformManager	pm = PlatformManagerFactory.getPlatformManager();

	return( pm.hasCapability( PlatformManagerCapabilities.TraceRouteAvailability ));
}
 
开发者ID:thangbn,项目名称:Direct-File-Downloader,代码行数:8,代码来源:NetworkAdminImpl.java

示例5: canPing

import org.gudy.azureus2.platform.PlatformManager; //导入方法依赖的package包/类
public boolean
canPing()
{
	PlatformManager	pm = PlatformManagerFactory.getPlatformManager();

	return( pm.hasCapability( PlatformManagerCapabilities.PingAvailability ));
}
 
开发者ID:thangbn,项目名称:Direct-File-Downloader,代码行数:8,代码来源:NetworkAdminImpl.java

示例6: enableTOSRegistrySetting

import org.gudy.azureus2.platform.PlatformManager; //导入方法依赖的package包/类
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);
		}
	}
}
 
开发者ID:AcademicTorrents,项目名称:AcademicTorrents-Downloader,代码行数:13,代码来源:ConfigSectionConnectionAdvanced.java

示例7: requestUserAttention

import org.gudy.azureus2.platform.PlatformManager; //导入方法依赖的package包/类
/**
 * Grab the user's attention in a platform dependent way
 * @param type one of <code>PlatformManager.USER_REQUEST_INFO</code>, 
 * 										<code>PlatformManager.USER_REQUEST_WARNING</code>, OR 
 * 										<code>PlatformManager.USER_REQUEST_QUESTION</code>
 * @param data user-defined data object;
 * 				see the platform-specific <code>PlatformManager</code> for what may be supported
 */
public static void requestUserAttention(int type, Object data) {

	PlatformManager pm = PlatformManagerFactory.getPlatformManager();
	if (true == pm.hasCapability(PlatformManagerCapabilities.RequestUserAttention)) {
		try {
			pm.requestUserAttention(type, data);
		} catch (PlatformManagerException e) {
			Debug.printStackTrace(e);
		}
	}
}
 
开发者ID:AcademicTorrents,项目名称:AcademicTorrents-Downloader,代码行数:20,代码来源:UserAlerts.java

示例8: createProcess

import org.gudy.azureus2.platform.PlatformManager; //导入方法依赖的package包/类
public void
createProcess(
	String		command_line )

	throws PluginException
{
    try{
    		// we need to spawn without inheriting handles
    	
    	PlatformManager pm = PlatformManagerFactory.getPlatformManager();
    	
    	if ( pm.hasCapability( PlatformManagerCapabilities.CreateCommandLineProcess )){
    		
    		pm.createProcess( command_line, false );
    		
    		return;
    	}
    }catch( Throwable e ){
    	
        Debug.printStackTrace(e);
    }
    
    try{
       	Runtime.getRuntime().exec( command_line );
       	
    }catch( Throwable f ){
        	
    	throw( new PluginException("Failed to create process", f ));
    }
}
 
开发者ID:AcademicTorrents,项目名称:AcademicTorrents-Downloader,代码行数:31,代码来源:UtilitiesImpl.java

示例9: runVerifier

import org.gudy.azureus2.platform.PlatformManager; //导入方法依赖的package包/类
private static void
runVerifier()
{
 try{
  PlatformManager pm = PlatformManagerFactory.getPlatformManager();
  
  if ( pm.hasCapability( PlatformManagerCapabilities.RunAtLogin )){
	
	  boolean	start_on_login = COConfigurationManager.getBooleanParameter( "Start On Login" );
	  
	  if ( pm.getRunAtLogin() != start_on_login ){
		  
		  pm.setRunAtLogin( start_on_login );
	  }
  }
  
  if ( pm.hasCapability(PlatformManagerCapabilities.RegisterFileAssociations )){
	  
	  boolean	auto_reg = COConfigurationManager.getBooleanParameter( "Auto Register App" );

	  if ( auto_reg ){
		  
		  pm.registerApplication();
	  }
  }
 }catch( Throwable e ){
  
  Debug.out( e );
 }
}
 
开发者ID:AcademicTorrents,项目名称:AcademicTorrents-Downloader,代码行数:31,代码来源:ConfigurationChecker.java

示例10: deleteDataFiles

import org.gudy.azureus2.platform.PlatformManager; //导入方法依赖的package包/类
/** Deletes all data files associated with torrent.
       * Currently, deletes all files, then tries to delete the path recursively
       * if the paths are empty.  An unexpected result may be that a empty
       * directory that the user created will be removed.
       *
       * TODO: only remove empty directories that are created for the torrent
       */

public static void
deleteDataFiles(
    TOTorrent   torrent,
    String      torrent_save_dir,       // enclosing dir, not for deletion
    String      torrent_save_file, 		// file or dir for torrent
    boolean		force_no_recycle )    
{
    if (torrent == null || torrent_save_file == null ){

        return;
    }

    try{
        if (torrent.isSimpleTorrent()){

            File    target = new File( torrent_save_dir, torrent_save_file );

            target = FMFileManagerFactory.getSingleton().getFileLink( torrent, target.getCanonicalFile());

            FileUtil.deleteWithRecycle( target, force_no_recycle );

        }else{

            PlatformManager mgr = PlatformManagerFactory.getPlatformManager();
            if( Constants.isOSX &&
                  torrent_save_file.length() > 0 &&
                  COConfigurationManager.getBooleanParameter("Move Deleted Data To Recycle Bin" ) &&
            		(! force_no_recycle ) &&
                  mgr.hasCapability(PlatformManagerCapabilities.RecoverableFileDelete) ) {

                try
                {
                    String  dir = torrent_save_dir + File.separatorChar + torrent_save_file + File.separatorChar;

                        // only delete the dir if there's only this torrent's files in it!

                    if ( countFiles( new File(dir)) == countDataFiles( torrent, torrent_save_dir, torrent_save_file )){

                        mgr.performRecoverableFileDelete( dir );

                    }else{

                        deleteDataFileContents( torrent, torrent_save_dir, torrent_save_file, force_no_recycle );
                }
                }
                catch(PlatformManagerException ex)
                {
                    deleteDataFileContents( torrent, torrent_save_dir, torrent_save_file, force_no_recycle );
                }
            }
            else{
                deleteDataFileContents(torrent, torrent_save_dir, torrent_save_file, force_no_recycle);
            }

        }
    }catch( Throwable e ){

        Debug.printStackTrace( e );
    }
}
 
开发者ID:thangbn,项目名称:Direct-File-Downloader,代码行数:69,代码来源:DiskManagerImpl.java

示例11: deleteDataFiles

import org.gudy.azureus2.platform.PlatformManager; //导入方法依赖的package包/类
/** Deletes all data files associated with torrent.
       * Currently, deletes all files, then tries to delete the path recursively
       * if the paths are empty.  An unexpected result may be that a empty
       * directory that the user created will be removed.
       *
       * TODO: only remove empty directories that are created for the torrent
       */

public static void
deleteDataFiles(
    TOTorrent   torrent,
    String      torrent_save_dir,       // enclosing dir, not for deletion
    String      torrent_save_file, 		// file or dir for torrent
    boolean		force_no_recycle )    
{
    if (torrent == null || torrent_save_file == null ){

        return;
    }

    try{
        if (torrent.isSimpleTorrent()){

            File    target = new File( torrent_save_dir, torrent_save_file );

            target = FMFileManagerFactory.getSingleton().getFileLink( torrent, 0, target.getCanonicalFile());

            FileUtil.deleteWithRecycle( target, force_no_recycle );

        }else{

            PlatformManager mgr = PlatformManagerFactory.getPlatformManager();
            if( Constants.isOSX &&
                  torrent_save_file.length() > 0 &&
                  COConfigurationManager.getBooleanParameter("Move Deleted Data To Recycle Bin" ) &&
            		(! force_no_recycle ) &&
                  mgr.hasCapability(PlatformManagerCapabilities.RecoverableFileDelete) ) {

                try
                {
                    String  dir = torrent_save_dir + File.separatorChar + torrent_save_file + File.separatorChar;

                        // only delete the dir if there's only this torrent's files in it!

                    if ( countFiles( new File(dir)) == countDataFiles( torrent, torrent_save_dir, torrent_save_file )){

                        mgr.performRecoverableFileDelete( dir );

                    }else{

                        deleteDataFileContents( torrent, torrent_save_dir, torrent_save_file, force_no_recycle );
                }
                }
                catch(PlatformManagerException ex)
                {
                    deleteDataFileContents( torrent, torrent_save_dir, torrent_save_file, force_no_recycle );
                }
            }
            else{
                deleteDataFileContents(torrent, torrent_save_dir, torrent_save_file, force_no_recycle);
            }

        }
    }catch( Throwable e ){

        Debug.printStackTrace( e );
    }
}
 
开发者ID:AcademicTorrents,项目名称:AcademicTorrents-Downloader,代码行数:69,代码来源:DiskManagerImpl.java

示例12: deleteDataFiles

import org.gudy.azureus2.platform.PlatformManager; //导入方法依赖的package包/类
/** Deletes all data files associated with torrent.
       * Currently, deletes all files, then tries to delete the path recursively
       * if the paths are empty.  An unexpected result may be that a empty
       * directory that the user created will be removed.
       *
       * TODO: only remove empty directories that are created for the torrent
       */

public static void
deleteDataFiles(
    TOTorrent   torrent,
    String      torrent_save_dir,       // enclosing dir, not for deletion
    String      torrent_save_file, 		// file or dir for torrent
    boolean		force_no_recycle )    
{
    if (torrent == null || torrent_save_file == null ){

        return;
    }

    try{
        if (torrent.isSimpleTorrent()){

            File    target = new File( torrent_save_dir, torrent_save_file );

            target = FMFileManagerFactory.getSingleton().getFileLink( torrent, 0, target.getCanonicalFile());

            FileUtil.deleteWithRecycle( target, force_no_recycle );

        }else{

            PlatformManager mgr = PlatformManagerFactory.getPlatformManager();
            if( Constants.isOSX &&
                  torrent_save_file.length() > 0 &&
                  COConfigurationManager.getBooleanParameter("Move Deleted Data To Recycle Bin" ) &&
            		(! force_no_recycle ) &&
                  mgr.hasCapability(PlatformManagerCapabilities.RecoverableFileDelete) ) {

                try
                {
                    String  dir = torrent_save_dir + File.separatorChar + torrent_save_file + File.separatorChar;

                        // only delete the dir if there's only this torrent's files in it!

                    int numDataFiles = countDataFiles( torrent, torrent_save_dir, torrent_save_file );
                    if ( countFiles( new File(dir), numDataFiles) == numDataFiles){

                        mgr.performRecoverableFileDelete( dir );

                    }else{

                        deleteDataFileContents( torrent, torrent_save_dir, torrent_save_file, force_no_recycle );
                }
                }
                catch(PlatformManagerException ex)
                {
                    deleteDataFileContents( torrent, torrent_save_dir, torrent_save_file, force_no_recycle );
                }
            }
            else{
                deleteDataFileContents(torrent, torrent_save_dir, torrent_save_file, force_no_recycle);
            }

        }
    }catch( Throwable e ){

        Debug.printStackTrace( e );
    }
}
 
开发者ID:AcademicTorrents,项目名称:AcademicTorrents-Downloader,代码行数:70,代码来源:DiskManagerImpl.java

示例13: initialize

import org.gudy.azureus2.platform.PlatformManager; //导入方法依赖的package包/类
public void
initialize(
	PluginInterface	_plugin_interface)
{
	plugin_interface	= _plugin_interface;
	
	plugin_interface.getPluginProperties().setProperty( "plugin.name", "Platform-Specific Support" );

	String	version = "1.0";	// default version if plugin not present
	
	PlatformManager platform	= PlatformManagerFactory.getPlatformManager();

	if ( platform.getPlatformType() == PlatformManager.PT_MACOSX ){

		if ( platform.hasCapability( PlatformManagerCapabilities.GetVersion )){
			
			try{
				version = platform.getVersion();
				
			}catch( Throwable e ){
				
				Debug.printStackTrace(e);
			}
		}
		
		plugin_interface.getUpdateManager().registerUpdatableComponent( this, false );
		
	}else{
		
		plugin_interface.getPluginProperties().setProperty( "plugin.version.info", "Not required for this platform" );
		
	}
	
	plugin_interface.getPluginProperties().setProperty( "plugin.version", version );
}
 
开发者ID:thangbn,项目名称:Direct-File-Downloader,代码行数:36,代码来源:PlatformManagerUpdateChecker.java

示例14: initialize

import org.gudy.azureus2.platform.PlatformManager; //导入方法依赖的package包/类
public void
initialize(
	PluginInterface	_plugin_interface)
{
	plugin_interface	= _plugin_interface;
	
	plugin_interface.getPluginProperties().setProperty( "plugin.name", "Platform-Specific Support" );

	String	version = "1.0";	// default version if plugin not present
	
	PlatformManager platform	= PlatformManagerFactory.getPlatformManager();

	if (  platform.getPlatformType() == PlatformManager.PT_WINDOWS ){

		if ( platform.hasCapability( PlatformManagerCapabilities.GetVersion )){
			
			try{
				version = platform.getVersion();
				
			}catch( Throwable e ){
				
				Debug.printStackTrace(e);
			}
		}
		
		plugin_interface.getUpdateManager().registerUpdatableComponent( this, false );
		
	}else{
		
		plugin_interface.getPluginProperties().setProperty( "plugin.version.info", "Not required for this platform" );
		
	}
	
	plugin_interface.getPluginProperties().setProperty( "plugin.version", version );
}
 
开发者ID:thangbn,项目名称:Direct-File-Downloader,代码行数:36,代码来源:PlatformManagerUpdateChecker.java


注:本文中的org.gudy.azureus2.platform.PlatformManager.hasCapability方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。