1 package org.argosfields.action.game;
2
3 import org.argosfields.ArgosFields;
4 import org.argosfields.action.BaseAction;
5 import org.argosfields.preference.ServerPreferencePage;
6 import org.argosfields.resource.ResourceManager;
7 import org.eclipse.jface.preference.IPreferenceStore;
8 import org.eclipse.jface.preference.JFacePreferences;
9 import org.eclipse.jface.preference.PreferenceDialog;
10 import org.eclipse.jface.preference.PreferenceManager;
11 import org.eclipse.jface.preference.PreferenceNode;
12 import org.eclipse.swt.widgets.Event;
13 import org.eclipse.swt.widgets.Shell;
14
15 /***
16 * SettingsAction.java
17 * @author Xavier Cho
18 * @version $Revision: 1.3 $ $Date: 2004/04/15 05:42:44 $
19 */
20 public class SettingsAction extends BaseAction {
21
22 private PreferenceManager preferenceManager;
23
24 public SettingsAction(final ArgosFields application) {
25 super(application);
26 }
27
28 /***
29 * @see org.eclipse.jface.action.IAction#runWithEvent(org.eclipse.swt.widgets.Event)
30 */
31 public void runWithEvent(final Event event) {
32 Shell shell = getApplication().getShell();
33
34 if (preferenceManager == null) {
35 createPreferenceManager();
36 }
37
38 PreferenceDialog dialog = new PreferenceDialog(shell, preferenceManager);
39
40 IPreferenceStore preferences = JFacePreferences.getPreferenceStore();
41
42 dialog.setPreferenceStore(preferences);
43 dialog.setMinimumPageSize(480, 340);
44 dialog.open();
45 }
46
47 protected void createPreferenceManager() {
48 this.preferenceManager = new PreferenceManager();
49
50 ResourceManager resources = ResourceManager.getInstance();
51
52 PreferenceNode node = new PreferenceNode(ServerPreferencePage.NAME,
53 resources.getString("preference.server"), null,
54 ServerPreferencePage.class.getName());
55
56 preferenceManager.addToRoot(node);
57 }
58 }
This page was automatically generated by Maven