本文整理汇总了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]));
}
}
示例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());
}
}
示例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());
}
}