Merge pull request #1515 from SiboVG/issue-1513
[#1513] Combine 'Add component' and 'Modify new component' undo action
This commit is contained in:
commit
6cb334fedd
@ -230,8 +230,9 @@ public class ComponentConfigDialog extends JDialog implements ComponentChangeLis
|
|||||||
* @param document the document to configure.
|
* @param document the document to configure.
|
||||||
* @param component the component to configure.
|
* @param component the component to configure.
|
||||||
* @param rememberPreviousTab if true, the previous tab will be remembered and used for the new dialog
|
* @param rememberPreviousTab if true, the previous tab will be remembered and used for the new dialog
|
||||||
|
* @param includeUndoModify if true, include a 'Modify component' undo action
|
||||||
*/
|
*/
|
||||||
public static void showDialog(Window parent, OpenRocketDocument document, RocketComponent component, boolean rememberPreviousTab) {
|
public static void showDialog(Window parent, OpenRocketDocument document, RocketComponent component, boolean rememberPreviousTab, boolean includeUndoModify) {
|
||||||
if (dialog != null) {
|
if (dialog != null) {
|
||||||
// Don't remember the previous tab for rockets or stages, because this will leave you in the override tab for
|
// Don't remember the previous tab for rockets or stages, because this will leave you in the override tab for
|
||||||
// the next component, which is generally not what you want.
|
// the next component, which is generally not what you want.
|
||||||
@ -258,12 +259,26 @@ public class ComponentConfigDialog extends JDialog implements ComponentChangeLis
|
|||||||
dialog.setVisible(true);
|
dialog.setVisible(true);
|
||||||
|
|
||||||
////Modify
|
////Modify
|
||||||
|
if (includeUndoModify) {
|
||||||
if (component.getConfigListeners().size() == 0) {
|
if (component.getConfigListeners().size() == 0) {
|
||||||
document.addUndoPosition(trans.get("ComponentCfgDlg.Modify") + " " + component.getComponentName());
|
document.addUndoPosition(trans.get("ComponentCfgDlg.Modify") + " " + component.getComponentName());
|
||||||
} else {
|
} else {
|
||||||
document.addUndoPosition(trans.get("ComponentCfgDlg.ModifyComponents"));
|
document.addUndoPosition(trans.get("ComponentCfgDlg.ModifyComponents"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A singleton configuration dialog. Will create and show a new dialog if one has not
|
||||||
|
* previously been used, or update the dialog and show it if a previous one exists.
|
||||||
|
*
|
||||||
|
* @param document the document to configure.
|
||||||
|
* @param component the component to configure.
|
||||||
|
* @param rememberPreviousTab if true, the previous tab will be remembered and used for the new dialog
|
||||||
|
*/
|
||||||
|
public static void showDialog(Window parent, OpenRocketDocument document, RocketComponent component, boolean rememberPreviousTab) {
|
||||||
|
ComponentConfigDialog.showDialog(parent, document, component, rememberPreviousTab, true);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A singleton configuration dialog. Will create and show a new dialog if one has not
|
* A singleton configuration dialog. Will create and show a new dialog if one has not
|
||||||
|
@ -488,7 +488,7 @@ public class ComponentAddButtons extends JPanel implements Scrollable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ComponentConfigDialog.showDialog(parent, document, component, false);
|
ComponentConfigDialog.showDialog(parent, document, component, false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user