Skip to content

Commit

Permalink
added short descriptions to actions
Browse files Browse the repository at this point in the history
  • Loading branch information
i-make-robots committed Dec 19, 2023
1 parent 0a6e933 commit becbad4
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 10 deletions.
12 changes: 5 additions & 7 deletions src/main/java/com/marginallyclever/ro3/RO3Frame.java
Original file line number Diff line number Diff line change
Expand Up @@ -152,23 +152,21 @@ private JMenu buildFileMenu() {
RecentFilesMenu loadRecentMenu = new RecentFilesMenu(Preferences.userNodeForPackage(LoadScene.class));
menuFile.add(new JMenuItem(new LoadScene(loadRecentMenu)));
menuFile.add(loadRecentMenu);
menuFile.add(new JMenuItem(new SaveScene()));

menuFile.add(new JSeparator());
menuFile.add(new JMenuItem(new ImportScene()));

menuFile.add(new JMenuItem(new SaveScene()));
menuFile.add(new JMenuItem(new ExportScene()));
// TODO load recent scene

menuFile.add(new JSeparator());
JMenuItem quit = new JMenuItem(new AbstractAction("Quit") {
menuFile.add(new JMenuItem(new AbstractAction("Quit") {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
if(confirmClose()) {
setDefaultCloseOperation(EXIT_ON_CLOSE);
RO3Frame.this.dispatchEvent(new WindowEvent(RO3Frame.this, WindowEvent.WINDOW_CLOSING));
}
}
});
menuFile.add(quit);
}));

return menuFile;
}
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/marginallyclever/ro3/actions/AddNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@
import java.awt.event.ActionEvent;
import java.util.function.Supplier;

/**
* Add a new instance of a Node to every selected branches of the tree
*/
public class AddNode extends AbstractAction {
private static final FactoryPanel<Node> nfd = new FactoryPanel<>(Registry.nodeFactory);
private final NodeTreeView treeView;

public AddNode(NodeTreeView treeView) {
super("Add Node");
putValue(SHORT_DESCRIPTION,"Add a new instance of a Node to every selected branches of the tree.");
this.treeView = treeView;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@
import java.io.File;

/**
* Export the scene to a file for sharing on another computer. This is not the same as saving the scene.
* Exporting the scene will save the scene and all the assets it uses to a single file.
* <p>Export the scene and all the assets used to a single file for sharing on another computer.
* This is not the same as saving the scene.</p>
*/
public class ExportScene extends AbstractAction {
private static final Logger logger = LoggerFactory.getLogger(SaveScene.class);
private static final JFileChooser chooser = new JFileChooser();

public ExportScene() {
super("Export Scene");
putValue(SHORT_DESCRIPTION,"Export the scene and all the assets used to a single file.");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public class ImportScene extends AbstractAction {

public ImportScene() {
this("Import Scene");
putValue(SHORT_DESCRIPTION,"Load a Scene into the existing Scene.");
}

public ImportScene(String name) {
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/marginallyclever/ro3/actions/LoadScene.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
import java.nio.file.Paths;
import java.security.InvalidParameterException;

/**
* Load a scene from a file. Completely replaces the current Scene.
*/
public class LoadScene extends AbstractAction {
private static final Logger logger = LoggerFactory.getLogger(LoadScene.class);
private static final JFileChooser chooser = new JFileChooser();
Expand All @@ -25,6 +28,7 @@ public class LoadScene extends AbstractAction {

public LoadScene(RecentFilesMenu menu) {
this(menu,null);
putValue(SHORT_DESCRIPTION,"Load a scene from a file. Completely replaces the current Scene.");
}

public LoadScene(RecentFilesMenu menu, String filePath) {
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/marginallyclever/ro3/actions/NewScene.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@
import java.util.ArrayList;
import java.util.List;

/**
* Reset the scene to a new empty scene.
*/
public class NewScene extends AbstractAction {
private static final Logger logger = LoggerFactory.getLogger(NewScene.class);

public NewScene() {
super("New Scene");
putValue(SHORT_DESCRIPTION,"Reset the scene to a new empty scene.");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class RemoveNode extends AbstractAction {
private final NodeTreeView nodeTreeView;
public RemoveNode(NodeTreeView nodeTreeView) {
super("Remove Node");
putValue(SHORT_DESCRIPTION,"Remove the selected node(s).");
this.nodeTreeView = nodeTreeView;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.marginallyclever.ro3.actions;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.marginallyclever.ro3.Registry;
import com.marginallyclever.robotoverlord.RobotOverlord;
import org.slf4j.Logger;
Expand All @@ -14,12 +13,16 @@
import java.io.FileWriter;
import java.io.IOException;

/**
* Save the entire scene to a file.
*/
public class SaveScene extends AbstractAction {
private static final Logger logger = LoggerFactory.getLogger(SaveScene.class);
private static final JFileChooser chooser = new JFileChooser();

public SaveScene() {
super("Save Scene");
putValue(SHORT_DESCRIPTION,"Save the entire scene to a file.");
}

/**
Expand Down

0 comments on commit becbad4

Please sign in to comment.