# This patch file was generated by NetBeans IDE # This patch can be applied using context Tools: Apply Diff Patch action on respective folder. # It uses platform neutral UTF-8 encoding. # Above lines and this line are ignored by the patching process. Index: projects/projectui/src/org/netbeans/modules/project/ui/Bundle.properties --- projects/projectui/src/org/netbeans/modules/project/ui/Bundle.properties Base (1.94) +++ projects/projectui/src/org/netbeans/modules/project/ui/Bundle.properties Locally Modified (Based On 1.94) @@ -289,3 +289,5 @@ UI_INIT_PROJECTS_ICON_BASE=org/netbeans/modules/project/ui/resources/open.gif OpeningProjectPanel.openingProjectLabel.text=Opening Project\: +LBL_PLEASE_WAIT=Loading projects... +LOAD_PROGRESS=Loading Projects \ No newline at end of file Index: projects/projectui/src/org/netbeans/modules/project/ui/LoadProjectsWarmupTask.java --- projects/projectui/src/org/netbeans/modules/project/ui/LoadProjectsWarmupTask.java No Base Revision +++ projects/projectui/src/org/netbeans/modules/project/ui/LoadProjectsWarmupTask.java Locally New @@ -0,0 +1,28 @@ +/* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (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.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * Portions Copyrighted 2007 Sun Microsystems, Inc. + */ + +package org.netbeans.modules.project.ui; + +/** + * + * @author Tim Boudreau + */ +public class LoadProjectsWarmupTask implements Runnable { + public void run() { + OpenProjectList.getDefault().deferredLoad(); + } +} Index: projects/projectui/src/org/netbeans/modules/project/ui/OpenProjectList.java --- projects/projectui/src/org/netbeans/modules/project/ui/OpenProjectList.java Base (1.74) +++ projects/projectui/src/org/netbeans/modules/project/ui/OpenProjectList.java Locally Modified (Based On 1.74) @@ -74,6 +74,7 @@ import org.openide.loaders.DataObject; import org.openide.loaders.DataObjectNotFoundException; import org.openide.modules.ModuleInfo; +import org.openide.util.Exceptions; import org.openide.util.Lookup; import org.openide.util.Mutex; import org.openide.util.Mutex.Action; @@ -142,47 +143,65 @@ // Implementation of the class --------------------------------------------- - public static OpenProjectList getDefault() { - boolean needNotify = false; + void deferredLoad() { + RequestProcessor.getDefault().post(new Runnable() { + public void run() { + doDeferredLoad(); + } + }); + } + private void doDeferredLoad() { + ProgressHandle handle = ProgressHandleFactory.createSystemHandle( + NbBundle.getMessage(OpenProjectList.class, "LOAD_PROGRESS")); + handle.start(); + handle.switchToIndeterminate(); + try { + openProjects = loadProjectList(); Project[] inital = null; - synchronized ( OpenProjectList.class ) { - if ( INSTANCE == null ) { - needNotify = true; - INSTANCE = new OpenProjectList(); - INSTANCE.openProjects = loadProjectList(); inital = INSTANCE.openProjects.toArray(new Project[0]); - INSTANCE.recentTemplates = new ArrayList( OpenProjectListSettings.getInstance().getRecentTemplates() ); + recentTemplates = new ArrayList( OpenProjectListSettings.getInstance().getRecentTemplates() ); URL mainProjectURL = OpenProjectListSettings.getInstance().getMainProjectURL(); // Load recent project list - INSTANCE.recentProjects.load(); + recentProjects.load(); for( Iterator it = INSTANCE.openProjects.iterator(); it.hasNext(); ) { Project p = (Project)it.next(); - INSTANCE.addModuleInfo(p); + addModuleInfo(p); // Set main project try { if ( mainProjectURL != null && mainProjectURL.equals( p.getProjectDirectory().getURL() ) ) { - INSTANCE.mainProject = p; + mainProject = p; } } catch( FileStateInvalidException e ) { // Not a main project } } + if (inital != null) { + log(createRecord("UI_INIT_PROJECTS", inital)); } - } - if ( needNotify ) { + Project[] oldprjs = new Project[0]; + Project[] newprjs = openProjects.toArray(new Project[openProjects.size()]); + pchSupport.firePropertyChange( PROPERTY_OPEN_PROJECTS, oldprjs, newprjs); //#68738: a project may open other projects in its ProjectOpenedHook: - for(Project p: new ArrayList(INSTANCE.openProjects)) { + for(Project p: new ArrayList(openProjects)) { notifyOpened(p); } - + } finally { + handle.finish(); } - if (inital != null) { - log(createRecord("UI_INIT_PROJECTS", inital)); } + public static OpenProjectList getDefault() { + synchronized ( OpenProjectList.class ) { + if ( INSTANCE == null ) { + INSTANCE = new OpenProjectList(); + INSTANCE.openProjects = new ArrayList ( + Arrays.asList (new Project[] { + new PleaseWaitProject() })); + } + } return INSTANCE; } Index: projects/projectui/src/org/netbeans/modules/project/ui/PleaseWaitProject.java --- projects/projectui/src/org/netbeans/modules/project/ui/PleaseWaitProject.java No Base Revision +++ projects/projectui/src/org/netbeans/modules/project/ui/PleaseWaitProject.java Locally New @@ -0,0 +1,115 @@ +/* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (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.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * Portions Copyrighted 2007 Sun Microsystems, Inc. + */ + +package org.netbeans.modules.project.ui; + +import java.awt.Image; +import java.beans.PropertyChangeListener; +import java.util.Collections; +import java.util.Iterator; +import javax.swing.Icon; +import javax.swing.ImageIcon; +import org.netbeans.api.project.Project; +import org.netbeans.api.project.ProjectInformation; +import org.netbeans.spi.project.ui.LogicalViewProvider; +import org.openide.filesystems.FileObject; +import org.openide.filesystems.FileSystem; +import org.openide.filesystems.FileUtil; +import org.openide.loaders.DataObject; +import org.openide.nodes.AbstractNode; +import org.openide.nodes.Children; +import org.openide.nodes.Node; +import org.openide.util.Lookup; +import org.openide.util.NbBundle; +import org.openide.util.Utilities; +import org.openide.util.lookup.Lookups; +import org.openidex.search.SearchInfo; + +/** + * Dummy project that shows a wait node while the real project list is + * loaded + * + * @author Tim Boudreau + */ +final class PleaseWaitProject implements Project, ProjectInformation, SearchInfo, LogicalViewProvider { + PleaseWaitProject() {} + public FileObject getProjectDirectory() { + FileSystem fs = FileUtil.createMemoryFileSystem(); + return fs.getRoot(); + } + + public Lookup getLookup() { + return Lookups.fixed(this); + } + + public String getName() { + return NbBundle.getMessage (PleaseWaitProject.class, + "LBL_PLEASE_WAIT"); + } + + public String getDisplayName() { + return getName(); + } + + public Icon getIcon() { + Image img = Utilities.loadImage("org/netbeans/modules/project/ui/" + //NOI18N + "resources/wait.gif"); //NOI18N + return new ImageIcon (img); + } + + public Project getProject() { + return this; + } + + public void addPropertyChangeListener(PropertyChangeListener listener) { + //do nothing + } + + public void removePropertyChangeListener(PropertyChangeListener listener) { + //do nothing + } + + @Override + public boolean equals (Object o) { + return o instanceof PleaseWaitProject; + } + + @Override + public int hashCode() { + return 81; + } + + public boolean canSearch() { + return false; + } + + public Iterator objectsToSearch() { + return Collections.emptyList().iterator(); + } + + public Node createLogicalView() { + AbstractNode result = new AbstractNode(Children.LEAF); + result.setDisplayName(getName()); + result.setIconBaseWithExtension("org/netbeans/modules/project/ui/" + //NOI18N + "resources/wait.gif"); + return result; + } + + public Node findPath(Node root, Object target) { + return null; + } +} Index: projects/projectui/src/org/netbeans/modules/project/ui/ProjectsRootNode.java --- projects/projectui/src/org/netbeans/modules/project/ui/ProjectsRootNode.java Base (1.49) +++ projects/projectui/src/org/netbeans/modules/project/ui/ProjectsRootNode.java Locally Modified (Based On 1.49) @@ -435,6 +435,9 @@ private final SearchInfo delegate; public AlwaysSearchableSearchInfo(Project prj) { + if (prj == null) { + prj = new PleaseWaitProject(); + } SearchInfo projectSearchInfo = prj.getLookup().lookup(SearchInfo.class); if (projectSearchInfo != null) { delegate = projectSearchInfo; Index: projects/projectui/src/org/netbeans/modules/project/ui/resources/layer.xml --- projects/projectui/src/org/netbeans/modules/project/ui/resources/layer.xml Base (1.89) +++ projects/projectui/src/org/netbeans/modules/project/ui/resources/layer.xml Locally Modified (Based On 1.89) @@ -667,5 +667,10 @@ + + + + +