{"id":30845459,"url":"https://github.com/tharindu714/code-editor-memento","last_synced_at":"2025-09-06T23:10:54.401Z","repository":{"id":308705441,"uuid":"1033781479","full_name":"Tharindu714/Code-Editor-Memento","owner":"Tharindu714","description":"A sleek, dark-themed Java Swing code editor with robust Undo/Redo powered by the Memento Pattern.","archived":false,"fork":false,"pushed_at":"2025-08-07T10:56:09.000Z","size":7,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-07T12:34:02.788Z","etag":null,"topics":["code","java","memento-pattern","oodp"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Tharindu714.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-07T10:35:25.000Z","updated_at":"2025-08-07T10:56:13.000Z","dependencies_parsed_at":"2025-08-07T12:34:04.282Z","dependency_job_id":"e11598d2-99a7-45a9-9b44-5ab9861eb5e9","html_url":"https://github.com/Tharindu714/Code-Editor-Memento","commit_stats":null,"previous_names":["tharindu714/code-editor-memento"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/Tharindu714/Code-Editor-Memento","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tharindu714%2FCode-Editor-Memento","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tharindu714%2FCode-Editor-Memento/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tharindu714%2FCode-Editor-Memento/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tharindu714%2FCode-Editor-Memento/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Tharindu714","download_url":"https://codeload.github.com/Tharindu714/Code-Editor-Memento/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tharindu714%2FCode-Editor-Memento/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273974082,"owners_count":25200587,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-06T02:00:13.247Z","response_time":2576,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["code","java","memento-pattern","oodp"],"created_at":"2025-09-06T23:10:48.640Z","updated_at":"2025-09-06T23:10:54.384Z","avatar_url":"https://github.com/Tharindu714.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🌒 Code-Editor-Memento\n\n\u003e A sleek, dark-themed Java Swing code editor with robust **Undo/Redo** powered by the **Memento** Pattern.\n\n---\n\n## 📝 Scenario\n\n\u003e You are building an **online code editor** that lets users write and edit code in real-time. It needs **Undo** and **Redo** functionality without exposing internal state or hogging memory.\n\n\u003cp align=\"center\"\u003e\n\u003cimg width=\"1000\" alt=\"image\" src=\"https://github.com/user-attachments/assets/f7914b49-94fe-4a11-a040-b6aea28d32b9\" /\u003e\n\u003c/p\u003e\n\n---\n\n## ⚙️ Features\n\n* **Dark Mode UI**: Eye-friendly dark background with light-colored monospaced font.\n* **Memento-based History**: Encapsulated state snapshots enable efficient undo/redo.\n* **Stack-based Navigation**: Unlimited undo/redo operations via two history stacks.\n* **Fluent GUI Controls**: Toolbar buttons for seamless user interaction.\n\n---\n\n## 📸 GUI Screenshot\n\n\u003cp align=\"center\"\u003e\n\u003cimg width=\"1366\" height=\"723\" alt=\"image\" src=\"https://github.com/user-attachments/assets/70003de1-8088-4545-bfac-ca338f2b23ea\" /\u003e\n\u003c/p\u003e\n---\n\n## 📐 UML Class Diagram\n\n\u003cp align=\"center\"\u003e\n  \u003cimg width=\"183\" height=\"435\" alt=\"image\" src=\"https://github.com/user-attachments/assets/cb0ed9d3-1535-48be-ad37-b5cfefcc52ea\" /\u003e\n\u003c/p\u003e\n\n\u003e *Generate and paste UML diagram here.*\n\n---\n\n## 📖 Memento Pattern Theory\n\nThe **Memento** Pattern provides the ability to restore an object to its previous state without exposing its internal structure. It involves three key participants:\n\n1. **Originator** 🏭\n\n   * Holds the current state of the editor document (`String state`).\n   * Can create a **Memento** capturing its state and restore from it.\n\n2. **Memento** 🎁\n\n   * A simple, immutable value object that stores the internal state snapshot.\n   * Does **not** expose its internals beyond what the Originator needs.\n\n3. **Caretaker** 🤵\n\n   * Manages saving and retrieving Memento objects.\n   * Maintains two stacks: one for **undo** and one for **redo** history.\n   * Controls when to clear redo history to preserve correct behavior.\n\n### How It Works in Our App\n\n1. **On Every Edit**: A new Memento is saved to the **undo** stack. The **redo** stack is cleared.\n2. **Undo** 🔙: Pop the top Memento from undo → push it to redo → restore the previous snapshot.\n3. **Redo** 🔜: Pop the top Memento from redo → restore it → push it back on undo.\n4. **Encapsulation**: The editor’s text content is never exposed; only the Originator knows its state.\n\n---\n\n## 🚀 Usage\n\n```bash\n# Clone the repo\ngit clone https://github.com/Tharindu714/Code-Editor-Memento.git\n# Open in your favorite IDE\ngradle run   # or mvn compile exec:java\n```\n\n---\n\n## 🤝 Contributing\n\nPull requests and issues are welcome! Feel free to improve docs, add features, or optimize performance.\n\n---\n\n## 📄 License\n\nThis project is licensed under the MIT License. See [LICENSE](LICENSE) for details.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftharindu714%2Fcode-editor-memento","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftharindu714%2Fcode-editor-memento","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftharindu714%2Fcode-editor-memento/lists"}