1 /* 2 * Copyright (C) 2011 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 package com.android.ddmuilib.logcat; 17 18 import org.eclipse.jface.viewers.IStructuredContentProvider; 19 import org.eclipse.jface.viewers.Viewer; 20 21 import java.util.List; 22 23 /** 24 * A JFace content provider for logcat filter list, used in {@link LogCatPanel}. 25 */ 26 public final class LogCatFilterContentProvider implements IStructuredContentProvider { 27 @Override dispose()28 public void dispose() { 29 } 30 31 @Override inputChanged(Viewer arg0, Object arg1, Object arg2)32 public void inputChanged(Viewer arg0, Object arg1, Object arg2) { 33 } 34 35 /** 36 * Obtain the list of filters currently in use. 37 * @param model list of {@link LogCatFilter}'s 38 * @return array of {@link LogCatFilter} objects, or null. 39 */ 40 @Override getElements(Object model)41 public Object[] getElements(Object model) { 42 if (model instanceof List<?>) { 43 return ((List<?>) model).toArray(); 44 } 45 return null; 46 } 47 48 } 49