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

(-)projectui/nbproject/project.xml (+8 lines)
Lines 139-144 Link Here
139
                    </run-dependency>
139
                    </run-dependency>
140
                </dependency>
140
                </dependency>
141
                <dependency>
141
                <dependency>
142
                    <code-name-base>org.netbeans.spi.quicksearch</code-name-base>
143
                    <build-prerequisite/>
144
                    <compile-dependency/>
145
                    <run-dependency>
146
                        <specification-version>1.17</specification-version>
147
                    </run-dependency>
148
                </dependency>
149
                <dependency>
142
                    <code-name-base>org.openide.actions</code-name-base>
150
                    <code-name-base>org.openide.actions</code-name-base>
143
                    <build-prerequisite/>
151
                    <build-prerequisite/>
144
                    <compile-dependency/>
152
                    <compile-dependency/>
(-)projectui/src/org/netbeans/modules/project/ui/Bundle.properties (+1 lines)
Lines 100-105 Link Here
100
Actions/Project=Project
100
Actions/Project=Project
101
Actions/Build=Build
101
Actions/Build=Build
102
102
103
QuickSearch/Projects/org-netbeans-modules-project-ui-quicksearch-SearchForProjectsQuickSearch.instance=Projects
103
Templates/Project=Project
104
Templates/Project=Project
104
Templates/Project/Import=Projects with Existing Sources
105
Templates/Project/Import=Projects with Existing Sources
105
Templates/Project/Samples=Samples
106
Templates/Project/Samples=Samples
(-)projectui/src/org/netbeans/modules/project/ui/quicksearch/SearchForProjectsQuickSearch.java (+87 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2013 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 2013 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.modules.project.ui.quicksearch;
43
44
import java.util.logging.Level;
45
import java.util.logging.Logger;
46
import org.netbeans.api.project.Project;
47
import org.netbeans.api.project.ProjectUtils;
48
import org.netbeans.api.project.ui.OpenProjects;
49
import org.netbeans.modules.project.ui.ProjectTab;
50
import org.netbeans.modules.project.ui.ProjectUtilities;
51
import org.netbeans.spi.quicksearch.SearchProvider;
52
import org.netbeans.spi.quicksearch.SearchRequest;
53
import org.netbeans.spi.quicksearch.SearchResponse;
54
import org.openide.loaders.DataObject;
55
import org.openide.loaders.DataObjectNotFoundException;
56
import org.openide.nodes.Node;
57
58
/**
59
 * QuickSearchProvider for project names. Opens and expands the selected
60
 * project in the project view.
61
 *
62
 * @author markiewb
63
 */
64
public class SearchForProjectsQuickSearch implements SearchProvider {
65
66
    @Override
67
    public void evaluate(SearchRequest request, SearchResponse response) {
68
	final String searchText = request.getText().toLowerCase();
69
70
	for (final Project project : OpenProjects.getDefault().getOpenProjects()) {
71
	    final String projectName = ProjectUtils.getInformation(project).getDisplayName().toLowerCase();
72
73
	    if (projectName.contains(searchText)) {
74
		response.addResult(new Runnable() {
75
		    @Override
76
		    public void run() {
77
78
			//see http://forums.netbeans.org/post-140855.html#140855
79
			ProjectUtilities.selectAndExpandProject(project);
80
81
			ProjectUtilities.makeProjectTabVisible();
82
		    }
83
		}, projectName);
84
	    }
85
	}
86
    }
87
}
(-)projectui/src/org/netbeans/modules/project/ui/resources/layer.xml (+9 lines)
Lines 146-151 Link Here
146
        
146
        
147
    </folder>
147
    </folder>
148
148
149
    <folder name="QuickSearch">
150
        <folder name="Projects">
151
            <attr name="command" stringvalue="p"/>
152
            <attr name="position" intvalue="0"/>
153
            <file name="org-netbeans-modules-project-ui-quicksearch-SearchForProjectsQuickSearch.instance">
154
                <attr name="displayName" bundlevalue="org.netbeans.modules.project.ui.quicksearch.Bundle#QuickSearch/Projects/org-netbeans-modules-project-ui-quicksearch-SearchForProjectsQuickSearch.instance"/>
155
            </file>
156
        </folder>
157
    </folder>
149
    <folder name="Templates">
158
    <folder name="Templates">
150
        <folder name="Project">
159
        <folder name="Project">
151
            <!-- Project type providers should register their templates here -->
160
            <!-- Project type providers should register their templates here -->

Return to bug 224378