Browse Source

REPORT-14835 调整代码

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

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

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

Loading…
Cancel
Save