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 95974
Collapse All | Expand All

(-)a/masterfs/nbproject/project.xml (+1 lines)
Lines 52-57 Link Here
52
                    <compile-dependency/>
52
                    <compile-dependency/>
53
                    <run-dependency>
53
                    <run-dependency>
54
                        <release-version>1</release-version>
54
                        <release-version>1</release-version>
55
                        <specification-version>1.12</specification-version>
55
                    </run-dependency>
56
                    </run-dependency>
56
                </dependency>
57
                </dependency>
57
                <dependency>
58
                <dependency>
(-)a/masterfs/src/org/netbeans/modules/masterfs/GlobalVisibilityQueryImpl.java (-3 / +10 lines)
Lines 41-53 Link Here
41
41
42
package org.netbeans.modules.masterfs;
42
package org.netbeans.modules.masterfs;
43
43
44
import java.io.File;
44
import java.util.prefs.PreferenceChangeEvent;
45
import java.util.prefs.PreferenceChangeEvent;
45
import java.util.prefs.PreferenceChangeListener;
46
import java.util.prefs.PreferenceChangeListener;
46
import org.netbeans.spi.queries.VisibilityQueryImplementation;
47
import org.openide.filesystems.FileObject;
47
import org.openide.filesystems.FileObject;
48
import javax.swing.event.ChangeListener;
48
import javax.swing.event.ChangeListener;
49
import java.util.prefs.Preferences;
49
import java.util.prefs.Preferences;
50
import java.util.regex.Pattern;
50
import java.util.regex.Pattern;
51
import org.netbeans.spi.queries.VisibilityQueryImplementation2;
51
import org.openide.util.ChangeSupport;
52
import org.openide.util.ChangeSupport;
52
import org.openide.util.NbPreferences;
53
import org.openide.util.NbPreferences;
53
54
Lines 62-68 Link Here
62
 * 
63
 * 
63
 * This class has hidden dependency on IDESettings in module org.netbeans.core.
64
 * This class has hidden dependency on IDESettings in module org.netbeans.core.
64
 */ 
65
 */ 
65
public class GlobalVisibilityQueryImpl implements VisibilityQueryImplementation {
66
public class GlobalVisibilityQueryImpl implements VisibilityQueryImplementation2 {
66
    static GlobalVisibilityQueryImpl INSTANCE;
67
    static GlobalVisibilityQueryImpl INSTANCE;
67
    private final ChangeSupport cs = new ChangeSupport(this);
68
    private final ChangeSupport cs = new ChangeSupport(this);
68
    
69
    
Lines 84-89 Link Here
84
    public boolean isVisible(FileObject file) {
85
    public boolean isVisible(FileObject file) {
85
        return isVisible(file.getNameExt());
86
        return isVisible(file.getNameExt());
86
    }
87
    }
88
    
89
    public boolean isVisible(File file) {
90
        return isVisible(file.getName());
91
    }
92
    
87
93
88
    boolean isVisible(final String fileName) {
94
    boolean isVisible(final String fileName) {
89
        Pattern pattern = getIgnoreFilesPattern();
95
        Pattern pattern = getIgnoreFilesPattern();
Lines 127-131 Link Here
127
            }
133
            }
128
        });                
134
        });                
129
        return retval;
135
        return retval;
130
    }    
136
    }
137
131
}
138
}
(-)a/queries/apichanges.xml (+22 lines)
Lines 104-109 Link Here
104
    <!-- ACTUAL CHANGES BEGIN HERE: -->
104
    <!-- ACTUAL CHANGES BEGIN HERE: -->
105
105
106
    <changes>
106
    <changes>
107
      <change id="FileBasedIsVisible">
108
        <api name="general"/>
109
        <summary>VisibilityQuery.isVisible(File) added</summary>
110
        <version major="1" minor="12"/>
111
        <date day="24" month="3" year="2008"/>
112
        <author login="mkleint"/>
113
        <compatibility addition="yes" binary="compatible" semantic="compatible" source="compatible">
114
        </compatibility>
115
        <description>
116
          <p>
117
             Added new method VisibilityQuery.isVisible(File). 
118
             It queries all VisibilityQueryImplementation instances found in global lookup.
119
             If such instance implements VisibilityQueryImplementation2, it's isVisible(File) method is used directly. 
120
             If not, it attempts to delegate to the isVisible(FileObject) method. That might not work for non-existing files.
121
             All implementations of VisibilityQueryImplementation are encouraged to upgrade to VisibilityQueryImplementation2.
122
          </p>
123
        </description>
124
        <class package="org.netbeans.api.queries" name="VisibilityQuery"/>
125
        <class package="org.netbeans.spi.queries" name="VisibilityQueryImplementation2"/>
126
        <issue number="95974"/>
127
      </change>
128
        
107
      <change id="FileEncodingQueryOnDefaultFS">
129
      <change id="FileEncodingQueryOnDefaultFS">
108
        <api name="general"/>
130
        <api name="general"/>
109
        <summary>Default Encoding of System File System is always UTF-8</summary>
131
        <summary>Default Encoding of System File System is always UTF-8</summary>
