Browse Source

REPORT-101740 【版本管理三期】版本中心打开被锁定的模板,没有提示

new-design
Destiny.Lin 1 year ago
parent
commit
f025058d0e
  1. 34
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java

34
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java

@ -6,6 +6,7 @@ import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.lock.LockInfoUtils;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.vcs.VcsOperatorWorker; import com.fr.design.mainframe.vcs.VcsOperatorWorker;
@ -15,6 +16,7 @@ import com.fr.design.mainframe.vcs.common.VcsCloseTemplateHelper;
import com.fr.file.FileNodeFILE; import com.fr.file.FileNodeFILE;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.report.entity.VcsEntity; import com.fr.report.entity.VcsEntity;
import com.fr.report.lock.LockInfoOperator;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
@ -25,10 +27,13 @@ import javax.swing.Icon;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.JTable; import javax.swing.JTable;
import javax.swing.SwingWorker;
import javax.swing.UIManager;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutionException;
/** /**
@ -148,12 +153,39 @@ public class VcsCenterPane extends VcsNewPane {
if (o instanceof VcsTableEntity) { if (o instanceof VcsTableEntity) {
VcsEntity entity = ((VcsTableEntity) o).getEntity(); VcsEntity entity = ((VcsTableEntity) o).getEntity();
saveSettingAndCloseDialog(); saveSettingAndCloseDialog();
DesignerContext.getDesignerFrame().openTemplate(new FileNodeFILE(new FileNode(getTemplateTruePath(entity.getFilename()), false))); showTemplate(entity.getFilename(), new FileNode(getTemplateTruePath(entity.getFilename()), false));
} }
} }
}); });
} }
private void showTemplate(String filename, FileNode node) {
new SwingWorker<Boolean, Void>() {
@Override
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);
}
@Override
protected void done() {
try {
if (!get()) {
DesignerContext.getDesignerFrame().openTemplate(new FileNodeFILE(node));
} else {
FineJOptionPane.showMessageDialog(VcsCenterPane.this, Toolkit.i18nText("Fine-Design_Vcs_Open_Lock_Tip"), UIManager.getString("OptionPane.messageDialogTitle"), JOptionPane.ERROR_MESSAGE);
}
} catch (InterruptedException | ExecutionException e) {
throw new RuntimeException(e);
}
}
}.execute();
}
private void initManagerListener() { private void initManagerListener() {
manager.addMouseListener(new MouseAdapter() { manager.addMouseListener(new MouseAdapter() {
@Override @Override

Loading…
Cancel
Save