FileDocCategorySizeDatePackage
UsagePreferencePage.javaAPI DocAndroid 1.5 API3827Wed May 06 22:41:10 BST 2009com.android.ide.eclipse.common.preferences

UsagePreferencePage

public class UsagePreferencePage extends org.eclipse.jface.preference.PreferencePage implements org.eclipse.ui.IWorkbenchPreferencePage

Fields Summary
private org.eclipse.jface.preference.BooleanFieldEditor
mOptInCheckBox
Constructors Summary
public UsagePreferencePage()

    
Methods Summary
protected org.eclipse.swt.widgets.ControlcreateContents(org.eclipse.swt.widgets.Composite parent)

        Composite top = new Composite(parent, SWT.NONE);
        top.setLayout(new GridLayout(1, false));
        top.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

        Link text = new Link(top, SWT.WRAP);
        GridData gd = new GridData(GridData.FILL_HORIZONTAL);
        gd.widthHint = 200;
        text.setLayoutData(gd);
        text.setText(SdkStatsService.BODY_TEXT);

        text.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent event) {
                SdkStatsService.openUrl(event.text);
            }
        });

        mOptInCheckBox = new BooleanFieldEditor(SdkStatsService.PING_OPT_IN,
                SdkStatsService.CHECKBOX_TEXT, top);
        mOptInCheckBox.setPage(this);
        mOptInCheckBox.setPreferenceStore(SdkStatsService.getPreferenceStore());
        mOptInCheckBox.load();
        
        return top;
    
public voidinit(org.eclipse.ui.IWorkbench workbench)

        // pass
    
protected voidperformApply()

        save();
        super.performApply();
    
public booleanperformCancel()

        mOptInCheckBox.load();
        return super.performCancel();
    
protected voidperformDefaults()

        mOptInCheckBox.loadDefault();
        super.performDefaults();
    
public booleanperformOk()

        save();
        return super.performOk();
    
private voidsave()

        try {
            PreferenceStore store = SdkStatsService.getPreferenceStore();
            if (store !=  null) {
                store.setValue(SdkStatsService.PING_OPT_IN, mOptInCheckBox.getBooleanValue());
                store.save();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }