Browse Source

Pull request #12558: REPORT-101409 【版本管理三期】删除无权限的版本没有失败提示

Merge in DESIGN/design from ~DESTINY.LIN/design:final/11.0 to final/11.0

* commit '8c13453363af4835d211f855ff4a7e3899376bfe':
  REPORT-101409 【版本管理三期】删除无权限的版本没有失败提示
  REPORT-101409 【版本管理三期】删除无权限的版本没有失败提示
new-design
Destiny.Lin-林锦龙 1 year ago committed by Coral.Chen-张晨
parent
commit
f33313754b
  1. 6
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java
  2. 31
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java

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

@ -241,12 +241,6 @@ public class VcsCenterPane extends VcsNewPane {
return TITLE;
}
private String getTemplateTruePath(String filename) {
return StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, filename);
}
@Override
protected String getDeleteTip(int size) {
return Toolkit.i18nText("Fine-Design_Vcs_Delete_Select_All_Version");

31
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java

@ -4,6 +4,7 @@ import com.fr.base.svg.IconUtils;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.MultiTemplateTabPane;
import com.fr.design.file.TemplateTreePane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
@ -16,10 +17,15 @@ import com.fr.design.mainframe.vcs.common.VcsCacheFileNodeFile;
import com.fr.design.mainframe.vcs.common.VcsHelper;
import com.fr.file.FileNodeFILE;
import com.fr.file.filetree.FileNode;
import com.fr.file.filetree.FileNodes;
import com.fr.io.utils.ResourceIOUtils;
import com.fr.report.InconsistentLockException;
import com.fr.report.entity.VcsEntity;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants;
import com.fr.workspace.WorkContext;
import com.fr.workspace.resource.WorkResource;
import com.fr.workspace.server.vcs.VcsFileUtils;
import com.fr.workspace.server.vcs.VcsOperator;
import com.fr.workspace.server.vcs.v2.VcsTaskResult;
@ -29,6 +35,7 @@ import javax.swing.JComponent;
import javax.swing.JOptionPane;
import javax.swing.JTable;
import javax.swing.SwingWorker;
import javax.swing.UIManager;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
@ -179,9 +186,12 @@ public class VcsNewPane extends RecyclePane {
@Override
protected VcsTaskResult doInBackground() throws Exception {
String path = VcsHelper.getInstance().getFilePath(entity);
if (!ResourceIOUtils.exist(path)) {
if (!WorkContext.getCurrent().get(WorkResource.class).exist(path)) {
return new VcsTaskResult(false, new FileNotFoundException());
}
if (checkLock(entity.getFilename())) {
return new VcsTaskResult(false, new InconsistentLockException());
}
//step1.设置还原的用户名
entity.setUsername(VcsHelper.getInstance().getCurrentUsername());
//step2.rollback到指定版本
@ -206,7 +216,11 @@ public class VcsNewPane extends RecyclePane {
}
DesignerContext.getDesignerFrame().openTemplate(new FileNodeFILE(new FileNode(filePath, false)));
} else {
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Warning_Template_Do_Not_Exsit"));
if (result.getException() instanceof FileNotFoundException) {
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Warning_Template_Do_Not_Exsit"));
} else {
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Vcs_Open_Lock_Tip"), UIManager.getString("OptionPane.messageDialogTitle"), JOptionPane.ERROR_MESSAGE);
}
}
} catch (InterruptedException | ExecutionException e) {
throw new RuntimeException(e);
@ -215,6 +229,19 @@ public class VcsNewPane extends RecyclePane {
}.execute();
}
private boolean checkLock(String filename) {
String selectedFilePath = getTemplateTruePath(filename);
FileNode node = new FileNode(getTemplateTruePath(filename), false);
String lock = node.getLock();
return TemplateTreePane.needShowLockInfo(lock, selectedFilePath, node);
}
/**
* 获取模板的路径
*/
public String getTemplateTruePath(String filename) {
return StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, filename);
}
private void initDeleteListener() {
delete.addMouseListener(new MouseAdapter() {

Loading…
Cancel
Save