diff --git a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java index 58d9b0e88d..8da6b7a3b6 100644 --- a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java +++ b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java @@ -239,11 +239,7 @@ public class TemplateTreePane extends JPanel implements FileOperations { String reportPath = reportletsTree.getSelectedTemplatePath(); final String selectedFilePath = StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, reportPath); String lock = node.getLock(); - boolean showLockInfo = LockInfoUtils.isCompatibleOperator() - || LockInfoUtils.unableGetLockInfo() - || WorkContext.getCurrent().get(LockInfoOperator.class).isTplUnLocked(selectedFilePath) - ? (lock != null && !lock.equals(node.getUserID())) - : WorkContext.getCurrent().get(LockInfoOperator.class).isTplLocked(selectedFilePath); + boolean showLockInfo = needShowLockInfo(lock, selectedFilePath, node); if (showLockInfo) { UserInfo userInfo = WorkContext.getCurrent().get(LockInfoOperator.class).getUserInfo(selectedFilePath); node.setLock(UUID.randomUUID().toString()); @@ -257,6 +253,17 @@ public class TemplateTreePane extends JPanel implements FileOperations { DesignerContext.getDesignerFrame().openTemplate(new FileNodeFILE(new FileNode(selectedFilePath, false))); } + /** + * 是否需要展示锁定信息 + */ + public static boolean needShowLockInfo(String lock, String selectedFilePath, FileNode node) { + return LockInfoUtils.isCompatibleOperator() + || LockInfoUtils.unableGetLockInfo() + || WorkContext.getCurrent().get(LockInfoOperator.class).isTplUnLocked(selectedFilePath) + ? (lock != null && !lock.equals(node.getUserID())) + : WorkContext.getCurrent().get(LockInfoOperator.class).isTplLocked(selectedFilePath); + } + private void checkDevelopForBiddenTemplate(String selectedFilePath) { JTemplate template = getOpenedTemplate(selectedFilePath); if (template != null && template.isForbidden()) { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java index 20b31d9c28..080edb4a25 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java @@ -4,6 +4,7 @@ import com.fr.base.svg.IconUtils; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.FineJOptionPane; +import com.fr.design.file.TemplateTreePane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.lock.LockInfoUtils; @@ -165,11 +166,7 @@ public class VcsCenterPane extends VcsNewPane { protected Boolean doInBackground() throws Exception { String selectedFilePath = getTemplateTruePath(filename); String lock = node.getLock(); - return LockInfoUtils.isCompatibleOperator() - || LockInfoUtils.unableGetLockInfo() - || WorkContext.getCurrent().get(LockInfoOperator.class).isTplUnLocked(selectedFilePath) - ? (lock != null && !lock.equals(node.getUserID())) - : WorkContext.getCurrent().get(LockInfoOperator.class).isTplLocked(selectedFilePath); + return TemplateTreePane.needShowLockInfo(lock, selectedFilePath, node); } @Override protected void done() {