Remove unused SavedGame references and related functionality

it didn't really work for a long time anyway and was extremely outdated
This commit is contained in:
OMGeeky
2025-07-17 20:11:51 +02:00
parent af48341439
commit f6fbb0f5a3
8 changed files with 0 additions and 748 deletions

View File

@@ -8,7 +8,6 @@ import com.gpl.rpg.atcontentstudio.model.bookmarks.BookmarkEntry;
import com.gpl.rpg.atcontentstudio.model.gamedata.JSONElement;
import com.gpl.rpg.atcontentstudio.model.maps.TMXMap;
import com.gpl.rpg.atcontentstudio.model.maps.WorldmapSegment;
import com.gpl.rpg.atcontentstudio.model.saves.SavedGame;
import com.gpl.rpg.atcontentstudio.model.sprites.Spritesheet;
import com.gpl.rpg.atcontentstudio.model.tools.writermode.WriterModeData;
import com.jidesoft.swing.TreeSearchable;
@@ -198,10 +197,6 @@ public class ProjectsTree extends JPanel {
addNextSeparator = true;
popupMenu.add(new JMenuItem(actions.createWorldmap));
}
if (actions.loadSave.isEnabled()) {
addNextSeparator = true;
popupMenu.add(new JMenuItem(actions.loadSave));
}
if (addNextSeparator) {
popupMenu.add(new JSeparator());
addNextSeparator = false;
@@ -261,295 +256,6 @@ public class ProjectsTree extends JPanel {
}
});
}
// if (projectsTree.getSelectionPath() == null || projectsTree.getSelectionPath().getLastPathComponent() == null) {
// JMenuItem addProject = new JMenuItem("Create project...");
// popupMenu.add(addProject);
// addProject.addActionListener(new ActionListener() {
// @Override
// public void actionPerformed(ActionEvent e) {
// new ProjectCreationWizard().setVisible(true);
// }
// });
// popupMenu.addSeparator();
// } else if (projectsTree.getSelectionPaths().length > 1) {
// boolean deleteAll = false;
// final List<GameDataElement> elementsToDelete = new ArrayList<GameDataElement>();
// for (TreePath selected : projectsTree.getSelectionPaths()) {
// if (selected.getLastPathComponent() instanceof GameDataElement && ((GameDataElement)selected.getLastPathComponent()).writable) {
// elementsToDelete.add((GameDataElement) selected.getLastPathComponent());
// deleteAll = true;
// } else {
// deleteAll = false;
// break;
// }
// }
// if (deleteAll) {
// JMenuItem deleteItems = new JMenuItem("Delete all selected elements");
// popupMenu.add(deleteItems);
// deleteItems.addActionListener(new ActionListener() {
// @Override
// public void actionPerformed(ActionEvent e) {
// final Map<GameDataCategory<JSONElement>, Set<File>> impactedCategories = new IdentityHashMap<GameDataCategory<JSONElement>, Set<File>>();
// for (GameDataElement element : elementsToDelete) {
// ATContentStudio.frame.closeEditor(element);
// element.childrenRemoved(new ArrayList<ProjectTreeNode>());
// if (element instanceof JSONElement) {
// @SuppressWarnings("unchecked")
// GameDataCategory<JSONElement> category = (GameDataCategory<JSONElement>) element.getParent();
// category.remove(element);
// if (impactedCategories.get(category) == null) {
// impactedCategories.put(category, new HashSet<File>());
// }
// impactedCategories.get(category).add(((JSONElement) element).jsonFile);
// } else if (element instanceof TMXMap) {
// TMXMapSet parent = (TMXMapSet) element.getParent();
// parent.tmxMaps.remove(element);
// }
// }
// new Thread() {
// @Override
// public void run() {
// final List<SaveEvent> events = new ArrayList<SaveEvent>();
// List<SaveEvent> catEvents = null;
// for (GameDataCategory<JSONElement> category : impactedCategories.keySet()) {
// for (File f : impactedCategories.get(category)) {
// catEvents = category.attemptSave(true, f.getName());
// if (catEvents.isEmpty()) {
// category.save(f);
// } else {
// events.addAll(catEvents);
// }
// }
// }
// if (!events.isEmpty()) {
// new SaveItemsWizard(events, null).setVisible(true);
// }
// }
// }.start();
// }
// });
// }
//
// popupMenu.addSeparator();
// } else {
// final ProjectTreeNode selected = (ProjectTreeNode) projectsTree.getSelectionPath().getLastPathComponent();
// if (selected instanceof Project) {
// JMenuItem closeProject = new JMenuItem("Close Project...");
// JMenuItem deleteProject = new JMenuItem("Delete Project...");
// popupMenu.add(closeProject);
// popupMenu.add(deleteProject);
// popupMenu.addSeparator();
// closeProject.addActionListener(new ActionListener() {
// @Override
// public void actionPerformed(ActionEvent e) {
// Workspace.closeProject((Project) selected);
// }
// });
// deleteProject.addActionListener(new ActionListener() {
// @Override
// public void actionPerformed(ActionEvent e) {
// int confirm = JOptionPane.showConfirmDialog(ProjectsTree.this, "Are you sure you wish to delete this project ?\nAll files created for it will be deleted too...", "Delete this project ?", JOptionPane.OK_CANCEL_OPTION);
// if (confirm == JOptionPane.OK_OPTION) {
// Workspace.deleteProject(((Project)projectsTree.getSelectionPath().getLastPathComponent()));
// }
// }
// });
// }
// if (selected instanceof ClosedProject) {
// JMenuItem openProject = new JMenuItem("Open Project...");
// JMenuItem deleteProject = new JMenuItem("Delete Project...");
// popupMenu.add(openProject);
// popupMenu.add(deleteProject);
// popupMenu.addSeparator();
// openProject.addActionListener(new ActionListener() {
// @Override
// public void actionPerformed(ActionEvent e) {
// Workspace.openProject(((ClosedProject)selected));
// }
// });
// deleteProject.addActionListener(new ActionListener() {
// @Override
// public void actionPerformed(ActionEvent e) {
// int confirm = JOptionPane.showConfirmDialog(ProjectsTree.this, "Are you sure you wish to delete this project ?\nAll files created for it will be deleted too...", "Delete this project ?", JOptionPane.OK_CANCEL_OPTION);
// if (confirm == JOptionPane.OK_OPTION) {
// Workspace.deleteProject(((ClosedProject)selected));
// }
// }
// });
// }
// if (selected.getProject() != null) {
// final Project proj = ((ProjectTreeNode)selected).getProject();
// JMenuItem createGDE = new JMenuItem("Create Game Data Element (JSON)");
// popupMenu.add(createGDE);
// createGDE.addActionListener(new ActionListener() {
// @Override
// public void actionPerformed(ActionEvent e) {
// new JSONCreationWizard(proj).setVisible(true);
// }
// });
// JMenuItem importJson = new JMenuItem("Import JSON data");
// popupMenu.add(importJson);
// importJson.addActionListener(new ActionListener() {
// @Override
// public void actionPerformed(ActionEvent e) {
// new JSONImportWizard(proj).setVisible(true);
// }
// });
// //TODO move somewhere else
// JMenu compareElementsMenu = new JMenu("Open comparator for...");
// JMenuItem compareItems = new JMenuItem("Items");
// compareElementsMenu.add(compareItems);
// compareItems.addActionListener(new ActionListener() {
// @Override
// public void actionPerformed(ActionEvent e) {
// ATContentStudio.frame.editors.openEditor(new ItemsTableView(selected.getProject()));
// }
// });
// JMenuItem compareNPCs = new JMenuItem("NPCs");
// compareElementsMenu.add(compareNPCs);
// compareNPCs.addActionListener(new ActionListener() {
// @Override
// public void actionPerformed(ActionEvent e) {
// ATContentStudio.frame.editors.openEditor(new NPCsTableView(selected.getProject()));
// }
// });
// popupMenu.add(compareElementsMenu);
//
// JMenuItem exportProjectPackage = new JMenuItem("Export project");
// exportProjectPackage.addActionListener(new ActionListener() {
// @Override
// public void actionPerformed(ActionEvent e) {
// JFileChooser chooser = new JFileChooser() {
// private static final long serialVersionUID = 8039332384370636746L;
// public boolean accept(File f) {
// return f.isDirectory() || f.getName().endsWith(".zip") || f.getName().endsWith(".ZIP");
// }
// };
// chooser.setMultiSelectionEnabled(false);
// int result = chooser.showSaveDialog(ATContentStudio.frame);
// if (result == JFileChooser.APPROVE_OPTION) {
// selected.getProject().generateExportPackage(chooser.getSelectedFile());
// }
// }
// });
// popupMenu.add(exportProjectPackage);
// popupMenu.addSeparator();
// }
// if (selected instanceof GameDataElement) {
// final GameDataElement node = ((GameDataElement)selected);
// if (node.state == GameDataElement.State.modified){
// JMenuItem saveItem = new JMenuItem("Save this element");
// saveItem.addActionListener(new ActionListener() {
// @Override
// public void actionPerformed(ActionEvent e) {
// node.save();
// ATContentStudio.frame.nodeChanged(node);
// }
// });
// popupMenu.add(saveItem);
// }
//
// JMenuItem deleteItem = null;
// if (node.getDataType() == GameSource.Type.created) {
// deleteItem = new JMenuItem("Delete this element");
// } else if (node.getDataType() == GameSource.Type.altered) {
// deleteItem = new JMenuItem("Revert to original");
// }
// if (deleteItem != null) {
// popupMenu.add(deleteItem);
// deleteItem.addActionListener(new ActionListener() {
// @SuppressWarnings("unchecked")
// @Override
// public void actionPerformed(ActionEvent e) {
// ATContentStudio.frame.closeEditor(node);
// new Thread() {
// @Override
// public void run() {
// node.childrenRemoved(new ArrayList<ProjectTreeNode>());
// if (node.getParent() instanceof GameDataCategory<?>) {
// ((GameDataCategory<?>)node.getParent()).remove(node);
// List<SaveEvent> events = node.attemptSave();
// if (events == null || events.isEmpty()) {
// node.save();
// } else {
// new SaveItemsWizard(events, null).setVisible(true);
// }
// }
// }
// }.start();
// }
// });
// }
// popupMenu.addSeparator();
//
// }
// if (selected instanceof Project || selected instanceof SavedGamesSet) {
// JMenuItem addSave = new JMenuItem("Load saved game...");
// popupMenu.add(addSave);
// popupMenu.addSeparator();
// addSave.addActionListener(new ActionListener() {
// @Override
// public void actionPerformed(ActionEvent e) {
// JFileChooser chooser = new JFileChooser("Select an Andor's Trail save file");
// if (chooser.showOpenDialog(ATContentStudio.frame) == JFileChooser.APPROVE_OPTION) {
// selected.getProject().addSave(chooser.getSelectedFile());
// selected.getProject().save();
// }
// }
// });
//
// }
// }
// if (konamiCodeEntered) {
// JMenuItem openTrainer = new JMenuItem("Start Andor's Trainer...");
// popupMenu.add(openTrainer);
// popupMenu.addSeparator();
// openTrainer.addActionListener(new ActionListener() {
// @Override
// public void actionPerformed(ActionEvent e) {
// new Thread() {
// public void run() {
// AndorsTrainer.startApp(false);
// }
// }.start();
// }
// });
// }
// JMenu changeLaF = new JMenu("Change Look and Feel");
// for (final LookAndFeelInfo i : UIManager.getInstalledLookAndFeels()) {
// final JMenuItem lafItem = new JMenuItem("Switch to "+i.getName());
// changeLaF.add(lafItem);
// lafItem.addActionListener(new ActionListener() {
// @Override
// public void actionPerformed(ActionEvent e) {
// try {
// UIManager.setLookAndFeel(i.getClassName());
// SwingUtilities.updateComponentTreeUI(ATContentStudio.frame);
// ConfigCache.setFavoriteLaFClassName(i.getClassName());
// } catch (ClassNotFoundException e1) {
// e1.printStackTrace();
// } catch (InstantiationException e1) {
// e1.printStackTrace();
// } catch (IllegalAccessException e1) {
// e1.printStackTrace();
// } catch (UnsupportedLookAndFeelException e1) {
// e1.printStackTrace();
// }
// }
// });
// }
// popupMenu.add(changeLaF);
// popupMenu.addSeparator();
// JMenuItem showAbout = new JMenuItem("About...");
// popupMenu.add(showAbout);
// popupMenu.addSeparator();
// showAbout.addActionListener(new ActionListener() {
// @Override
// public void actionPerformed(ActionEvent e) {
// ATContentStudio.frame.showAbout();
// }
// });
}
public void popupActivated(MouseEvent e) {
@@ -584,10 +290,6 @@ public class ProjectsTree extends JPanel {
ATContentStudio.frame.openEditor((WriterModeData) node);
} else if (node instanceof BookmarkEntry) {
ATContentStudio.frame.openEditor(((BookmarkEntry) node).bookmarkedElement);
} else if (node instanceof SavedGame) {
if (konamiCodeEntered) {
ATContentStudio.frame.openEditor((SavedGame) node);
}
}
}