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


Java PlatformManager类代码示例

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


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

示例1: getDocPath

import org.gudy.azureus2.platform.PlatformManager; //导入依赖的package包/类
public static String getDocPath() {
 if ( PORTABLE ){
 
  return( getUserPath());
 }
 
File fDocPath = null;
try {
	PlatformManager platformManager = PlatformManagerFactory.getPlatformManager();

	fDocPath = platformManager.getLocation(PlatformManager.LOC_DOCUMENTS);
} catch (Throwable e) {
}
if (fDocPath == null) {
	System.err.println( "This is BAD - fix me!" );
	new Throwable().printStackTrace();
	// should never happen.. but if we are missing a dll..
	fDocPath = new File(getUserPath(), "Documents");
}

return fDocPath.getAbsolutePath();
}
 
开发者ID:thangbn,项目名称:Direct-File-Downloader,代码行数:23,代码来源:SystemProperties.java

示例2: 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();
    	
    	pm.createProcess( command_line, false );
    	    	
    }catch(Throwable e) {
    	
        Debug.printStackTrace(e);
        
        try{
        	Runtime.getRuntime().exec( command_line );
        	
        }catch( Throwable f ){
        	
        	throw( new PluginException("Failed to create process", f ));
        }
    }
}
 
开发者ID:thangbn,项目名称:Direct-File-Downloader,代码行数:27,代码来源:UtilitiesImpl.java

示例3: win32NativeRestart

import org.gudy.azureus2.platform.PlatformManager; //导入依赖的package包/类
private boolean
win32NativeRestart(
	PrintWriter	log,
	String		exec )
{
    try{
    		// we need to spawn without inheriting handles
    	
    	PlatformManager pm = PlatformManagerFactory.getPlatformManager();
    	
    	pm.createProcess( exec, false );
    
    	return( true );
    	
    }catch(Throwable e) {
        e.printStackTrace(log);
        
        return( false );
    }
}
 
开发者ID:thangbn,项目名称:Direct-File-Downloader,代码行数:21,代码来源:AzureusRestarterImpl.java

示例4: 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

示例5: 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

示例6: AssociationChecker

import org.gudy.azureus2.platform.PlatformManager; //导入依赖的package包/类
protected
AssociationChecker(
	final PlatformManager		_platform )
{
	platform	= _platform;
	
	display = SWTThread.getInstance().getDisplay();
						
	if ( display.isDisposed()){
							
		return;
	}
						
	Utils.execSWTThread(
			new AERunnable()
			{
				public void
				runSupport()
				{
					check();
				}
			});
}
 
开发者ID:AcademicTorrents,项目名称:AcademicTorrents-Downloader,代码行数:24,代码来源:AssociationChecker.java

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例13: 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

示例14: 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

示例15: getSingleton

import org.gudy.azureus2.platform.PlatformManager; //导入依赖的package包/类
public static PlatformManager getSingleton()
{
    return singleton;
}
 
开发者ID:AcademicTorrents,项目名称:AcademicTorrents-Downloader,代码行数:5,代码来源:PlatformManagerImpl.java


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