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

(-)projects/projectui/src/org/netbeans/modules/project/ui/Bundle.properties (+2 lines)
Lines 289-291 Link Here
289
UI_INIT_PROJECTS_ICON_BASE=org/netbeans/modules/project/ui/resources/open.gif
289
UI_INIT_PROJECTS_ICON_BASE=org/netbeans/modules/project/ui/resources/open.gif
290
290
291
OpeningProjectPanel.openingProjectLabel.text=Opening Project\:
291
OpeningProjectPanel.openingProjectLabel.text=Opening Project\:
292
LBL_PLEASE_WAIT=Loading projects...
293
LOAD_PROGRESS=Loading Projects
(-)projects/projectui/src/org/netbeans/modules/project/ui/LoadProjectsWarmupTask.java (+28 lines)
Line 0 Link Here
1
/*
2
 * The contents of this file are subject to the terms of the Common Development
3
 * and Distribution License (the License). You may not use this file except in
4
 * compliance with the License.
5
 * 
6
 * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7
 * or http://www.netbeans.org/cddl.txt.
8
 * 
9
 * When distributing Covered Code, include this CDDL Header Notice in each file
10
 * and include the License file at http://www.netbeans.org/cddl.txt.
11
 * If applicable, add the following below the CDDL Header, with the fields
12
 * enclosed by brackets [] replaced by your own identifying information:
13
 * "Portions Copyrighted [year] [name of copyright owner]"
14
 * 
15
 * Portions Copyrighted 2007 Sun Microsystems, Inc.
16
 */
17
18
package org.netbeans.modules.project.ui;
19
20
/**
21
 *
22
 * @author Tim Boudreau
23
 */
24
public class LoadProjectsWarmupTask implements Runnable {
25
    public void run() {
26
        OpenProjectList.getDefault().deferredLoad();
27
    }
28
}
(-)projects/projectui/src/org/netbeans/modules/project/ui/OpenProjectList.java (-17 / +36 lines)
Lines 74-79 Link Here
74
import org.openide.loaders.DataObject;
74
import org.openide.loaders.DataObject;
75
import org.openide.loaders.DataObjectNotFoundException;
75
import org.openide.loaders.DataObjectNotFoundException;
76
import org.openide.modules.ModuleInfo;
76
import org.openide.modules.ModuleInfo;
77
import org.openide.util.Exceptions;
77
import org.openide.util.Lookup;
78
import org.openide.util.Lookup;
78
import org.openide.util.Mutex;
79
import org.openide.util.Mutex;
79
import org.openide.util.Mutex.Action;
80
import org.openide.util.Mutex.Action;
Lines 142-188 Link Here
142
           
143
           
143
    // Implementation of the class ---------------------------------------------
144
    // Implementation of the class ---------------------------------------------
144
    
145
    
