diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java index 265a4f69f0..b8bf36356d 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java @@ -35,24 +35,17 @@ public class FileVersionCellEditor extends AbstractCellEditor implements TableCe @Override public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { - String fileOfVersion = null; + String fileOfVersion; Component editor = row == 0 ? firstRowPanel : renderAndEditor; if (isSelected) { return editor; } else if (row == 0) { String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); - try { - fileOfVersion = WorkContext.getCurrent().get(VcsOperator.class).getFileOfCurrent(path.replaceFirst("/", "")); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage()); - } + fileOfVersion = WorkContext.getCurrent().get(VcsOperator.class).getFileOfCurrent(path.replaceFirst("/", "")); } else { renderAndEditor.update((VcsEntity) value); - try { - fileOfVersion = WorkContext.getCurrent().get(VcsOperator.class).getFileOfFileVersion(((VcsEntity) value).getFilename(), ((VcsEntity) value).getVersion()); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage()); - } + fileOfVersion = WorkContext.getCurrent().get(VcsOperator.class).getFileOfFileVersion(((VcsEntity) value).getFilename(), ((VcsEntity) value).getVersion()); + } editor.setBackground(VcsHelper.TABLE_SELECT_BACKGROUND); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java index 4ac537a183..6bcb206a02 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java @@ -7,8 +7,9 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.i18n.Toolkit; -import com.fr.report.ReportContext; import com.fr.report.entity.VcsEntity; +import com.fr.workspace.WorkContext; +import com.fr.workspace.server.vcs.VcsOperator; import javax.swing.AbstractAction; import javax.swing.Box; @@ -59,7 +60,7 @@ public class FileVersionDialog extends UIDialog { public void actionPerformed(ActionEvent e) { FileVersionDialog.this.setVisible(false); Date date = dateEditor.getValue(); - List vcsEntities = ReportContext.getInstance().getVcsController().queryFilterFileVersions(date, new Date(date.getTime() + DELAY), textField.getText()); + List vcsEntities = WorkContext.getCurrent().get(VcsOperator.class).getFilterVersions(date, new Date(date.getTime() + DELAY), textField.getText()); FileVersionTable.getInstance().updateModel(1, vcsEntities); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java index 11464df749..45e80e2620 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java @@ -63,11 +63,7 @@ public class FileVersionRowPanel extends JPanel { public void actionPerformed(ActionEvent evt) { if (JOptionPane.showConfirmDialog(null, Toolkit.i18nText("Fine-Design_Vcs_Version_Revert_Confirm"), Toolkit.i18nText("Fine-Design_Vcs_Version_Revert_Title"), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { - try { - WorkContext.getCurrent().get(VcsOperator.class).rollbackTo(vcsEntity); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage()); - } + WorkContext.getCurrent().get(VcsOperator.class).rollbackTo(vcsEntity); FileVersionsPanel.getInstance().exitVcs(vcsEntity.getFilename()); } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java index a85a2668ef..2e68e0e33c 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java @@ -134,11 +134,7 @@ public class FileVersionsPanel extends BasicPane { } titleLabel.setText(filename); String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); - try { - FileVersionTable.getInstance().updateModel(1, WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst("/", ""))); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage()); - } + FileVersionTable.getInstance().updateModel(1, WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst("/", ""))); } public void showFileVersionsPane() { diff --git a/designer-realize/src/main/java/com/fr/start/Designer.java b/designer-realize/src/main/java/com/fr/start/Designer.java index edd26cb05d..fae55cc4ae 100644 --- a/designer-realize/src/main/java/com/fr/start/Designer.java +++ b/designer-realize/src/main/java/com/fr/start/Designer.java @@ -292,18 +292,14 @@ public class Designer extends BaseDesigner { * @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()); + 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); } }