|
|
@ -57,6 +57,8 @@ import java.util.Enumeration; |
|
|
|
import java.util.Objects; |
|
|
|
import java.util.Objects; |
|
|
|
import java.util.Observable; |
|
|
|
import java.util.Observable; |
|
|
|
import java.util.Observer; |
|
|
|
import java.util.Observer; |
|
|
|
|
|
|
|
import org.jetbrains.annotations.Nullable; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import static javax.swing.JOptionPane.WARNING_MESSAGE; |
|
|
|
import static javax.swing.JOptionPane.WARNING_MESSAGE; |
|
|
|
import static javax.swing.JOptionPane.YES_NO_OPTION; |
|
|
|
import static javax.swing.JOptionPane.YES_NO_OPTION; |
|
|
@ -226,17 +228,17 @@ public class TemplateTreePane extends JPanel implements FileOperations { |
|
|
|
} |
|
|
|
} |
|
|
|
String reportPath = reportletsTree.getSelectedTemplatePath(); |
|
|
|
String reportPath = reportletsTree.getSelectedTemplatePath(); |
|
|
|
final String selectedFilePath = StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, reportPath); |
|
|
|
final String selectedFilePath = StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, reportPath); |
|
|
|
if (hasOpenedTemplate(selectedFilePath)) { |
|
|
|
|
|
|
|
FineLoggerFactory.getLogger().info("{} has been opened in designer tab", selectedFilePath); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
String lock = node.getLock(); |
|
|
|
String lock = node.getLock(); |
|
|
|
boolean showLockInfo = LockInfoUtils.isCompatibleOperator() || LockInfoUtils.unableGetLockInfo() |
|
|
|
boolean showLockInfo = LockInfoUtils.isCompatibleOperator() |
|
|
|
|
|
|
|
|| LockInfoUtils.unableGetLockInfo() |
|
|
|
|
|
|
|
|| WorkContext.getCurrent().get(LockInfoOperator.class).isTplUnLocked(selectedFilePath) |
|
|
|
? (lock != null && !lock.equals(node.getUserID())) |
|
|
|
? (lock != null && !lock.equals(node.getUserID())) |
|
|
|
: WorkContext.getCurrent().get(LockInfoOperator.class).isTplLocked(selectedFilePath); |
|
|
|
: WorkContext.getCurrent().get(LockInfoOperator.class).isTplLocked(selectedFilePath); |
|
|
|
if (showLockInfo) { |
|
|
|
if (showLockInfo) { |
|
|
|
UserInfo userInfo = WorkContext.getCurrent().get(LockInfoOperator.class).getUserInfo(selectedFilePath); |
|
|
|
UserInfo userInfo = WorkContext.getCurrent().get(LockInfoOperator.class).getUserInfo(selectedFilePath); |
|
|
|
node.setLock(UUID.randomUUID().toString()); |
|
|
|
node.setLock(UUID.randomUUID().toString()); |
|
|
|
|
|
|
|
// 对于开发者预览占位锁定 定位到tab中
|
|
|
|
|
|
|
|
checkDevelopForBiddenTemplate(selectedFilePath); |
|
|
|
LockInfoDialog.show(userInfo); |
|
|
|
LockInfoDialog.show(userInfo); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -245,14 +247,21 @@ public class TemplateTreePane extends JPanel implements FileOperations { |
|
|
|
DesignerContext.getDesignerFrame().openTemplate(new FileNodeFILE(new FileNode(selectedFilePath, false))); |
|
|
|
DesignerContext.getDesignerFrame().openTemplate(new FileNodeFILE(new FileNode(selectedFilePath, false))); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void checkDevelopForBiddenTemplate(String selectedFilePath) { |
|
|
|
|
|
|
|
JTemplate<?, ?> template = getOpenedTemplate(selectedFilePath); |
|
|
|
|
|
|
|
if (template != null && template.isForbidden()) { |
|
|
|
|
|
|
|
DesignerContext.getDesignerFrame().openTemplate(new FileNodeFILE(new FileNode(selectedFilePath, false))); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private boolean hasOpenedTemplate(String path) { |
|
|
|
@Nullable |
|
|
|
|
|
|
|
private JTemplate<?, ?> getOpenedTemplate(String path) { |
|
|
|
for (JTemplate<?, ?> template : HistoryTemplateListCache.getInstance().getHistoryList()) { |
|
|
|
for (JTemplate<?, ?> template : HistoryTemplateListCache.getInstance().getHistoryList()) { |
|
|
|
if (ComparatorUtils.equals(template.getEditingFILE().getPath(), path)) { |
|
|
|
if (ComparatorUtils.equals(template.getEditingFILE().getPath(), path)) { |
|
|
|
return true; |
|
|
|
return template; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return false; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|