Home | History | Annotate | Download | only in preferences
      1 /*
      2  * Copyright (C) 2012 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.ddms.preferences;
     18 
     19 import com.android.ddmuilib.logcat.LogCatPanel;
     20 import com.android.ide.eclipse.ddms.DdmsPlugin;
     21 
     22 import org.eclipse.jface.preference.ColorFieldEditor;
     23 import org.eclipse.jface.preference.FieldEditorPreferencePage;
     24 import org.eclipse.ui.IWorkbench;
     25 import org.eclipse.ui.IWorkbenchPreferencePage;
     26 
     27 public class LogCatColorsPage extends FieldEditorPreferencePage
     28                                             implements IWorkbenchPreferencePage {
     29     public LogCatColorsPage() {
     30         super(GRID);
     31         setPreferenceStore(DdmsPlugin.getDefault().getPreferenceStore());
     32     }
     33 
     34     @Override
     35     public void init(IWorkbench workbench) {
     36     }
     37 
     38     @Override
     39     protected void createFieldEditors() {
     40         // colors preference for different log levels
     41         ColorFieldEditor cfe = new ColorFieldEditor(LogCatPanel.VERBOSE_COLOR_PREFKEY,
     42                 "Verbose Log Message Color", getFieldEditorParent());
     43         addField(cfe);
     44 
     45         cfe = new ColorFieldEditor(LogCatPanel.DEBUG_COLOR_PREFKEY, "Debug Log Message Color",
     46                 getFieldEditorParent());
     47         addField(cfe);
     48 
     49         cfe = new ColorFieldEditor(LogCatPanel.INFO_COLOR_PREFKEY, "Info Log Message Color",
     50                 getFieldEditorParent());
     51         addField(cfe);
     52 
     53         cfe = new ColorFieldEditor(LogCatPanel.WARN_COLOR_PREFKEY, "Warning Log Message Color",
     54                 getFieldEditorParent());
     55         addField(cfe);
     56 
     57         cfe = new ColorFieldEditor(LogCatPanel.ERROR_COLOR_PREFKEY, "Error Log Message Color",
     58                 getFieldEditorParent());
     59         addField(cfe);
     60 
     61         cfe = new ColorFieldEditor(LogCatPanel.ASSERT_COLOR_PREFKEY, "Assert Log Message Color",
     62                 getFieldEditorParent());
     63         addField(cfe);
     64     }
     65 }
     66