Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
View | Details | Raw Unified | Return to bug 199779 | Differences between
and this patch

Collapse All | Expand All

(-)a/refactoring.api/apichanges.xml (+18 lines)
 Lines 49-54    Link Here 
49
    <apidef name="refactoring">Refactoring API</apidef>
49
    <apidef name="refactoring">Refactoring API</apidef>
50
</apidefs>
50
</apidefs>
51
<changes>
51
<changes>
52
    <change id="Scope">
53
        <api name="refactoring"/>
54
        <summary>Scope added to allow to specify a limited scope for WhereUsedQuery</summary>
55
        <version major="1" minor="18"/>
56
        <date day="30" month="6" year="2011"/>
57
        <author login="ralphbenjamin"/>
58
        <compatibility addition="yes"/>
59
        <description>
60
            <p>
61
                Scope is used to limit the WhereUsedQuery to a specific scope.<br />
62
                An instance is added to the context of WhereUsedQuery to limit the
63
                scope. A custom scope can be any combination of source roots, folders
64
                and files.
65
            </p>    
66
        </description>
67
        <class package="org.netbeans.modules.refactoring.api" name="Scope"/>
68
        <issue number="199779"/>
69
    </change>
52
    <change id="ExplorerContext">
70
    <change id="ExplorerContext">
53
        <api name="refactoring"/>
71
        <api name="refactoring"/>
54
        <summary>ExplorerContext added to allow handling of Explorer's Move, Copy, Delete and Rename actions</summary>
72
        <summary>ExplorerContext added to allow handling of Explorer's Move, Copy, Delete and Rename actions</summary>
(-)a/refactoring.api/manifest.mf (-1 / +1 lines)
 Lines 2-7    Link Here 
2
OpenIDE-Module: org.netbeans.modules.refactoring.api
2
OpenIDE-Module: org.netbeans.modules.refactoring.api
3
OpenIDE-Module-Layer: org/netbeans/modules/refactoring/api/resources/layer.xml
3
OpenIDE-Module-Layer: org/netbeans/modules/refactoring/api/resources/layer.xml
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/refactoring/api/resources/Bundle.properties
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/refactoring/api/resources/Bundle.properties
5
OpenIDE-Module-Specification-Version: 1.17
5
OpenIDE-Module-Specification-Version: 1.18
6
AutoUpdate-Show-In-Client: false
6
AutoUpdate-Show-In-Client: false
7
7
(-)a/refactoring.api/src/org/netbeans/modules/refactoring/api/Scope.java (+123 lines)
Line 0    Link Here 
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2011 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.modules.refactoring.api;
43
44
import java.util.Collection;
45
import java.util.Collections;
46
import java.util.HashSet;
47
import java.util.Set;
48
import org.netbeans.api.annotations.common.NonNull;
49
import org.netbeans.api.annotations.common.NullAllowed;
50
import org.netbeans.api.fileinfo.NonRecursiveFolder;
51
import org.openide.filesystems.FileObject;
52
53
54
/**
55
 * Scope is used to limit the WhereUsedQuery to a specific scope.
56
 * Add an instance of this class to the context of the WhereUsedQuery to limit
57
 * the scope. A custom scope can be any combination of source roots, folders and
58
 * files.
59
 * 
60
 * @author Ralph Ruijs
61
 * @see Context
62
 * @since 1.18
63
 */
64
public final class Scope {
65
66
    private final Set<FileObject> sourceRoots;
67
    private final Set<NonRecursiveFolder> folders;
68
    private final Set<FileObject> files;
69
70
    private Scope() {
71
        folders = new HashSet<NonRecursiveFolder>();
72
        sourceRoots = new HashSet<FileObject>();
73
        files = new HashSet<FileObject>();
74
    }
75
76
    /**
77
     * Get the files to include in the where used query.
78
     * @return an unmodifiable set of the files
79
     */
80
    public @NonNull Set<FileObject> getFiles() {
81
        return Collections.unmodifiableSet(files);
82
    }
83
84
    /**
85
     * Get the non recursive folders to include in the where used query.
86
     * @return an unmodifiable set of the folders
87
     */
88
    public @NonNull Set<NonRecursiveFolder> getFolders() {
89
        return Collections.unmodifiableSet(folders);
90
    }
91
92
    /**
93
     * Get the source roots to include in the where used query.
94
     * @return an unmodifiable set of the source roots
95
     */
96
    public @NonNull Set<FileObject> getSourceRoots() {
97
        return Collections.unmodifiableSet(sourceRoots);
98
    }
99
    
100
    /**
101
     * Creates a new scope.
102
     * A custom scope can be any combination of source roots, folders and files.
103
     *
104
     * @param sourceRoots the source roots to include in this scope
105
     * @param folders the non recursive folders to include in this scope
106
     * @param files the files to include in this scope
107
     */
108
    public static @NonNull Scope create(@NullAllowed Collection<FileObject> sourceRoots,
109
                                        @NullAllowed Collection<NonRecursiveFolder> folders,
110
                                        @NullAllowed Collection<FileObject> files) {
111
        Scope scope = new Scope();
112
        if (files != null) {
113
            scope.files.addAll(files);
114
        }
115
        if (folders != null) {
116
            scope.folders.addAll(folders);
117
        }
118
        if (sourceRoots != null) {
119
            scope.sourceRoots.addAll(sourceRoots);
120
        }
121
        return scope;
122
    }
123
}

Return to bug 199779
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo