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