/*
* Gamers Own Instant Messenger
* Copyright (C) 2005-2006 Herbert Poul (kahless@sphene.net)
* http://goim.sphene.net
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
package net.sphene.goim.rcp.preferences;
import java.util.ArrayList;
import java.util.List;
import net.sphene.goim.rcp.GOIMPlugin;
import net.sphene.goim.rcp.extensionpoints.IconSetExtensionPoint;
import net.sphene.goim.rcp.extensionpoints.IconSetExtensionPoint.IconSetExtension;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.RadioGroupFieldEditor;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
public class Icons extends FieldEditorPreferencePage implements
IWorkbenchPreferencePage {
public static final String ID = "net.sphene.goim.rcp.preferences.Icons";
public Icons() {
super(GRID);
setPreferenceStore(GOIMPlugin.getDefault().getMyPreferenceStore());
setDescription("GOIM Icons (Currently you can only set Emoticon set)");
}
@Override
protected void createFieldEditors() {
List<IconSetExtension> iconSets = IconSetExtensionPoint.getIconSetExtensions();
List<String[]> emoticonSetList = new ArrayList<String[]>();
emoticonSetList.add(new String[] { "No Emoticons", "" });
for(IconSetExtension iconSet : iconSets) {
if(iconSet.type.equals(IconSetExtensionPoint.ICONSET_TYPE_EMOTICONS))
emoticonSetList.add(new String[] { iconSet.name + " (" + iconSet.description + ") by " + iconSet.author,iconSet.id });
}
String[][] emoticonSets = emoticonSetList.toArray(new String[2][]);
addField(new RadioGroupFieldEditor(
PreferenceConstants.P_EMOTICONSET,
"EmoticonSet",
1,
emoticonSets,
getFieldEditorParent()));
}
public void init(IWorkbench workbench) {
}
}