PageRenderTime 132ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/src/mpv5/pluginhandling/Plugin.java

http://mp-rechnungs-und-kundenverwaltung.googlecode.com/
Java | 93 lines | 48 code | 13 blank | 32 comment | 0 complexity | 3ce28434c508eef30ff1f3b9a6f9fca4 MD5 | raw file
Possible License(s): LGPL-3.0, Apache-2.0, GPL-3.0, GPL-2.0, AGPL-3.0, JSON, BSD-3-Clause
  1. /*
  2. * This file is part of YaBS.
  3. *
  4. * YaBS is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * YaBS is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with YaBS. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. package mpv5.pluginhandling;
  18. import javax.swing.JComponent;
  19. import mpv5.db.common.Context;
  20. import mpv5.db.common.DatabaseObject;
  21. import mpv5.db.common.QueryHandler;
  22. import mpv5.logging.Log;
  23. import mpv5.utils.images.MPIcon;
  24. /**
  25. * This is the bridge between MP5 Plugins and jars in the database
  26. *
  27. */
  28. public class Plugin extends DatabaseObject {
  29. private String description;
  30. private String filename;
  31. public Plugin() {
  32. setContext(Context.getPlugins());
  33. }
  34. @Override
  35. public JComponent getView() {
  36. return null;
  37. }
  38. /**
  39. * @return the description
  40. */
  41. public String __getDescription() {
  42. return description;
  43. }
  44. /**
  45. * @param description the description to set
  46. */
  47. public void setDescription(String description) {
  48. this.description = description;
  49. }
  50. /**
  51. * @return the filename
  52. */
  53. public String __getFilename() {
  54. return filename;
  55. }
  56. /**
  57. * @param filename the filename to set
  58. */
  59. public void setFilename(String filename) {
  60. this.filename = filename;
  61. }
  62. @Override
  63. public boolean delete() {
  64. try {
  65. QueryHandler.instanceOf().clone(Context.getFiles()).removeFile(__getFilename());
  66. return super.delete();
  67. } catch (Exception ex) {
  68. Log.Debug(ex);
  69. return false;
  70. }
  71. }
  72. @Override
  73. public String toString(){
  74. return __getCname() + " (" + __getDescription() + ")";
  75. }
  76. @Override
  77. public MPIcon getIcon() {
  78. return null;
  79. }
  80. }