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


Java OpenFilesEvent类代码示例

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


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

示例1: openFiles

import com.apple.eawt.AppEvent.OpenFilesEvent; //导入依赖的package包/类
/** 
 * Handle the open action 
 * @param ofe open files event
 */
@Override
public void openFiles(final OpenFilesEvent ofe) {
    logEDT("openFiles");

    final int FIRST_FILE_INDEX = 0;
    final String firstFilePath = ofe.getFiles().get(FIRST_FILE_INDEX).getAbsolutePath();
    if (_logger.isInfoEnabled()) {
        _logger.info("Should open '{}' file.", firstFilePath);
    }

    invokeLaterUsingApplicationEDT(new Runnable() {
        @Override
        public void run() {
            logEDT("openFiles");
            _registrar.getOpenAction().actionPerformed(new ActionEvent(_registrar, 0, firstFilePath));
        }
    });
}
 
开发者ID:JMMC-OpenDev,项目名称:jMCS,代码行数:23,代码来源:MacOSXAdapter.java

示例2: openFiles

import com.apple.eawt.AppEvent.OpenFilesEvent; //导入依赖的package包/类
@Override
public void openFiles(OpenFilesEvent openFilesEvent) {
    for (Object obj : openFilesEvent.getFiles()) {
        File file = (File) obj;
        if (file != null) {
            this.app.openFile(file);
        }
    }
}
 
开发者ID:chimenchen,项目名称:jchmlib,代码行数:10,代码来源:ChmWebAppMacSupport.java

示例3: openFiles

import com.apple.eawt.AppEvent.OpenFilesEvent; //导入依赖的package包/类
public void openFiles( OpenFilesEvent arg0 ) {
  System.out.println( "Opening an arff/xrff file under Mac OS X..." );
  File toOpen = arg0.getFiles().get(0);

  if (toOpen.toString().toLowerCase().endsWith(".arff") || 
      toOpen.toString().toLowerCase().endsWith(".xrff")) {
    weka.gui.GUIChooser.createSingleton();
    weka.gui.GUIChooser.getSingleton().showExplorer(toOpen.toString());    
  } else if (toOpen.toString().toLowerCase().endsWith(".kf") ||
             toOpen.toString().toLowerCase().endsWith(".kfml")) {
    weka.gui.GUIChooser.createSingleton();
    weka.gui.GUIChooser.getSingleton().showKnowledgeFlow(toOpen.toString());
  }
}
 
开发者ID:mydzigear,项目名称:repo.kmeanspp.silhouette_score,代码行数:15,代码来源:MacArffOpenFilesHandler.java

示例4: openFiles

import com.apple.eawt.AppEvent.OpenFilesEvent; //导入依赖的package包/类
@Override
public void openFiles(final OpenFilesEvent event) {
    event.getFiles().stream()
            .map(File::toPath)
            .map(ExternalOpenFileEvent::new)
            .forEach(delegate::fireOpenFileEvent);
}
 
开发者ID:VocabHunter,项目名称:VocabHunter,代码行数:8,代码来源:OsxOpenFilesHandler.java

示例5: openFiles

import com.apple.eawt.AppEvent.OpenFilesEvent; //导入依赖的package包/类
@Override
// The OSXAdapter calls this method when a ".bib" file has been double-clicked from the Finder.
public void openFiles(OpenFilesEvent event) {
    if (parentFrame == null) {
        return;
    }

    List<File> files = event.getFiles();

    for (File file : files) {
        parentFrame.openAction(file.getAbsolutePath());
    }
}
 
开发者ID:JabRef,项目名称:jabref,代码行数:14,代码来源:MacAdapter.java

示例6: openFiles

import com.apple.eawt.AppEvent.OpenFilesEvent; //导入依赖的package包/类
@Override
public void openFiles(OpenFilesEvent event) {
	for (File file : event.getFiles()) {
		// We call this rather than directly to open(File) above to allow the file opening to be
		// deferred until startup has finished
		OpenDataFileCommand.open(file);
	}
}
 
开发者ID:Ayutac,项目名称:toolkit,代码行数:9,代码来源:OpenCommand.java

示例7: main

