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


Java ApplicationUtils.isFirstTimeAppHasBeenRun方法代码示例

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


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

示例1: applyAssumedStartupBehaviors

import com.sandwich.koan.util.ApplicationUtils; //导入方法依赖的package包/类
void applyAssumedStartupBehaviors() {
	if(ApplicationUtils.isFirstTimeAppHasBeenRun()){
		ArgumentType.BACKUP.run(new String[0]);
		ApplicationUtils.getPresenter().clearMessages();
	}
	if(isEmpty() || !containsKey(ArgumentType.RUN_KOANS) && (
			containsKey(ArgumentType.CLASS_ARG) ||
			containsKey(ArgumentType.DEBUG))){
		if(ApplicationSettings.isDebug()){
			SuitePresenter presenter = ApplicationUtils.getPresenter();
			presenter.displayMessage("Planting default run target.");
			for(Entry<ArgumentType, CommandLineArgument> argEntry : entrySet()){
				presenter.displayMessage("Key: '"+argEntry.getKey()+"'");
				presenter.displayMessage("Value: '"+argEntry.getValue()+"'");
			}
		}
		put(ArgumentType.RUN_KOANS, new CommandLineArgument(ArgumentType.RUN_KOANS, true, new String[0]));
	}
}
 
开发者ID:nkalupahana,项目名称:completed-koans,代码行数:20,代码来源:CommandLineArgumentBuilder.java

示例2: main

import com.sandwich.koan.util.ApplicationUtils; //导入方法依赖的package包/类
public static void main(final String... args) throws Throwable {
	Map<ArgumentType, CommandLineArgument> argsMap = new CommandLineArgumentBuilder(args);
	if(argsMap.containsKey(ArgumentType.RUN_KOANS)){
		new Thread(new Runnable(){ 
			public void run() {
				do{
					try {
						char c = (char)System.in.read();
						if(Character.toUpperCase(c) == 
								Character.toUpperCase(ApplicationSettings.getExitChar())){
							FileMonitorFactory.closeAll();
							System.exit(0);
						}
					} catch (IOException e) {
						throw new RuntimeException(e);
					}
				}while(true);
			}
		}).start();
		FileMonitor monitor = FileMonitorFactory.getInstance(
				new File(DirectoryManager.getProdMainDir()), 
				new File(DirectoryManager.getDataFile()));
		if(ApplicationUtils.isFirstTimeAppHasBeenRun()){
			monitor.writeChanges();
		}
		monitor.addFileSavedListener(new KoanFileCompileAndRunListener(argsMap));
	}
	new CommandLineArgumentRunner(argsMap).run();
	if(ApplicationSettings.isDebug()){
		StringBuilder argsBuilder = new StringBuilder();
		int argNumber = 0;
		for(String arg : args){
			argsBuilder.append("Argument number "+String.valueOf(++argNumber)+": '"+arg+"'");
		}
		ApplicationUtils.getPresenter().displayMessage(argsBuilder.toString());
	}
}
 
开发者ID:MarinaMurashev,项目名称:JavaKoans,代码行数:38,代码来源:AppLauncher.java

示例3: main

import com.sandwich.koan.util.ApplicationUtils; //导入方法依赖的package包/类
public static void main(final String... args) throws Throwable {
    Map<ArgumentType, CommandLineArgument> argsMap = new CommandLineArgumentBuilder(
            args);
    if (argsMap.containsKey(ArgumentType.RUN_KOANS)) {
        if (ApplicationSettings.isInteractive()) {
            new Thread(new Runnable() {
                public void run() {
                    do {
                        try {
                            char c = (char) System.in.read();
                            char exitChar = ApplicationSettings.getExitChar();
                            if (Character.toUpperCase(c) == Character.toUpperCase(exitChar)) {
                                exit(0);
                            }
                        } catch (IOException e) {
                            throw new RuntimeException(e);
                        }
                    } while (true);
                }

            }).start();
            FileMonitor monitor = FileMonitorFactory.getInstance(new File(
                    DirectoryManager.getProdMainDir()), new File(
                    DirectoryManager.getDataFile()));
            if (ApplicationUtils.isFirstTimeAppHasBeenRun()) {
                monitor.writeChanges();
            }
            monitor.addFileSavedListener(new KoanFileCompileAndRunListener(argsMap));
        }
    }
    new CommandLineArgumentRunner(argsMap).run();
    if (ApplicationSettings.isDebug()) {
        StringBuilder argsBuilder = new StringBuilder();
        int argNumber = 0;
        for (String arg : args) {
            argsBuilder.append("Argument number "
                    + String.valueOf(++argNumber) + ": '" + arg + "'");
        }
        ApplicationUtils.getPresenter().displayMessage(
                argsBuilder.toString());
    }
}
 
开发者ID:nkalupahana,项目名称:completed-koans,代码行数:43,代码来源:AppLauncher.java


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