Clean up code
This commit is contained in:
parent
203d4e8b2a
commit
c69455545c
@ -167,7 +167,7 @@ public class BasicFrame extends JFrame {
|
||||
selectionModel.attachComponentTreeSelectionModel(componentSelectionModel);
|
||||
selectionModel.attachSimulationListSelectionModel(simulationSelectionModel);
|
||||
|
||||
actions = new RocketActions(document, selectionModel, this);
|
||||
actions = new RocketActions(document, selectionModel, this, simulationPanel);
|
||||
|
||||
// Populate the popup menu
|
||||
popupMenu = new JPopupMenu();
|
||||
@ -708,7 +708,7 @@ public class BasicFrame extends JFrame {
|
||||
menu.addSeparator();
|
||||
|
||||
|
||||
item = new JMenuItem(actions.getEditAction(simulationPanel));
|
||||
item = new JMenuItem(actions.getEditAction());
|
||||
menu.add(item);
|
||||
|
||||
item = new JMenuItem(actions.getCutAction());
|
||||
|
@ -61,6 +61,7 @@ public class RocketActions {
|
||||
private final Rocket rocket;
|
||||
private final BasicFrame parentFrame;
|
||||
private final DocumentSelectionModel selectionModel;
|
||||
private final SimulationPanel simulationPanel;
|
||||
|
||||
|
||||
private final RocketAction deleteComponentAction;
|
||||
@ -81,11 +82,12 @@ public class RocketActions {
|
||||
|
||||
|
||||
public RocketActions(OpenRocketDocument document, DocumentSelectionModel selectionModel,
|
||||
BasicFrame parentFrame) {
|
||||
BasicFrame parentFrame, SimulationPanel simulationPanel) {
|
||||
this.document = document;
|
||||
this.rocket = document.getRocket();
|
||||
this.selectionModel = selectionModel;
|
||||
this.parentFrame = parentFrame;
|
||||
this.simulationPanel = simulationPanel;
|
||||
|
||||
// Add action also to updateActions()
|
||||
this.deleteAction = new DeleteAction();
|
||||
@ -175,10 +177,6 @@ public class RocketActions {
|
||||
public Action getEditAction() {
|
||||
return editAction;
|
||||
}
|
||||
public Action getEditAction(SimulationPanel simulationPanel) {
|
||||
((EditAction) editAction).setSimulationPanel(simulationPanel);
|
||||
return editAction;
|
||||
}
|
||||
|
||||
public Action getEditActionNoIcon() {
|
||||
return editActionNoIcon;
|
||||
@ -884,7 +882,6 @@ public class RocketActions {
|
||||
*/
|
||||
private class EditAction extends RocketAction {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private SimulationPanel simulationPanel = null;
|
||||
|
||||
public EditAction() {
|
||||
//// Edit
|
||||
@ -897,10 +894,6 @@ public class RocketActions {
|
||||
clipboardChanged();
|
||||
}
|
||||
|
||||
public void setSimulationPanel(SimulationPanel simulationPanel) {
|
||||
this.simulationPanel = simulationPanel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
List<RocketComponent> components = selectionModel.getSelectedComponents();
|
||||
|
Loading…
x
Reference in New Issue
Block a user