Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
View | Details | Raw Unified | Return to bug 224587
Collapse All | Expand All

(-)a/hudson/src/org/netbeans/modules/hudson/ui/nodes/HudsonInstanceNode.java (-15 / +12 lines)
 Lines 77-83    Link Here 
77
    private static final String ICON_BASE = "org/netbeans/modules/hudson/ui/resources/instance.png"; // NOI18N
77
    private static final String ICON_BASE = "org/netbeans/modules/hudson/ui/resources/instance.png"; // NOI18N
78
    
78
    
79
    private HudsonInstanceImpl instance;
79
    private HudsonInstanceImpl instance;
80
    private InstanceNodeChildren children;
81
    
80
    
82
    private boolean warn = false;
81
    private boolean warn = false;
83
    private boolean run = false;
82
    private boolean run = false;
 Lines 86-95    Link Here 
86
    private boolean version = false;
85
    private boolean version = false;
87
    
86
    
88
    public HudsonInstanceNode(final HudsonInstanceImpl instance) {
87
    public HudsonInstanceNode(final HudsonInstanceImpl instance) {
89
        super(new Children.Array(), Lookups.singleton(instance));
88
        super(new InstanceNodeChildren(instance), Lookups.singleton(instance));
90
        
89
        
91
        children = new InstanceNodeChildren(instance);
92
93
        setName(instance.getUrl());
90
        setName(instance.getUrl());
94
        setDisplayName(instance.getName());
91
        setDisplayName(instance.getName());
95
        setShortDescription(instance.getUrl());
92
        setShortDescription(instance.getUrl());
 Lines 168-180    Link Here 
168
        forbidden = instance.isForbidden();
165
        forbidden = instance.isForbidden();
169
        version = Utilities.isSupportedVersion(instance.getVersion());
166
        version = Utilities.isSupportedVersion(instance.getVersion());
170
        
167
        
171
        // Refresh children
172
        if (!alive || !version) {
173
            setChildren(new Children.Array());
174
        } else if (getChildren().getNodesCount() == 0) {
175
            setChildren(children);
176
        }
177
        
178
        // Fire changes if any
168
        // Fire changes if any
179
        fireDisplayNameChange(null, getHtmlDisplayName());
169
        fireDisplayNameChange(null, getHtmlDisplayName());
180
    }
170
    }
 Lines 207-215    Link Here 
207
    
197
    
208
    private static class InstanceNodeChildren extends Children.Keys<HudsonJob> implements HudsonChangeListener {
198
    private static class InstanceNodeChildren extends Children.Keys<HudsonJob> implements HudsonChangeListener {
209
        
199
        
210
        private final HudsonInstance instance;
200
        private final HudsonInstanceImpl instance;
211
        
201
        
212
        InstanceNodeChildren(HudsonInstance instance) {
202
        InstanceNodeChildren(HudsonInstanceImpl instance) {
213
            this.instance = instance;
203
            this.instance = instance;
214
            instance.addHudsonChangeListener(this);
204
            instance.addHudsonChangeListener(this);
215
            instance.prefs().addPreferenceChangeListener(new PreferenceChangeListener() {
205
            instance.prefs().addPreferenceChangeListener(new PreferenceChangeListener() {
 Lines 226-232    Link Here 
226
        @Override
216
        @Override
227
        protected void addNotify() {
217
        protected void addNotify() {
228
            super.addNotify();
218
            super.addNotify();
229
            refreshKeys();
219
            if (!instance.isConnected()/* && seems undesirable: !instance.isForbidden()*/) {
220
                setKeys(Collections.<HudsonJob>emptySet());
221
                instance.synchronize(true);
222
            } else {
223
                refreshKeys();
224
            }
230
        }
225
        }
231
        
226
        
232
        @Override
227
        @Override
 Lines 257-263    Link Here 
257
            setKeys(jobs);
252
            setKeys(jobs);
258
        }
253
        }
259
        
254
        
260
        @Override public void stateChanged() {}
255
        @Override public void stateChanged() {
256
            refreshKeys();
257
        }
261
        
258
        
262
        @Override public void contentChanged() {
259
        @Override public void contentChanged() {
263
            refreshKeys();
260
            refreshKeys();

Return to bug 224587
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo