Default Encoding of System File System is always UTF-8
--- a/queries/manifest.mf Sun Mar 16 23:31:14 2008 -0700
+++ a/queries/manifest.mf Mon Mar 17 10:09:06 2008 +0100
@@ -1,5 +1,5 @@
Manifest-Version: 1.0
OpenIDE-Module: org.netbeans.modules.queries/1
-OpenIDE-Module-Specification-Version: 1.11
+OpenIDE-Module-Specification-Version: 1.12
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/queries/Bundle.properties
--- a/queries/src/org/netbeans/api/queries/VisibilityQuery.java Sun Mar 16 23:31:14 2008 -0700
+++ a/queries/src/org/netbeans/api/queries/VisibilityQuery.java Mon Mar 17 10:09:06 2008 +0100
@@ -41,6 +41,7 @@
package org.netbeans.api.queries;
+import java.io.File;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
@@ -48,7 +49,9 @@
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import org.netbeans.spi.queries.VisibilityQueryImplementation;
+import org.netbeans.spi.queries.VisibilityQueryImplementation2;
import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
import org.openide.util.ChangeSupport;
import org.openide.util.Lookup;
import org.openide.util.LookupEvent;
@@ -99,6 +102,33 @@
}
return true;
}
+
+ /**
+ * Check whether a file is recommended to be visible.
+ * Default return value is visible unless at least one VisibilityQueryImplementation
+ * provider says hidden.
+ * @param file a file which should be checked
+ * @return true if it is recommended to show this file
+ * @since org.netbeans.modules.queries/1 1.12
+ */
+ public boolean isVisible(File file) {
+ for (VisibilityQueryImplementation vqi : getVqiInstances()) {
+ if (vqi instanceof VisibilityQueryImplementation2) {
+ if (!((VisibilityQueryImplementation2)vqi).isVisible(file)) {
+ return false;
+ }
+ } else {
+ FileObject fo = FileUtil.toFileObject(file);
+ if (fo != null) {
+ if (!vqi.isVisible(fo)) {
+ return false;
+ }
+ }
+ }
+ }
+ return true;
+ }
+
/**
* Add a listener to changes.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ a61c2f456450 Mon Mar 17 10:09:06 2008 +0100
@@ -0,0 +1,66 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common
+ * Development and Distribution License("CDDL") (collectively, the
+ * "License"). You may not use this file except in compliance with the
+ * License. You can obtain a copy of the License at
+ * http://www.netbeans.org/cddl-gplv2.html
+ * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
+ * specific language governing permissions and limitations under the
+ * License. When distributing the software, include this License Header
+ * Notice in each file and include the License file at
+ * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the
+ * License Header, with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * If you wish your version of this file to be governed by only the CDDL
+ * or only the GPL Version 2, indicate your decision by adding
+ * "[Contributor] elects to include this software in this distribution
+ * under the [CDDL or GPL Version 2] license." If you do not indicate a
+ * single choice of license, a recipient has the option to distribute
+ * your version of this file under either the CDDL, the GPL Version 2 or
+ * to extend the choice of license to its licensees as provided above.
+ * However, if you add GPL Version 2 code and therefore, elected the GPL
+ * Version 2 license, then the option applies only if the new code is
+ * made subject to such option by the copyright holder.
+ *
+ * Contributor(s):
+ *
+ * Portions Copyrighted 2008 Sun Microsystems, Inc.
+ */
+
+package org.netbeans.spi.queries;
+
+import java.io.File;
+
+/**
+ * Determine whether files should be hidden in views presented to the user.
+ *
+ * Global lookup is used to find all instances of VisibilityQueryImplementation.
+ *
+ *
+ * Threading note: implementors should avoid acquiring locks that might be held
+ * by other threads. Generally treat this interface similarly to SPIs in
+ * {@link org.openide.filesystems} with respect to threading semantics.
+ *
+ * @see org.netbeans.api.queries.VisibilityQuery
+ * @since org.netbeans.modules.queries/1 1.12
+ * @author mkleint
+ */
+public interface VisibilityQueryImplementation2 extends VisibilityQueryImplementation {
+ /**
+ * Check whether a file is recommended to be visible.
+ * @param file a file to considered
+ * @return true if it is recommended to display this file
+ */
+ boolean isVisible(File file);
+
+}