|
|
|
@ -169,6 +169,19 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void openTemplate0(DesignerFrame df, AtomicBoolean isException, FILE file) { |
|
|
|
|
|
|
|
|
|
file = getExtraFILE(isException, file); |
|
|
|
|
|
|
|
|
|
if (file != null && file.exists() && !isException.get()) { |
|
|
|
|
df.openTemplate(file); |
|
|
|
|
} else { |
|
|
|
|
df.addAndActivateJTemplate(); |
|
|
|
|
// 如果没有模板,则需要确认一下
|
|
|
|
|
MutilTempalteTabPane.getInstance().setTemTemplate(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private FILE getExtraFILE(AtomicBoolean isException, FILE file) { |
|
|
|
|
|
|
|
|
|
//启动时打开指定文件的接口
|
|
|
|
|
DesignerStartOpenFileProcessor processor = ExtraDesignClassManager.getInstance().getSingle(DesignerStartOpenFileProcessor.XML_TAG); |
|
|
|
@ -184,14 +197,7 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
|
|
|
|
|
isException.set(true);//此时有文件nullpointer异常,执行打开空文件
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (file != null && file.exists() && !isException.get()) { |
|
|
|
|
df.openTemplate(file); |
|
|
|
|
} else { |
|
|
|
|
df.addAndActivateJTemplate(); |
|
|
|
|
// 如果没有模板,则需要确认一下
|
|
|
|
|
MutilTempalteTabPane.getInstance().setTemTemplate(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); |
|
|
|
|
} |
|
|
|
|
return file; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private boolean openTemplateOnStartup(DesignerFrame df, AtomicBoolean isException, FILE file) { |
|
|
|
@ -200,25 +206,40 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
|
|
|
|
|
if (onStartup) { |
|
|
|
|
DesignerStartupContext context = DesignerStartupContext.getInstance(); |
|
|
|
|
if (context.isCreateNew()) { |
|
|
|
|
df.addAndActivateJTemplate(); |
|
|
|
|
// 如果没有模板,则需要确认一下
|
|
|
|
|
MutilTempalteTabPane.getInstance().setTemTemplate(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); |
|
|
|
|
return true; |
|
|
|
|
return createNewTemplate(df); |
|
|
|
|
} |
|
|
|
|
if (context.isOpenLastFile()) { |
|
|
|
|
if (file != null && file.exists() && !isException.get()) { |
|
|
|
|
df.openTemplate(file); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
if (isOpenTemplate(isException, file, context)) { |
|
|
|
|
return openTemplate(df, file); |
|
|
|
|
} |
|
|
|
|
if (context.isOpenEmpty()) { |
|
|
|
|
df.showEmptyJTemplate(); |
|
|
|
|
return true; |
|
|
|
|
return openEmpty(df); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private boolean isOpenTemplate(AtomicBoolean isException, FILE file, DesignerStartupContext context) { |
|
|
|
|
|
|
|
|
|
return context.isOpenLastFile() && file != null && file.exists() && !isException.get(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private boolean openEmpty(DesignerFrame df) { |
|
|
|
|
df.showEmptyJTemplate(); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private boolean openTemplate(DesignerFrame df, FILE file) { |
|
|
|
|
df.openTemplate(file); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private boolean createNewTemplate(DesignerFrame df) { |
|
|
|
|
df.addAndActivateJTemplate(); |
|
|
|
|
// 如果没有模板,则需要确认一下
|
|
|
|
|
MutilTempalteTabPane.getInstance().setTemTemplate(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void enableFullScreenMode(Window window) { |
|
|
|
|
String className = "com.apple.eawt.FullScreenUtilities"; |
|
|
|
|
String methodName = "setWindowCanFullScreen"; |
|
|
|
|