(-)a/queries/manifest.mf (-1 / +1 lines)
Lines 1-5 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.netbeans.modules.queries/1
2
OpenIDE-Module: org.netbeans.modules.queries/1
3
OpenIDE-Module-Specification-Version: 1.11
3
OpenIDE-Module-Specification-Version: 1.12
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/queries/Bundle.properties
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/queries/Bundle.properties
5
5
(-)a/queries/src/org/netbeans/api/queries/VisibilityQuery.java (+30 lines)
Lines 41-46 Link Here
41
41
42
package org.netbeans.api.queries;
42
package org.netbeans.api.queries;
43
43
44
import java.io.File;
44
import java.util.ArrayList;
45
import java.util.ArrayList;
45
import java.util.HashSet;
46
import java.util.HashSet;
46
import java.util.List;
47
import java.util.List;
Lines 48-54 Link Here
48
import javax.swing.event.ChangeEvent;
49
import javax.swing.event.ChangeEvent;
49
import javax.swing.event.ChangeListener;
50
import javax.swing.event.ChangeListener;
50
import org.netbeans.spi.queries.VisibilityQueryImplementation;
51
import org.netbeans.spi.queries.VisibilityQueryImplementation;
52
import org.netbeans.spi.queries.VisibilityQueryImplementation2;
51
import org.openide.filesystems.FileObject;
53
import org.openide.filesystems.FileObject;
54
import org.openide.filesystems.FileUtil;
52
import org.openide.util.ChangeSupport;
55
import org.openide.util.ChangeSupport;
53
import org.openide.util.Lookup;
56
import org.openide.util.Lookup;
54
import org.openide.util.LookupEvent;
57
import org.openide.util.LookupEvent;
Lines 99-104 Link Here
99
        }
102
        }
100
        return true;
103
        return true;
101
    }
104
    }
105
    
106
    /**
107
     * Check whether a file is recommended to be visible.
108
     * Default return value is visible unless at least one VisibilityQueryImplementation
109
     * provider says hidden.
110
     * @param file a file which should be checked
111
     * @return true if it is recommended to show this file
112
     * @since org.netbeans.modules.queries/1 1.12
113
     */
114
    public boolean isVisible(File file) {
115
        for (VisibilityQueryImplementation vqi : getVqiInstances()) {
116
            if (vqi instanceof VisibilityQueryImplementation2) {
117
                if (!((VisibilityQueryImplementation2)vqi).isVisible(file)) {
118
                    return false;
119
                }
120
            } else {
121
                FileObject fo = FileUtil.toFileObject(file);
122
                if (fo != null) {
123
                    if (!vqi.isVisible(fo)) {
124
                        return false;
125
                    }
126
                }
127
            }
128
        }
129
        return true;
130
    }
131
    
102
132
103
    /**
133
    /**
104
     * Add a listener to changes.
134
     * Add a listener to changes.
(-)a61c2f456450 (+66 lines)
Added Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 * 
4
 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
5
 * 
6
 * The contents of this file are subject to the terms of either the GNU
7
 * General Public License Version 2 only ("GPL") or the Common
8
 * Development and Distribution License("CDDL") (collectively, the
9
 * "License"). You may not use this file except in compliance with the
10
 * License. You can obtain a copy of the License at
11
 * http://www.netbeans.org/cddl-gplv2.html
12
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13
 * specific language governing permissions and limitations under the
14
 * License.  When distributing the software, include this License Header
15
 * Notice in each file and include the License file at
16
 * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
17
 * particular file as subject to the "Classpath" exception as provided
18
 * by Sun in the GPL Version 2 section of the License file that
19
 * accompanied this code. If applicable, add the following below the
20
 * License Header, with the fields enclosed by brackets [] replaced by
21
 * your own identifying information:
22
 * "Portions Copyrighted [year] [name of copyright owner]"
23
 * 
24
 * If you wish your version of this file to be governed by only the CDDL
25
 * or only the GPL Version 2, indicate your decision by adding
26
 * "[Contributor] elects to include this software in this distribution
27
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
28
 * single choice of license, a recipient has the option to distribute
29
 * your version of this file under either the CDDL, the GPL Version 2 or
30
 * to extend the choice of license to its licensees as provided above.
31
 * However, if you add GPL Version 2 code and therefore, elected the GPL
32
 * Version 2 license, then the option applies only if the new code is
33
 * made subject to such option by the copyright holder.
34
 * 
35
 * Contributor(s):
36
 * 
37
 * Portions Copyrighted 2008 Sun Microsystems, Inc.
38
 */
39
40
package org.netbeans.spi.queries;
41
42
import java.io.File;
43
44
/**
45
 * Determine whether files should be hidden in views presented to the user.
46
 * <p>
47
 * Global lookup is used to find all instances of VisibilityQueryImplementation.
48
 * </p>
49
 * <p>
50
 * Threading note: implementors should avoid acquiring locks that might be held
51
 * by other threads. Generally treat this interface similarly to SPIs in
52
 * {@link org.openide.filesystems} with respect to threading semantics.
53
 * </p>
54
 * @see org.netbeans.api.queries.VisibilityQuery
55
 * @since org.netbeans.modules.queries/1 1.12
56
 * @author mkleint
57
 */
58
public interface VisibilityQueryImplementation2 extends VisibilityQueryImplementation {
59
    /**
60
     * Check whether a file is recommended to be visible.
61
     * @param file a file to considered
62
     * @return true if it is recommended to display this file
63
     */ 
64
    boolean isVisible(File file);
65
66
}

Return to bug 95974