145
    public static OpenProjectList getDefault() {
146
    void deferredLoad() {
146
        boolean needNotify = false;
147
        RequestProcessor.getDefault().post(new Runnable() {
148
            public void run() {
149
                doDeferredLoad();
150
            }
151
        });
152
    }
147
        
153
        
154
    private void doDeferredLoad() {
155
        ProgressHandle handle = ProgressHandleFactory.createSystemHandle(
156
                NbBundle.getMessage(OpenProjectList.class, "LOAD_PROGRESS"));
157
        handle.start();
158
        handle.switchToIndeterminate();
159
        try {
160
            openProjects = loadProjectList();                
148
        Project[] inital = null;
161
        Project[] inital = null;
149
        synchronized ( OpenProjectList.class ) {
150
            if ( INSTANCE == null ) {
151
                needNotify = true;
152
                INSTANCE = new OpenProjectList();
153
                INSTANCE.openProjects = loadProjectList();                
154
                inital = INSTANCE.openProjects.toArray(new Project[0]);
162
                inital = INSTANCE.openProjects.toArray(new Project[0]);
155
                INSTANCE.recentTemplates = new ArrayList<String>( OpenProjectListSettings.getInstance().getRecentTemplates() );
163
            recentTemplates = new ArrayList<String>( OpenProjectListSettings.getInstance().getRecentTemplates() );
156
                URL mainProjectURL = OpenProjectListSettings.getInstance().getMainProjectURL();
164
                URL mainProjectURL = OpenProjectListSettings.getInstance().getMainProjectURL();
157
                // Load recent project list
165
                // Load recent project list
158
                INSTANCE.recentProjects.load();
166
            recentProjects.load();
159
                for( Iterator it = INSTANCE.openProjects.iterator(); it.hasNext(); ) {
167
                for( Iterator it = INSTANCE.openProjects.iterator(); it.hasNext(); ) {
160
                    Project p = (Project)it.next();
168
                    Project p = (Project)it.next();
161
                    INSTANCE.addModuleInfo(p);
169
                addModuleInfo(p);
162
                    // Set main project
170
                    // Set main project
163
                    try {
171
                    try {
164
                        if ( mainProjectURL != null && 
172
                        if ( mainProjectURL != null && 
165
                             mainProjectURL.equals( p.getProjectDirectory().getURL() ) ) {
173
                             mainProjectURL.equals( p.getProjectDirectory().getURL() ) ) {
166
                            INSTANCE.mainProject = p;
174
                        mainProject = p;
167
                        }
175
                        }
168
                    }
176
                    }
169
                    catch( FileStateInvalidException e ) {
177
                    catch( FileStateInvalidException e ) {
170
                        // Not a main project
178
                        // Not a main project
171
                    }
179
                    }
172
                }          
180
                }          
181
            if (inital != null) {
182
                log(createRecord("UI_INIT_PROJECTS", inital));
173
            }
183
            }
174
        }
184
            Project[] oldprjs = new Project[0];
175
        if ( needNotify ) {
185
            Project[] newprjs = openProjects.toArray(new Project[openProjects.size()]);
186
            pchSupport.firePropertyChange( PROPERTY_OPEN_PROJECTS, oldprjs, newprjs);
176
            //#68738: a project may open other projects in its ProjectOpenedHook:
187
            //#68738: a project may open other projects in its ProjectOpenedHook:
177
            for(Project p: new ArrayList<Project>(INSTANCE.openProjects)) {
188
            for(Project p: new ArrayList<Project>(openProjects)) {
178
                notifyOpened(p);             
189
                notifyOpened(p);             
179
            }
190
            }
180
            
191
        } finally {
192
            handle.finish();
181
        }
193
        }
182
        if (inital != null) {
183
            log(createRecord("UI_INIT_PROJECTS", inital));
184
        }
194
        }
185
        
195
        
196
    public static OpenProjectList getDefault() {
197
        synchronized ( OpenProjectList.class ) {
198
            if ( INSTANCE == null ) {
199
                INSTANCE = new OpenProjectList();
200
                INSTANCE.openProjects = new ArrayList <Project>(
201
                        Arrays.asList (new Project[] { 
202
                        new PleaseWaitProject() }));
203
            }
204
        }
186
        return INSTANCE;
205
        return INSTANCE;
187
    }
206
    }
188
    
207
    
(-)projects/projectui/src/org/netbeans/modules/project/ui/PleaseWaitProject.java (+115 lines)
Line 0 Link Here
1
/*
2
 * The contents of this file are subject to the terms of the Common Development
3
 * and Distribution License (the License). You may not use this file except in
4
 * compliance with the License.
5
 * 
6
 * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7
 * or http://www.netbeans.org/cddl.txt.
8
 * 
9
 * When distributing Covered Code, include this CDDL Header Notice in each file
10
 * and include the License file at http://www.netbeans.org/cddl.txt.
11
 * If applicable, add the following below the CDDL Header, with the fields
12
 * enclosed by brackets [] replaced by your own identifying information:
13
 * "Portions Copyrighted [year] [name of copyright owner]"
14
 * 
15
 * Portions Copyrighted 2007 Sun Microsystems, Inc.
16
 */
