~ubuntu-branches/ubuntu/utopic/eclipse-eclox/utopic

« back to all changes in this revision

Viewing changes to eclox.ui/src/eclox/ui/PreferencePage.java

  • Committer: Package Import Robot
  • Author(s): Graham Inggs
  • Date: 2013-07-07 20:33:10 UTC
  • Revision ID: package-import@ubuntu.com-20130707203310-a44yw80gqtc2s9ob
Tags: upstream-0.10.0
ImportĀ upstreamĀ versionĀ 0.10.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*******************************************************************************
 
2
 * Copyright (C) 2003-2004, 2013, Guillaume Brocker
 
3
 * 
 
4
 * All rights reserved. This program and the accompanying materials
 
5
 * are made available under the terms of the Eclipse Public License v1.0
 
6
 * which accompanies this distribution, and is available at
 
7
 * http://www.eclipse.org/legal/epl-v10.html
 
8
 *
 
9
 * Contributors:
 
10
 *     Guillaume Brocker - Initial API and implementation
 
11
 *
 
12
 ******************************************************************************/ 
 
13
 
 
14
package eclox.ui;
 
15
 
 
16
import org.eclipse.jface.preference.BooleanFieldEditor;
 
17
import org.eclipse.jface.preference.IntegerFieldEditor;
 
18
import org.eclipse.jface.preference.RadioGroupFieldEditor;
 
19
import org.eclipse.swt.widgets.Composite;
 
20
import org.eclipse.ui.IWorkbench;
 
21
import org.eclipse.ui.IWorkbenchPreferencePage;
 
22
 
 
23
 
 
24
/**
 
25
 * Implements the plugin preference page.
 
26
 * 
 
27
 * @author gbrocker
 
28
 */
 
29
public class PreferencePage extends org.eclipse.jface.preference.FieldEditorPreferencePage implements IWorkbenchPreferencePage
 
30
{
 
31
        /**
 
32
         * Constructor.
 
33
         */
 
34
        public PreferencePage() {
 
35
                super( GRID );
 
36
        }
 
37
        
 
38
        public void init( IWorkbench workbench ) {
 
39
                setPreferenceStore( Plugin.getDefault().getPreferenceStore() );
 
40
        }
 
41
        
 
42
        /**
 
43
         * Creates the preference page fields.
 
44
         */
 
45
        protected void createFieldEditors() {
 
46
                Composite       rootControl = getFieldEditorParent();
 
47
        
 
48
                // Create the controls.
 
49
                
 
50
                BooleanFieldEditor escapeValueStrings = new BooleanFieldEditor(IPreferences.HANDLE_ESCAPED_VALUES, "Handle escapes for \" and \\ in value strings", rootControl);
 
51
                escapeValueStrings.setPreferenceStore( getPreferenceStore() );
 
52
                addField( escapeValueStrings );
 
53
                
 
54
                IntegerFieldEditor historySize = new IntegerFieldEditor(IPreferences.BUILD_HISTORY_SIZE, "Build history size:", rootControl);
 
55
                historySize.setPreferenceStore( getPreferenceStore() );
 
56
                historySize.setValidRange( 1, 100 );
 
57
                addField( historySize );
 
58
 
 
59
                RadioGroupFieldEditor autoSave = new RadioGroupFieldEditor(
 
60
                        IPreferences.AUTO_SAVE,
 
61
                        "Save all modified files before building",
 
62
                        1,
 
63
                        new String[][] {
 
64
                                {IPreferences.AUTO_SAVE_NEVER, IPreferences.AUTO_SAVE_NEVER},
 
65
                                {IPreferences.AUTO_SAVE_ALWAYS, IPreferences.AUTO_SAVE_ALWAYS},
 
66
                                {IPreferences.AUTO_SAVE_ASK, IPreferences.AUTO_SAVE_ASK},
 
67
                        },
 
68
                        rootControl,
 
69
                        true );
 
70
                autoSave.setPreferenceStore( getPreferenceStore() );
 
71
                addField( autoSave );
 
72
        }
 
73
 
 
74
}