1 /* 2 * The contents of this file are subject to the terms of the Common Development 3 * and Distribution License (the License). You may not use this file except in 4 * compliance with the License. 5 * 6 * You can obtain a copy of the License at http://www.netbeans.org/cddl.html 7 * or http://www.netbeans.org/cddl.txt. 8 * 9 * When distributing Covered Code, include this CDDL Header Notice in each file 10 * and include the License file at http://www.netbeans.org/cddl.txt. 11 * If applicable, add the following below the CDDL Header, with the fields 12 * enclosed by brackets [] replaced by your own identifying information: 13 * "Portions Copyrighted [year] [name of copyright owner]" 14 * 15 * The Original Software is NetBeans. The Initial Developer of the Original 16 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun 17 * Microsystems, Inc. All Rights Reserved. 18 */ 19 20 package org.netbeans.spi.editor.mimelookup; 21 22 import java.util.List; 23 24 /** 25 * Provider of the instance of the given class. 26 * <br> 27 * The provider gets a list of files which it transfers 28 * into one instance of the class for which it's declared. 29 * 30 * <p> 31 * For example there can be an instance provider 32 * of actions for the editor popup. The file object names 33 * of the actions declared in the layer can be of two forms:<ul> 34 * <li><i>MyAction.instance</i> are actions instances declaration files</li>. 35 * <li><i>reformat-code</i> are editor actions names</li>. 36 * </ul> 37 * <br/> 38 * The instance provider translates all the file objects to actions 39 * which it returns as a collection in some sort of collection-like class 40 * e.g.<pre> 41 * interface PopupActions { 42 * 43 * List<Action> getActions(); 44 * 45 * }</pre> 46 * 47 */ 48 public interface InstanceProvider { 49 50 /** 51 * Create an instance of the class for which this 52 * instance provider is declared in {@link Class2LayerFolder}. 53 * 54 * @param fileObjectList non-null list of the file objects 55 * collected from the particular layer folder and possibly 56 * the inherited folders. 57 * @return non-null instance of the class for which 58 * this instance provider is declared. The list of the file objects 59 * should be translated to that instance so typically the instance 60 * contains some kind of the collection. 61 */ 62 public Object createInstance(List/*<FileObject>*/ fileObjectList); 63 64 } 65