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 2004-2007 Sun 17 * Microsystems, Inc. All Rights Reserved. 18 */ 19 20 package org.openidex.search; 21 22 import java.util.Iterator; 23 24 /** 25 * Defines which <code>DataObject</code>s should be searched. 26 * Iterator returned by this interface's method enumerates 27 * <code>DataObject</code>s that should be searched. 28 * <p> 29 * <code>SearchInfo</code> objects are used by module User Utilities 30 * – in actions <em>Find</em> (since User Utilities 1.16) 31 * and <em>Find in Projects</em> (since User Utilities 1.23). 32 * Action <em>Find</em> obtains <code>SearchInfo</code> from 33 * <a HREF="@org-openide-nodes@/org/openide/nodes/Node.html#getLookup()"><code>Lookup</code> of nodes</a> 34 * the action was invoked on. Action <em>Find in Projects</em> obtains 35 * <code>SearchInfo</code> from 36 * <a HREF="@org-netbeans-modules-projectapi@/org/netbeans/api/project/Project.html#getLookup()"><code>Lookup</code> 37 * of the projects</a>. 38 * </p> 39 * 40 * @see SearchInfoFactory 41 * @see <a HREF="@org-openide-loaders@/org/openide/loaders/DataObject.html"><code>DataObject</code></a> 42 * @see <a HREF="@org-openide-nodes@/org/openide/nodes/Node.html#getLookup()"><code>Node.getLookup()</code></a> 43 * @see <a HREF="@org-netbeans-modules-projectapi@/org/netbeans/api/project/Project.html#getLookup()"><code>Project.getLookup()</code></a> 44 * @since org.openidex.util/3 3.2 45 * @author Marian Petras 46 */ 47 public interface SearchInfo { 48 49 /** 50 * Determines whether the object which provided this <code>SearchInfo</code> 51 * can be searched. 52 * This method determines whether the <em>Find</em> action should be enabled 53 * for the object or not. 54 * <p> 55 * This method must be very quick as it may be called frequently and its 56 * speed may influence responsiveness of the whole application. If the exact 57 * algorithm for determination of the result value should be slow, it is 58 * better to return <code>true</code> than make the method slow. 59 * 60 * @return <code>false</code> if the object is known that it cannot be 61 * searched; <code>true</code> otherwise 62 * @since org.openidex.util/3 3.3 63 */ 64 public boolean canSearch(); 65 66 /** 67 * Specifies which <code>DataObject</code>s should be searched. 68 * The returned <code>Iterator</code> needn't implement method 69 * {@link java.util.Iterator#remove remove()} (i.e. it may throw 70 * <code>UnsupportedOperationException</code> instead of actual 71 * implementation). 72 * 73 * @return iterator which iterates over <code>DataObject</code>s 74 * to be searched 75 */ 76 public Iterator objectsToSearch(); 77 78 } 79