|
|
@ -4,6 +4,7 @@ import com.fr.base.svg.IconUtils; |
|
|
|
import com.fr.design.dialog.FineJOptionPane; |
|
|
|
import com.fr.design.dialog.FineJOptionPane; |
|
|
|
import com.fr.design.file.HistoryTemplateListCache; |
|
|
|
import com.fr.design.file.HistoryTemplateListCache; |
|
|
|
import com.fr.design.file.MultiTemplateTabPane; |
|
|
|
import com.fr.design.file.MultiTemplateTabPane; |
|
|
|
|
|
|
|
import com.fr.design.file.TemplateTreePane; |
|
|
|
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.mainframe.DesignerContext; |
|
|
|
import com.fr.design.mainframe.DesignerContext; |
|
|
@ -16,19 +17,20 @@ import com.fr.design.mainframe.vcs.common.VcsCacheFileNodeFile; |
|
|
|
import com.fr.design.mainframe.vcs.common.VcsHelper; |
|
|
|
import com.fr.design.mainframe.vcs.common.VcsHelper; |
|
|
|
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.file.filetree.FileNodes; |
|
|
|
import com.fr.io.utils.ResourceIOUtils; |
|
|
|
import com.fr.io.utils.ResourceIOUtils; |
|
|
|
|
|
|
|
import com.fr.report.InconsistentLockException; |
|
|
|
import com.fr.report.entity.VcsEntity; |
|
|
|
import com.fr.report.entity.VcsEntity; |
|
|
|
|
|
|
|
import com.fr.stable.StableUtils; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
|
|
|
|
import com.fr.stable.project.ProjectConstants; |
|
|
|
import com.fr.workspace.WorkContext; |
|
|
|
import com.fr.workspace.WorkContext; |
|
|
|
|
|
|
|
import com.fr.workspace.resource.WorkResource; |
|
|
|
import com.fr.workspace.server.vcs.VcsFileUtils; |
|
|
|
import com.fr.workspace.server.vcs.VcsFileUtils; |
|
|
|
import com.fr.workspace.server.vcs.VcsOperator; |
|
|
|
import com.fr.workspace.server.vcs.VcsOperator; |
|
|
|
import com.fr.workspace.server.vcs.v2.VcsTaskResult; |
|
|
|
import com.fr.workspace.server.vcs.v2.VcsTaskResult; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.Icon; |
|
|
|
import javax.swing.*; |
|
|
|
import javax.swing.JComponent; |
|
|
|
|
|
|
|
import javax.swing.JOptionPane; |
|
|
|
|
|
|
|
import javax.swing.JTable; |
|
|
|
|
|
|
|
import javax.swing.SwingWorker; |
|
|
|
|
|
|
|
import java.awt.*; |
|
|
|
import java.awt.*; |
|
|
|
import java.awt.event.MouseAdapter; |
|
|
|
import java.awt.event.MouseAdapter; |
|
|
|
import java.awt.event.MouseEvent; |
|
|
|
import java.awt.event.MouseEvent; |
|
|
@ -179,9 +181,12 @@ public class VcsNewPane extends RecyclePane { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected VcsTaskResult doInBackground() throws Exception { |
|
|
|
protected VcsTaskResult doInBackground() throws Exception { |
|
|
|
String path = VcsHelper.getInstance().getFilePath(entity); |
|
|
|
String path = VcsHelper.getInstance().getFilePath(entity); |
|
|
|
if (!ResourceIOUtils.exist(path)) { |
|
|
|
if (!WorkContext.getCurrent().get(WorkResource.class).exist(path)) { |
|
|
|
return new VcsTaskResult(false, new FileNotFoundException()); |
|
|
|
return new VcsTaskResult(false, new FileNotFoundException()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (checkLock(entity.getFilename())) { |
|
|
|
|
|
|
|
return new VcsTaskResult(false, new InconsistentLockException()); |
|
|
|
|
|
|
|
} |
|
|
|
//step1.设置还原的用户名
|
|
|
|
//step1.设置还原的用户名
|
|
|
|
entity.setUsername(VcsHelper.getInstance().getCurrentUsername()); |
|
|
|
entity.setUsername(VcsHelper.getInstance().getCurrentUsername()); |
|
|
|
//step2.rollback到指定版本
|
|
|
|
//step2.rollback到指定版本
|
|
|
@ -206,7 +211,11 @@ public class VcsNewPane extends RecyclePane { |
|
|
|
} |
|
|
|
} |
|
|
|
DesignerContext.getDesignerFrame().openTemplate(new FileNodeFILE(new FileNode(filePath, false))); |
|
|
|
DesignerContext.getDesignerFrame().openTemplate(new FileNodeFILE(new FileNode(filePath, false))); |
|
|
|
} else { |
|
|
|
} 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) { |
|
|
|
} catch (InterruptedException | ExecutionException e) { |
|
|
|
throw new RuntimeException(e); |
|
|
|
throw new RuntimeException(e); |
|
|
@ -215,6 +224,19 @@ public class VcsNewPane extends RecyclePane { |
|
|
|
}.execute(); |
|
|
|
}.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() { |
|
|
|
private void initDeleteListener() { |
|
|
|
delete.addMouseListener(new MouseAdapter() { |
|
|
|
delete.addMouseListener(new MouseAdapter() { |
|
|
|