|
|
@ -967,6 +967,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>> |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
try { |
|
|
|
try { |
|
|
|
|
|
|
|
checkBeforeSave(); |
|
|
|
export(); |
|
|
|
export(); |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
@ -985,7 +986,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>> |
|
|
|
return isNewCreateTpl; |
|
|
|
return isNewCreateTpl; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected boolean export() throws Exception { |
|
|
|
protected void checkBeforeSave() throws Exception { |
|
|
|
// 保存前校验下未解锁
|
|
|
|
// 保存前校验下未解锁
|
|
|
|
if (WorkContext.getCurrent().get(LockInfoOperator.class).isTplUnLocked(getEditingFILE().getPath())) { |
|
|
|
if (WorkContext.getCurrent().get(LockInfoOperator.class).isTplUnLocked(getEditingFILE().getPath())) { |
|
|
|
throw new UnLockedException(); |
|
|
|
throw new UnLockedException(); |
|
|
@ -994,6 +995,9 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>> |
|
|
|
if (getEditingFILE().exists() && !WorkContext.getCurrent().get(LockInfoOperator.class).isConsistentLock(getEditingFILE().getPath())) { |
|
|
|
if (getEditingFILE().exists() && !WorkContext.getCurrent().get(LockInfoOperator.class).isConsistentLock(getEditingFILE().getPath())) { |
|
|
|
throw new InconsistentLockException(); |
|
|
|
throw new InconsistentLockException(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected boolean export() throws Exception { |
|
|
|
return this.getTarget().export(TemplateResourceManager.getResource().saveTemplate(getEditingFILE())); |
|
|
|
return this.getTarget().export(TemplateResourceManager.getResource().saveTemplate(getEditingFILE())); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
@ -1634,6 +1638,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>> |
|
|
|
if (editingFILE == null || editingFILE instanceof MemFILE) { |
|
|
|
if (editingFILE == null || editingFILE instanceof MemFILE) { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
checkBeforeSave(); |
|
|
|
export(); |
|
|
|
export(); |
|
|
|
this.editingFILE = editingFILE; |
|
|
|
this.editingFILE = editingFILE; |
|
|
|
return true; |
|
|
|
return true; |
|
|
|