/src/mpv5/pluginhandling/Plugin.java
Java | 93 lines | 48 code | 13 blank | 32 comment | 0 complexity | 3ce28434c508eef30ff1f3b9a6f9fca4 MD5 | raw file
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 */ 17package mpv5.pluginhandling; 18 19import javax.swing.JComponent; 20import mpv5.db.common.Context; 21import mpv5.db.common.DatabaseObject; 22import mpv5.db.common.QueryHandler; 23import mpv5.logging.Log; 24import mpv5.utils.images.MPIcon; 25 26/** 27 * This is the bridge between MP5 Plugins and jars in the database 28 * 29 */ 30public class Plugin extends DatabaseObject { 31 32 private String description; 33 private String filename; 34 35 public Plugin() { 36 setContext(Context.getPlugins()); 37 } 38 39 @Override 40 public JComponent getView() { 41 return null; 42 } 43 44 45 /** 46 * @return the description 47 */ 48 public String __getDescription() { 49 return description; 50 } 51 52 /** 53 * @param description the description to set 54 */ 55 public void setDescription(String description) { 56 this.description = description; 57 } 58 59 /** 60 * @return the filename 61 */ 62 public String __getFilename() { 63 return filename; 64 } 65 66 /** 67 * @param filename the filename to set 68 */ 69 public void setFilename(String filename) { 70 this.filename = filename; 71 } 72 73 @Override 74 public boolean delete() { 75 try { 76 QueryHandler.instanceOf().clone(Context.getFiles()).removeFile(__getFilename()); 77 return super.delete(); 78 } catch (Exception ex) { 79 Log.Debug(ex); 80 return false; 81 } 82 } 83 84 @Override 85 public String toString(){ 86 return __getCname() + " (" + __getDescription() + ")"; 87 } 88 89 @Override 90 public MPIcon getIcon() { 91 return null; 92 } 93}