import com.apple.eawt.AppEvent.OpenFilesEvent; //导入依赖的package包/类
public static void main( String[] args )
{
    try {
        // These four lines duplicate ApplicationUI.main()
        String prop = System .getProperty( "user.dir" );
        File workingDir = new File( prop );
        URL codebase = workingDir .toURI() .toURL();
        final ApplicationUI ui = ApplicationUI .initialize( args, codebase );
        
        // Now hook it up to the Finder events
        Application appl = Application .getApplication();
        
        appl .setOpenFileHandler( new OpenFilesHandler()
        {
            public void openFiles( OpenFilesEvent ofe )
            {
                for (Iterator iterator = ofe .getFiles() .iterator(); iterator.hasNext(); ) {
                    File file = (File) iterator.next();
                    ui .openFile( file );
                }
            }
        } );
        
        appl .setAboutHandler( new AboutHandler()
        {
            public void handleAbout( AboutEvent about )
            {
                ui .about();
            }
        } );
        
        appl .setQuitHandler( new QuitHandler()
        {
            public void handleQuitRequestWith( QuitEvent qe, QuitResponse qr )
            {
                if ( ui .quit() )
                    qr .performQuit();
                else
                    qr .cancelQuit();
                    
            }
        } );    

    } catch ( Throwable e ) {
        Logger .getLogger( "com.vzome.platform.mac.Adapter" )
            .log( Level.SEVERE, "problem in main()", e );
    }
}
 
开发者ID:vZome,项目名称:vzome-desktop,代码行数:49,代码来源:Adapter.java

示例8: main

import com.apple.eawt.AppEvent.OpenFilesEvent; //导入依赖的package包/类
/**
 * UiLOTSVideoCodingSystem method tries to add VLC to the search path of this application
 * If this fails, a dialog is opened, asking the user to specify where
 * VLC is installed. Otherwise, the application itself is started
 * 
 * @param args 		-f: fails finding VLC automatically, to test a new
 * 						path while the program would otherwise recognise
 * 						VLC
 * 
 * 					-vlc="<path>": Specify the VLC path. Useful for installers
 * 
 * 					String: Specify the project that the user would like to open
 * 							Required for automatic file association
 */
public static void main(String[] args) {
	LoadingPanel p = new LoadingPanel();
	
	if (Globals.getOs() == Globals.OsType.Mac){
		Application a = Application.getApplication();
		p.updateMsg("Checking Mac OS compatibility...");
		a.setOpenFileHandler(new OpenFilesHandler() {
			@Override
			public void openFiles(OpenFilesEvent e) {
				
				@SuppressWarnings("unchecked")
				List<File> files = e.getFiles();
				if(files.size() > 1){
					JOptionPane.showMessageDialog(new JPanel(), 
							"Only one file can be opened at the time with this application", 
							"Can only open one file",
							JOptionPane.WARNING_MESSAGE);
				}
				openExisting = true;
				existing = files.get(0).getAbsolutePath();
			}
		});
	}
	
	prefs = new ApplicationPreferences();
	p.updateMsg("Initializing application preferences...");
	
	p.updateMsg("Processing arguments..");
	if(args.length > 0) handleArguments(args);
	
	p.updateMsg("Searching for VLC");
	if(vlc_location != null)
		searchDefaultPaths();
	searchPreferencedPath();
	
	if(vlcFound() && !fail_find_vlc)
	{
		p.updateMsg("Initializing application view...");
		// Only starts the main application after VLC has been found
		Globals g = Globals.getInstance();
		g.debug(DEBUG);
		
		if(!openExisting) {
			p.updateMsg("Starting new project...");
			g.showNewProject();
		}
		else {
			p.updateMsg("Opening project...");
			g.open(existing);
		}
	} else {
		SwingUtilities.invokeLater(new Runnable(){
			@Override
			public void run(){
				view.panels.VLCNotFound vlcError = new view.panels.VLCNotFound(prefs);
				vlcError.setVisible(true);
			}
		});
	}
	p.dispose();
}
 
开发者ID:UiL-OTS-labs-backoffice,项目名称:UiL-OTS-Video-Coding-System,代码行数:76,代码来源:UiLOTSVideoCodingSystem.java

示例9: openFiles

import com.apple.eawt.AppEvent.OpenFilesEvent; //导入依赖的package包/类
@Override
public void openFiles(final OpenFilesEvent event) {
	eventService.publish(new AppOpenFilesEvent(event.getFiles()));
}
 
开发者ID:scijava,项目名称:scijava-plugins-platforms,代码行数:5,代码来源:MacOSAppEventDispatcher.java

示例10: openFiles

import com.apple.eawt.AppEvent.OpenFilesEvent; //导入依赖的package包/类
@Override
public void openFiles(OpenFilesEvent ofe) {
    for (File file : ofe.getFiles()) {
        open(file);
    }
}
 
开发者ID:XCodeMT,项目名称:TrueType,代码行数:7,代码来源:TrueType.java

示例11: openFiles

import com.apple.eawt.AppEvent.OpenFilesEvent; //导入依赖的package包/类
/**
 * Called when the application is asked to open a list of files.
 * @param e the request to open a list of files, and the search term used to find them, if any.
 */
public void openFiles(final OpenFilesEvent e);
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:6,代码来源:OpenFilesHandler.java


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