RSS news reader; initially copied from "all the news"
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.news / src / net / sourceforge / phpeclipse / news / pref / BanListEditor.java
diff --git a/archive/net.sourceforge.phpeclipse.news/src/net/sourceforge/phpeclipse/news/pref/BanListEditor.java b/archive/net.sourceforge.phpeclipse.news/src/net/sourceforge/phpeclipse/news/pref/BanListEditor.java
new file mode 100644 (file)
index 0000000..c685c1f
--- /dev/null
@@ -0,0 +1,63 @@
+package net.sourceforge.phpeclipse.news.pref;
+
+import net.sourceforge.phpeclipse.news.Plugin;
+
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.preference.ListEditor;
+import org.eclipse.swt.widgets.Composite;
+
+public class BanListEditor extends ListEditor {
+
+    /**
+     * Constructor for SiteListEditor
+     */
+    protected BanListEditor(String name, String labelText, Composite parent) {
+        super(name, labelText, parent);
+    }
+
+    /**
+     * @see ListEditor#parseString(String)
+     */
+    protected String[] parseString(String stringList) {
+        return ListEncoder.decode(stringList);
+    }
+
+    /**
+     * @see ListEditor#getNewInputObject()
+     */
+    protected String getNewInputObject() {
+        InputDialog dialog;
+        dialog = new InputDialog(this.getShell(),"All The News","Enter item title to ban","",null);
+        dialog.open();
+        if("".equals(dialog.getValue()) || dialog.getValue()==null) {
+               return null;
+        } else {
+            return dialog.getValue();
+        }
+    }
+
+    /**
+     * @see ListEditor#createList(String[])
+     */
+    protected String createList(String[] items) {
+        return ListEncoder.encode(items);
+    }
+
+    /**
+     * @see org.eclipse.jface.preference.FieldEditor#doStore()
+     */
+    protected void doStore() {
+        super.doStore();
+        Plugin.getDefault().updateBanList();
+    }
+
+
+    /**
+     * @see org.eclipse.jface.preference.FieldEditor#doLoadDefault()
+     */
+    protected void doLoadDefault() {
+        super.doLoadDefault();
+        Plugin.getDefault().updateBanList();
+    }
+}
+