|
|
|
@ -14,6 +14,7 @@ import com.fr.general.ComparatorUtils;
|
|
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
|
|
|
|
|
|
import javax.swing.JOptionPane; |
|
|
|
|
import javax.swing.SwingUtilities; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 版本管理关闭模板辅助类 |
|
|
|
@ -38,17 +39,18 @@ public class VcsCloseTemplateHelper {
|
|
|
|
|
* @param dialog 生成的新版本管理的详情面板的父面板 |
|
|
|
|
*/ |
|
|
|
|
public static void checkTemplateSavedAndShowVcsNewPane(String path, boolean isCurrentEditing, BasicDialog dialog, VcsNewPane pane) { |
|
|
|
|
VcsNewPaneWrapper wrapper = new VcsNewPaneWrapper(path, dialog, pane); |
|
|
|
|
for (JTemplate jTemplate : HistoryTemplateListCache.getInstance().getHistoryList()) { |
|
|
|
|
if (ComparatorUtils.equals(jTemplate.getEditingFILE().getPath(), path)) { |
|
|
|
|
if (!jTemplate.isALLSaved()) { |
|
|
|
|
MultiTemplateTabPane.getInstance().setIsCloseCurrent(isCurrentEditing); |
|
|
|
|
MultiTemplateTabPane.getInstance().closeFormat(jTemplate); |
|
|
|
|
confirmCloseAndShowVcsNewPane(jTemplate, path, dialog, pane); |
|
|
|
|
confirmCloseAndShowVcsNewPane(jTemplate, wrapper); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
showVcsNewPane(path, dialog, pane); |
|
|
|
|
wrapper.show(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -78,42 +80,31 @@ public class VcsCloseTemplateHelper {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void confirmCloseAndShowVcsNewPane(JTemplate<?, ?> specifiedTemplate, String path, BasicDialog dialog, VcsNewPane pane) { |
|
|
|
|
private static void confirmCloseAndShowVcsNewPane(JTemplate<?, ?> specifiedTemplate, VcsNewPaneWrapper wrapper) { |
|
|
|
|
if (specifiedTemplate == null) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (!specifiedTemplate.isALLSaved() && !DesignerMode.isVcsMode()) { |
|
|
|
|
specifiedTemplate.stopEditing(); |
|
|
|
|
int returnVal = FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Utils_Would_You_Like_To_Save") + " \"" + specifiedTemplate.getEditingFILE() + "\" ?", |
|
|
|
|
int returnVal = FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), |
|
|
|
|
String.format("%s\"%s\" ?",Toolkit.i18nText("Fine-Design_Basic_Utils_Would_You_Like_To_Save"), specifiedTemplate.getEditingFILE()), |
|
|
|
|
Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); |
|
|
|
|
if (returnVal == JOptionPane.YES_OPTION) { |
|
|
|
|
CallbackSaveWorker worker = specifiedTemplate.save(); |
|
|
|
|
worker.addSuccessCallback(() -> { |
|
|
|
|
FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", specifiedTemplate.getEditingFILE().getName())); |
|
|
|
|
showVcsNewPane(path, dialog, pane); |
|
|
|
|
SwingUtilities.invokeLater(wrapper::show); |
|
|
|
|
}); |
|
|
|
|
worker.start(specifiedTemplate.getRuntimeId()); |
|
|
|
|
} else if (returnVal == JOptionPane.NO_OPTION) { |
|
|
|
|
closeTpl(specifiedTemplate); |
|
|
|
|
showVcsNewPane(path, dialog, pane); |
|
|
|
|
wrapper.show(); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
showVcsNewPane(path, dialog, pane); |
|
|
|
|
wrapper.show(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static void showVcsNewPane(String path, BasicDialog dialog, VcsNewPane pane) { |
|
|
|
|
if (pane != null) { |
|
|
|
|
pane.showDialog(dialog); |
|
|
|
|
} else { |
|
|
|
|
VcsNewPane newPane = new VcsNewPane(path); |
|
|
|
|
newPane.showDialog(dialog); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static void closeTpl(JTemplate<?, ?> specifiedTemplate) { |
|
|
|
|
HistoryTemplateListCache.getInstance().closeSelectedReport(specifiedTemplate); |
|
|
|
|
MultiTemplateTabPane.getInstance().closeAndFreeLock(specifiedTemplate); |
|
|
|
|