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

(-)GlobalCommandsProvider.java (-1 / +11 lines)
Lines 59-69 Link Here
59
    private int numberOfFinishedCmdsToCollect = RuntimeFolderNode.DEFAULT_NUM_OF_FINISHED_CMDS_TO_COLLECT;
59
    private int numberOfFinishedCmdsToCollect = RuntimeFolderNode.DEFAULT_NUM_OF_FINISHED_CMDS_TO_COLLECT;
60
    private boolean runtimeCreated = false;
60
    private boolean runtimeCreated = false;
61
    private boolean expertMode = false;
61
    private boolean expertMode = false;
62
    private boolean initialized = false;
62
    
63
    
63
    /** Creates a new instance of GlobalCommandsProvider - to be called only by the Lookup system.
64
    /** Creates a new instance of GlobalCommandsProvider - to be called only by the Lookup system.
64
     * Do not call directly!
65
     * Do not call directly!
65
     */
66
     */
66
    public GlobalCommandsProvider() {
67
    public GlobalCommandsProvider() {
68
        instance = this;
69
    }
70
    
71
    private synchronized void initialize() {
67
        ProfilesFactory factory = ProfilesFactory.getDefault();
72
        ProfilesFactory factory = ProfilesFactory.getDefault();
68
        String names[] = factory.getProfilesNames();
73
        String names[] = factory.getProfilesNames();
69
        for (int i = 0; i < names.length; i++) {
74
        for (int i = 0; i < names.length; i++) {
Lines 75-81 Link Here
75
            profile.addPropertyChangeListener(this);
80
            profile.addPropertyChangeListener(this);
76
        }
81
        }
77
        factory.addPropertyChangeListener(WeakListeners.propertyChange(this, factory));
82
        factory.addPropertyChangeListener(WeakListeners.propertyChange(this, factory));
78
        instance = this;
83
        initialized = true;
79
    }
84
    }
80
    
85
    
81
    /**
86
    /**
Lines 141-146 Link Here
141
    }
146
    }
142
    
147
    
143
    private void collectCommands() {
148
    private void collectCommands() {
149
        synchronized (this) {
150
            if (!initialized) {
151
                initialize();
152
            }
153
        }
144
        Profile[] profiles = (Profile[]) profilesByNames.values().toArray(new Profile[0]);
154
        Profile[] profiles = (Profile[]) profilesByNames.values().toArray(new Profile[0]);
145
        commands = createCommandsFromProfiles(profiles);
155
        commands = createCommandsFromProfiles(profiles);
146
        fillCommands(commands);
156
        fillCommands(commands);

Return to bug 57503