Home | History | Annotate | Download | only in preferences
      1 /*
      2  * Copyright (C) 2010 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package com.android.ide.eclipse.pdt.internal.preferences;
     18 
     19 import com.android.ide.eclipse.pdt.PdtPlugin;
     20 
     21 import org.eclipse.jface.preference.DirectoryFieldEditor;
     22 import org.eclipse.jface.preference.FieldEditorPreferencePage;
     23 import org.eclipse.jface.preference.IPreferenceStore;
     24 import org.eclipse.ui.IWorkbench;
     25 import org.eclipse.ui.IWorkbenchPreferencePage;
     26 
     27 public class PrefPage extends FieldEditorPreferencePage implements
     28         IWorkbenchPreferencePage {
     29 
     30     public final static String PREFS_DEVTREE_DIR = PdtPlugin.PLUGIN_ID + ".devtree"; //$NON-NLS-1$
     31 
     32     private DirectoryFieldEditor mDirectoryField;
     33 
     34     public PrefPage() {
     35         super(GRID);
     36         IPreferenceStore store = PdtPlugin.getDefault().getPreferenceStore();
     37         setPreferenceStore(store);
     38         setDescription("Android Preferences");
     39     }
     40 
     41     @Override
     42     protected void createFieldEditors() {
     43         mDirectoryField = new DirectoryFieldEditor(PREFS_DEVTREE_DIR,
     44                 "Dev Tree Location:", getFieldEditorParent());
     45 
     46         addField(mDirectoryField);
     47     }
     48 
     49     @Override
     50     public void init(IWorkbench workbench) {
     51     }
     52 
     53     @Override
     54     public void dispose() {
     55         super.dispose();
     56 
     57         if (mDirectoryField != null) {
     58             mDirectoryField.dispose();
     59             mDirectoryField = null;
     60         }
     61     }
     62 
     63 }
     64