Browse Source

Pull request #7364: REPORT-65050 远程模板锁定优化-fvs模板被超管在某设备上强制解锁后,编辑者点击保存时不会触发另存为弹窗,而是保存成功

Merge in DESIGN/design from ~HADES/design:release/11.0 to release/11.0

* commit '20160eae69d617c4f0717903ef6b86eb6d910df3':
  REPORT-65050 远程模板锁定优化-fvs模板被超管在某设备上强制解锁后,编辑者点击保存时不会触发另存为弹窗,而是保存成功
bugfix/11.0
Hades 3 years ago
parent
commit
47c39cb3ca
  1. 7
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  2. 9
      designer-base/src/main/java/com/fr/design/worker/save/SaveFailureHandler.java

7
designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

@ -967,6 +967,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
return false;
}
try {
checkBeforeSave();
export();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
@ -985,7 +986,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
return isNewCreateTpl;
}
protected boolean export() throws Exception {
protected void checkBeforeSave() throws Exception {
// 保存前校验下未解锁
if (WorkContext.getCurrent().get(LockInfoOperator.class).isTplUnLocked(getEditingFILE().getPath())) {
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())) {
throw new InconsistentLockException();
}
}
protected boolean export() throws Exception {
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) {
return false;
}
checkBeforeSave();
export();
this.editingFILE = editingFILE;
return true;

9
designer-base/src/main/java/com/fr/design/worker/save/SaveFailureHandler.java

@ -6,6 +6,7 @@ import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.ui.util.UIUtil;
import com.fr.design.utils.TemplateUtils;
import com.fr.file.FileNodeFILE;
import com.fr.file.filetree.FileNode;
@ -31,11 +32,19 @@ public class SaveFailureHandler implements ThrowableHandler {
@Override
public boolean process(Throwable e) {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
for (Handler handler : Handler.values()) {
try {
if (handler.process(e)) {
break;
}
} catch (Exception ignored) {
}
}
}
});
return true;
}

Loading…
Cancel
Save