當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。