# This patch file was generated by NetBeans IDE # Following Index: paths are relative to: D:\workspace\nb72-src\main # This patch can be applied using context Tools: Patch action on respective folder. # It uses platform neutral UTF-8 encoding and \n newlines. # Above lines and this line are ignored by the patching process. Index: projectui/nbproject/project.xml --- projectui/nbproject/project.xml Base (BASE) +++ projectui/nbproject/project.xml Locally Modified (Based On LOCAL) @@ -139,6 +139,14 @@ + org.netbeans.spi.quicksearch + + + + 1.17 + + + org.openide.actions Index: projectui/src/org/netbeans/modules/project/ui/Bundle.properties --- projectui/src/org/netbeans/modules/project/ui/Bundle.properties Base (BASE) +++ projectui/src/org/netbeans/modules/project/ui/Bundle.properties Locally Modified (Based On LOCAL) @@ -100,6 +100,7 @@ Actions/Project=Project Actions/Build=Build +QuickSearch/Projects/org-netbeans-modules-project-ui-quicksearch-SearchForProjectsQuickSearch.instance=Projects Templates/Project=Project Templates/Project/Import=Projects with Existing Sources Templates/Project/Samples=Samples Index: projectui/src/org/netbeans/modules/project/ui/quicksearch/SearchForProjectsQuickSearch.java --- projectui/src/org/netbeans/modules/project/ui/quicksearch/SearchForProjectsQuickSearch.java Base (BASE) +++ projectui/src/org/netbeans/modules/project/ui/quicksearch/SearchForProjectsQuickSearch.java Locally New @@ -0,0 +1,87 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2013 Oracle and/or its affiliates. All rights reserved. + * + * Oracle and Java are registered trademarks of Oracle and/or its affiliates. + * Other names may be trademarks of their respective owners. + * + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle 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 2013 Sun Microsystems, Inc. + */ +package org.netbeans.modules.project.ui.quicksearch; + +import java.util.logging.Level; +import java.util.logging.Logger; +import org.netbeans.api.project.Project; +import org.netbeans.api.project.ProjectUtils; +import org.netbeans.api.project.ui.OpenProjects; +import org.netbeans.modules.project.ui.ProjectTab; +import org.netbeans.modules.project.ui.ProjectUtilities; +import org.netbeans.spi.quicksearch.SearchProvider; +import org.netbeans.spi.quicksearch.SearchRequest; +import org.netbeans.spi.quicksearch.SearchResponse; +import org.openide.loaders.DataObject; +import org.openide.loaders.DataObjectNotFoundException; +import org.openide.nodes.Node; + +/** + * QuickSearchProvider for project names. Opens and expands the selected + * project in the project view. + * + * @author markiewb + */ +public class SearchForProjectsQuickSearch implements SearchProvider { + + @Override + public void evaluate(SearchRequest request, SearchResponse response) { + final String searchText = request.getText().toLowerCase(); + + for (final Project project : OpenProjects.getDefault().getOpenProjects()) { + final String projectName = ProjectUtils.getInformation(project).getDisplayName().toLowerCase(); + + if (projectName.contains(searchText)) { + response.addResult(new Runnable() { + @Override + public void run() { + + //see http://forums.netbeans.org/post-140855.html#140855 + ProjectUtilities.selectAndExpandProject(project); + + ProjectUtilities.makeProjectTabVisible(); + } + }, projectName); + } + } + } +} Index: projectui/src/org/netbeans/modules/project/ui/resources/layer.xml --- projectui/src/org/netbeans/modules/project/ui/resources/layer.xml Base (BASE) +++ projectui/src/org/netbeans/modules/project/ui/resources/layer.xml Locally Modified (Based On LOCAL) @@ -146,6 +146,15 @@ + + + + + + + + +