RSS news reader; initially copied from "all the news"
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.news / src / net / sourceforge / phpeclipse / news / pref / BanListEditor.java
1 package net.sourceforge.phpeclipse.news.pref;
2
3 import net.sourceforge.phpeclipse.news.Plugin;
4
5 import org.eclipse.jface.dialogs.InputDialog;
6 import org.eclipse.jface.preference.ListEditor;
7 import org.eclipse.swt.widgets.Composite;
8
9 public class BanListEditor extends ListEditor {
10
11     /**
12      * Constructor for SiteListEditor
13      */
14     protected BanListEditor(String name, String labelText, Composite parent) {
15         super(name, labelText, parent);
16     }
17
18     /**
19      * @see ListEditor#parseString(String)
20      */
21     protected String[] parseString(String stringList) {
22         return ListEncoder.decode(stringList);
23     }
24
25     /**
26      * @see ListEditor#getNewInputObject()
27      */
28     protected String getNewInputObject() {
29         InputDialog dialog;
30         dialog = new InputDialog(this.getShell(),"All The News","Enter item title to ban","",null);
31         dialog.open();
32         if("".equals(dialog.getValue()) || dialog.getValue()==null) {
33                 return null;
34         } else {
35             return dialog.getValue();
36         }
37     }
38
39     /**
40      * @see ListEditor#createList(String[])
41      */
42     protected String createList(String[] items) {
43         return ListEncoder.encode(items);
44     }
45
46     /**
47      * @see org.eclipse.jface.preference.FieldEditor#doStore()
48      */
49     protected void doStore() {
50         super.doStore();
51         Plugin.getDefault().updateBanList();
52     }
53
54
55     /**
56      * @see org.eclipse.jface.preference.FieldEditor#doLoadDefault()
57      */
58     protected void doLoadDefault() {
59         super.doLoadDefault();
60         Plugin.getDefault().updateBanList();
61     }
62 }
63