This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 42050
Collapse All | Expand All

(-)src/org/netbeans/api/queries/VisibilityQuery.java (+43 lines)
Line 1 Link Here
1
/*
2
 *                 Sun Public License Notice
3
 *
4
 * The contents of this file are subject to the Sun Public License
5
 * Version 1.0 (the "License"). You may not use this file except in
6
 * compliance with the License. A copy of the License is available at
7
 * http://www.sun.com/
8
 *
9
 * The Original Code is NetBeans. The Initial Developer of the Original
10
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2004 Sun
11
 * Microsystems, Inc. All Rights Reserved.
12
 */
13
package org.netbeans.api.queries;
14
import org.openide.filesystems.FileObject;
15
import org.openide.util.Lookup;
16
import org.netbeans.spi.queries.VisibilityQueryImplementation;
17
import java.util.Iterator;
18
/**
19
 * Determine whether files should be hidden in viewes
20
 * presented to the user. This query should be considered
21
 * only as a recommendation and there isn't necessary to obey it.
22
 *
23
 * @see org.netbeans.spi.queries.VisibilityQueryImplementation
24
 * @author Radek Matous
25
 */
26
public class VisibilityQuery {
27
    private static final Lookup.Result/*<VisibilityQueryImplementation>*/ implementations =
28
        Lookup.getDefault().lookup(new Lookup.Template(VisibilityQueryImplementation.class));
29
    /**
30
     * Check whether an file is recommended to be hidden.
31
     * @param file a file which should be checked
32
     * @return true if there is recommended to hide this file
33
     */
34
    public static boolean isHidden (FileObject file) {
35
        boolean isHidden = false;
36
        Iterator it = implementations.allInstances().iterator();
37
        while (it.hasNext() && !isHidden) {
38
            VisibilityQueryImplementation vqi = (VisibilityQueryImplementation)it.next();
39
            isHidden = vqi.isHidden(file);
40
        }
41
        return isHidden;
42
    }
43
}
(-)src/org/netbeans/spi/queries/VisibilityQueryImplementation.java (+32 lines)
Line 1 Link Here
1
/*
2
 *                 Sun Public License Notice
3
 *
4
 * The contents of this file are subject to the Sun Public License
5
 * Version 1.0 (the "License"). You may not use this file except in
6
 * compliance with the License. A copy of the License is available at
7
 * http://www.sun.com/
8
 *
9
 * The Original Code is NetBeans. The Initial Developer of the Original
10
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2004 Sun
11
 * Microsystems, Inc. All Rights Reserved.
12
 */
13
package org.netbeans.spi.queries;
14
import org.openide.filesystems.FileObject;
15
/**
16
 * A query which should typically be provided by a FileSystem implementations.
17
 *
18
 * Determine whether files should be hidden in viewes
19
 * presented to the user. This query should be considered
20
 * only as a recommendation and there isn't necessary to obey it.
21
 *
22
 * @see org.netbeans.api.queries.VisibilityQuery
23
 * @author Radek Matous
24
 */
25
public interface VisibilityQueryImplementation {
26
    /**
27
     * Check whether an file is recommended to be hidden.
28
     * @param file a file which should be checked
29
     * @return true if there is recommended to hide this file
30
     */
31
    boolean isHidden (FileObject file);
32
}

Return to bug 42050