Browse Source

REPORT-14835 调整代码

research/10.0
XiaXiang 6 years ago
parent
commit
1ec46c20d5
  1. 30
      designer-realize/src/main/java/com/fr/start/Designer.java

30
designer-realize/src/main/java/com/fr/start/Designer.java

@ -279,30 +279,32 @@ public class Designer extends BaseDesigner {
jt.stopEditing(); jt.stopEditing();
jt.saveTemplate(); jt.saveTemplate();
jt.requestFocus(); jt.requestFocus();
String fileName = VcsHelper.getEditingFilename(); if (DesignerEnvManager.getEnvManager().isVcsEnable()) {
int latestFileVersion = 0; dealWithVcs(jt);
try {
latestFileVersion = WorkContext.getCurrent().get(VcsOperator.class).getLatestFileVersion(fileName);
} catch (Exception e1) {
FineLoggerFactory.getLogger().error(e1.getMessage());
} }
}
});
return saveButton;
}
/**
* 版本控制
* @param jt
*/
private void dealWithVcs(JTemplate jt) {
try { try {
String fileName = VcsHelper.getEditingFilename();
int latestFileVersion = WorkContext.getCurrent().get(VcsOperator.class).getLatestFileVersion(fileName);
if (jt.getEditingFILE() instanceof VcsCacheFileNodeFile) { if (jt.getEditingFILE() instanceof VcsCacheFileNodeFile) {
WorkContext.getCurrent().get(VcsOperator.class).saveVersionFromCache(VcsHelper.CURRENT_USERNAME, fileName, StringUtils.EMPTY, latestFileVersion + 1); WorkContext.getCurrent().get(VcsOperator.class).saveVersionFromCache(VcsHelper.CURRENT_USERNAME, fileName, StringUtils.EMPTY, latestFileVersion + 1);
String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath();
FileVersionTable.getInstance().updateModel(1, WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst("/", ""))); FileVersionTable.getInstance().updateModel(1, WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst("/", "")));
} else { } else {
WorkContext.getCurrent().get(VcsOperator.class).saveVersion(VcsHelper.CURRENT_USERNAME, fileName, StringUtils.EMPTY, latestFileVersion + 1); WorkContext.getCurrent().get(VcsOperator.class).saveVersion(VcsHelper.CURRENT_USERNAME, fileName, StringUtils.EMPTY, latestFileVersion + 1);
} }
} catch (Exception e1) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e1.getMessage()); FineLoggerFactory.getLogger().error("vcs error: {}", e.getMessage());
}
} }
});
return saveButton;
} }
private UIButton createUndoButton() { private UIButton createUndoButton() {

Loading…
Cancel
Save