17
18
package org.netbeans.modules.project.ui;
19
20
import java.awt.Image;
21
import java.beans.PropertyChangeListener;
22
import java.util.Collections;
23
import java.util.Iterator;
24
import javax.swing.Icon;
25
import javax.swing.ImageIcon;
26
import org.netbeans.api.project.Project;
27
import org.netbeans.api.project.ProjectInformation;
28
import org.netbeans.spi.project.ui.LogicalViewProvider;
29
import org.openide.filesystems.FileObject;
30
import org.openide.filesystems.FileSystem;
31
import org.openide.filesystems.FileUtil;
32
import org.openide.loaders.DataObject;
33
import org.openide.nodes.AbstractNode;
34
import org.openide.nodes.Children;
35
import org.openide.nodes.Node;
36
import org.openide.util.Lookup;
37
import org.openide.util.NbBundle;
38
import org.openide.util.Utilities;
39
import org.openide.util.lookup.Lookups;
40
import org.openidex.search.SearchInfo;
41
42
/**
43
 * Dummy project that shows a wait node while the real project list is 
44
 * loaded
45
 *
46
 * @author Tim Boudreau
47
 */
48
final class PleaseWaitProject implements Project, ProjectInformation, SearchInfo, LogicalViewProvider {
49
    PleaseWaitProject() {}
50
    public FileObject getProjectDirectory() {
51
        FileSystem fs = FileUtil.createMemoryFileSystem();
52
        return fs.getRoot();
53
    }
54
55
    public Lookup getLookup() {
56
        return Lookups.fixed(this);
57
    }
58
59
    public String getName() {
60
        return NbBundle.getMessage (PleaseWaitProject.class, 
61
                "LBL_PLEASE_WAIT");
62
    }
63
64
    public String getDisplayName() {
65
        return getName();
66
    }
67
68
    public Icon getIcon() {
69
        Image img = Utilities.loadImage("org/netbeans/modules/project/ui/" + //NOI18N
70
                "resources/wait.gif"); //NOI18N
71
        return new ImageIcon (img);
72
    }
73
74
    public Project getProject() {
75
        return this;
76
    }
77
78
    public void addPropertyChangeListener(PropertyChangeListener listener) {
79
        //do nothing
80
    }
81
82
    public void removePropertyChangeListener(PropertyChangeListener listener) {
83
        //do nothing
84
    }
85
    
86
    @Override
87
    public boolean equals (Object o) {
88
        return o instanceof PleaseWaitProject;
89
    }
90
    
91
    @Override
92
    public int hashCode() {
93
        return 81;
94
    }
95
96
    public boolean canSearch() {
97
        return false;
98
    }
99
100
    public Iterator<DataObject> objectsToSearch() {
101
        return Collections.<DataObject>emptyList().iterator();
102
    }
103
104
    public Node createLogicalView() {
105
        AbstractNode result = new AbstractNode(Children.LEAF);
106
        result.setDisplayName(getName());
107
        result.setIconBaseWithExtension("org/netbeans/modules/project/ui/" + //NOI18N
108
                "resources/wait.gif");
109
        return result;
110
    }
111
112
    public Node findPath(Node root, Object target) {
113
        return null;
114
    }
115
}
(-)projects/projectui/src/org/netbeans/modules/project/ui/ProjectsRootNode.java (+3 lines)
Lines 435-440 Link Here
435
        private final SearchInfo delegate;
435
        private final SearchInfo delegate;
436
        
436
        
437
        public AlwaysSearchableSearchInfo(Project prj) {
437
        public AlwaysSearchableSearchInfo(Project prj) {
438
            if (prj == null) {
439
                prj = new PleaseWaitProject();
440
            }
438
            SearchInfo projectSearchInfo = prj.getLookup().lookup(SearchInfo.class);
441
            SearchInfo projectSearchInfo = prj.getLookup().lookup(SearchInfo.class);
439
            if (projectSearchInfo != null) {
442
            if (projectSearchInfo != null) {
440
                delegate = projectSearchInfo;
443
                delegate = projectSearchInfo;
(-)projects/projectui/src/org/netbeans/modules/project/ui/resources/layer.xml (+5 lines)
Lines 667-671 Link Here
667
            <attr name="position" intvalue="1500"/>
667
            <attr name="position" intvalue="1500"/>
668
        </file>
668
        </file>
669
    </folder>
669
    </folder>
670
    <folder name="WarmUp">
671
        <file name="org-netbeans-modules-project-ui-LoadProjectsWarmupTask.instance">
672
            <attr name="position" intvalue="-1000"/>
673
        </file>
674
    </folder>
670
        
675
        
671
</filesystem>
676
</filesystem>

Return to bug 116891