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

(-)core/src/META-INF/services/org.netbeans.core.StatusLineElementProvider (+2 lines)
Added Link Here
1
org.netbeans.core.ExceptionVisualizerProvider
2
#position=666
(-)core/src/org/netbeans/core/ExceptionVisualizerProvider.java (+27 lines)
Added Link Here
1
/*
2
 *                 Sun Public License Notice
3
 * 
4
 * The contents of this file are subject to the Sun Public License
5
 * Version 1.0 (the "License"). You may not use this file except in
6
 * compliance with the License. A copy of the License is available at
7
 * http://www.sun.com/
8
 * 
9
 * The Original Code is NetBeans. The Initial Developer of the Original
10
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2005 Sun
11
 * Microsystems, Inc. All Rights Reserved.
12
 */
13
14
package org.netbeans.core;
15
16
import java.awt.Component;
17
import org.netbeans.core.StatusLineElementProvider;
18
19
/**
20
 *
21
 * @author  Jiri Rechtacek
22
 */
23
public final class ExceptionVisualizerProvider implements StatusLineElementProvider {
24
    public Component getStatusLineElement () {
25
        return NotifyException.getNotificationVisualizer ();
26
    }
27
}
(-)core/src/org/netbeans/core/StatusLineElementProvider.java (+30 lines)
Added Link Here
1
/*
2
 *                 Sun Public License Notice
3
 *
4
 * The contents of this file are subject to the Sun Public License
5
 * Version 1.0 (the "License"). You may not use this file except in
6
 * compliance with the License. A copy of the License is available at
7
 * http://www.sun.com/
8
 *
9
 * The Original Code is NetBeans. The Initial Developer of the Original
10
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2005 Sun
11
 * Microsystems, Inc. All Rights Reserved.
12
 */
13
14
package org.netbeans.core;
15
16
import java.awt.Component;
17
18
19
/**
20
 * Provides a component which will be added at east side of the status line.
21
 * The providers can be declared in module's MET-INF/services.
22
 *
23
 * @author Jiri Rechtacek
24
 */
25
public interface StatusLineElementProvider {
26
    
27
    /** Returns a component displayable in the status line. */
28
    public Component getStatusLineElement ();
29
    
30
}
(-)core/windows/src/org/netbeans/core/windows/view/ui/MainWindow.java (-18 / +75 lines)
Lines 19-25 Link Here
19
import java.awt.Component;
19
import java.awt.Component;
20
import java.awt.Dimension;
20
import java.awt.Dimension;
21
import java.awt.EventQueue;
21
import java.awt.EventQueue;
22
import java.awt.Frame;
22
import java.awt.FlowLayout;
23
import java.awt.Graphics;
23
import java.awt.Graphics;
24
import java.awt.Image;
24
import java.awt.Image;
25
import java.awt.Rectangle;
25
import java.awt.Rectangle;
Lines 27-35 Link Here
27
import java.awt.event.WindowAdapter;
27
import java.awt.event.WindowAdapter;
28
import java.awt.event.WindowEvent;
28
import java.awt.event.WindowEvent;
29
import java.awt.image.BufferedImage;
29
import java.awt.image.BufferedImage;
30
import java.lang.reflect.Method;
30
import java.text.Format;
31
import java.text.Format;
31
import java.text.MessageFormat;
32
import java.text.MessageFormat;
32
import java.util.Arrays;
33
import java.util.Arrays;
34
import java.util.Collection;
35
import java.util.Iterator;
33
import javax.swing.JComponent;
36
import javax.swing.JComponent;
34
import javax.swing.JFrame;
37
import javax.swing.JFrame;
35
import javax.swing.JLabel;
38
import javax.swing.JLabel;
Lines 39-51 Link Here
39
import javax.swing.JSeparator;
42
import javax.swing.JSeparator;
40
import javax.swing.MenuElement;
43
import javax.swing.MenuElement;
41
import javax.swing.MenuSelectionManager;
44
import javax.swing.MenuSelectionManager;
45
import javax.swing.SwingUtilities;
42
import javax.swing.UIManager;
46
import javax.swing.UIManager;
43
import javax.swing.WindowConstants;
47
import javax.swing.WindowConstants;
44
import javax.swing.border.Border;
48
import javax.swing.border.Border;
45
import javax.swing.border.EmptyBorder;
49
import javax.swing.border.EmptyBorder;
46
import javax.swing.event.ChangeEvent;
50
import javax.swing.event.ChangeEvent;
47
import javax.swing.event.ChangeListener;
51
import javax.swing.event.ChangeListener;
48
import org.netbeans.core.NotifyException;
52
import org.netbeans.core.StatusLineElementProvider;
49
import org.netbeans.core.windows.Constants;
53
import org.netbeans.core.windows.Constants;
50
import org.netbeans.core.windows.WindowManagerImpl;
54
import org.netbeans.core.windows.WindowManagerImpl;
51
import org.openide.ErrorManager;
55
import org.openide.ErrorManager;
Lines 57-62 Link Here
57
import org.openide.filesystems.Repository;
61
import org.openide.filesystems.Repository;
58
import org.openide.loaders.DataObject;
62
import org.openide.loaders.DataObject;
59
import org.openide.util.HelpCtx;
63
import org.openide.util.HelpCtx;
64
import org.openide.util.Lookup;
65
import org.openide.util.LookupEvent;
66
import org.openide.util.LookupListener;
60
import org.openide.util.NbBundle;
67
import org.openide.util.NbBundle;
61
import org.openide.util.Utilities;
68
import org.openide.util.Utilities;
62
69
Lines 77-82 Link Here
77
    /** Inner panel which contains desktop component */
84
    /** Inner panel which contains desktop component */
78
    private JPanel desktopPanel;
85
    private JPanel desktopPanel;
79
    
86
    
87
    private static JPanel innerIconsPanel;
88
    
80
    /** Flag indicating main window is initialized. */ 
89
    /** Flag indicating main window is initialized. */ 
81
    private boolean inited;
90
    private boolean inited;
82
    
91
    
Lines 147-160 Link Here
147
                status.setText(" "); // NOI18N
156
                status.setText(" "); // NOI18N
148
                status.setPreferredSize(new Dimension(0, status.getPreferredSize().height));
157
                status.setPreferredSize(new Dimension(0, status.getPreferredSize().height));
149
158
150
                JPanel panel = new JPanel(new BorderLayout());
159
                JPanel statusLinePanel = new JPanel(new BorderLayout());
151
                panel.add(new JSeparator(), BorderLayout.NORTH);
160
                statusLinePanel.add(new JSeparator(), BorderLayout.NORTH);
152
                panel.add(status, BorderLayout.CENTER);
161
                statusLinePanel.add(status, BorderLayout.CENTER);
153
                Component exceptionStatus = NotifyException.getNotificationVisualizer();
162
                
154
                if( null != exceptionStatus )
163
                decoratePanel (statusLinePanel);
155
                    panel.add( exceptionStatus, BorderLayout.EAST );
164
                statusLinePanel.setName("statusLine"); //NOI18N
156
                panel.setName("statusLine"); //NOI18N
165
                getContentPane().add (statusLinePanel, BorderLayout.SOUTH);
157
                getContentPane().add(panel, BorderLayout.SOUTH);
158
            } else { // custom status line provided
166
            } else { // custom status line provided
159
                JComponent status = getCustomStatusLine();
167
                JComponent status = getCustomStatusLine();
160
                if (status != null) {
168
                if (status != null) {
Lines 192-197 Link Here
192
        //#38810 end
200
        //#38810 end
193
    }
201
    }
194
    
202
    
203
    private static void decoratePanel (JPanel panel) {
204
        assert SwingUtilities.isEventDispatchThread () : "Must run in AWT queue.";
205
        if (innerIconsPanel != null) {
206
            panel.remove (innerIconsPanel);
207
        }
208
        innerIconsPanel = getStatusLineElements (panel);
209
        if (innerIconsPanel != null) {
210
            panel.add (innerIconsPanel, BorderLayout.EAST);
211
        }
212
    }
213
    
214
    private static Lookup.Result result;
215
    
216
    // package-private because StatusLineElementProviderTest
217
    static JPanel getStatusLineElements (JPanel panel) {
218
        result = Lookup.getDefault ().lookup (new Lookup.Template (StatusLineElementProvider.class));
219
        result.addLookupListener (new StatusLineElementsListener (panel));
220
        Collection/*<StatusLineElementProvider>*/ c = result.allInstances ();
221
        if (c == null || c.isEmpty ()) {
222
            return null;
223
        }
224
        Iterator it = c.iterator ();
225
        JPanel icons = new JPanel (new FlowLayout ());
226
        boolean some = false;
227
        while (it.hasNext ()) {
228
            Object o = it.next ();
229
            assert o instanceof StatusLineElementProvider;
230
            Component comp = ((StatusLineElementProvider) o).getStatusLineElement ();
231
            if (comp != null) {
232
                some = true;
233
                icons.add (comp);
234
            }
235
        }
236
        return some ? icons : null;
237
    }
238
    
239
    static private class StatusLineElementsListener implements LookupListener {
240
        private JPanel decoratingPanel;
241
        StatusLineElementsListener (JPanel decoratingPanel) {
242
            this.decoratingPanel = decoratingPanel;
243
        }
244
        public void resultChanged (LookupEvent ev) {
245
            SwingUtilities.invokeLater (new Runnable () {
246
                public void run () {
247
                    decoratePanel (decoratingPanel);
248
                }
249
            });
250
        }
251
    }
252
    
195
    /** Creates and returns border for desktop which is visually aligned
253
    /** Creates and returns border for desktop which is visually aligned
196
     * with currently active LF */
254
     * with currently active LF */
197
    private static Border getDesktopBorder () {
255
    private static Border getDesktopBorder () {
Lines 238-255 Link Here
238
        if(Constants.SWITCH_STATUSLINE_IN_MENUBAR) {
296
        if(Constants.SWITCH_STATUSLINE_IN_MENUBAR) {
239
            if (Constants.CUSTOM_STATUS_LINE_PATH == null) {
297
            if (Constants.CUSTOM_STATUS_LINE_PATH == null) {
240
                JLabel status = new StatusLine();
298
                JLabel status = new StatusLine();
241
                JPanel panel = new JPanel(new BorderLayout());
242
                JSeparator sep = new JSeparator(JSeparator.VERTICAL);
299
                JSeparator sep = new JSeparator(JSeparator.VERTICAL);
243
                Dimension d = sep.getPreferredSize();
300
                Dimension d = sep.getPreferredSize();
244
                d.width += 6; // need a bit more padding...
301
                d.width += 6; // need a bit more padding...
245
                sep.setPreferredSize(d);
302
                sep.setPreferredSize(d);
246
                panel.add(sep, BorderLayout.WEST);
303
                JPanel statusLinePanel = new JPanel(new BorderLayout());
247
                panel.add(status, BorderLayout.CENTER);
304
                statusLinePanel.add(sep, BorderLayout.WEST);
248
                Component exceptionStatus = NotifyException.getNotificationVisualizer();
305
                statusLinePanel.add(status, BorderLayout.CENTER);
249
                if( null != exceptionStatus )
306
                
250
                    panel.add( exceptionStatus, BorderLayout.EAST );
307
                decoratePanel (statusLinePanel);
251
                panel.setName("statusLine"); //NOI18N
308
                statusLinePanel.setName("statusLine"); //NOI18N
252
                menu.add(panel);
309
                menu.add(statusLinePanel);
253
            } else {
310
            } else {
254
                JComponent status = getCustomStatusLine();
311
                JComponent status = getCustomStatusLine();
255
                if (status != null) {
312
                if (status != null) {
(-)core/windows/test/unit/src/org/netbeans/core/windows/view/ui/StatusLineElementProviderTest.java (+118 lines)
Added Link Here
1
/*
2
 *                 Sun Public License Notice
3
 *
4
 * The contents of this file are subject to the Sun Public License
5
 * Version 1.0 (the "License"). You may not use this file except in
6
 * compliance with the License. A copy of the License is available at
7
 * http://www.sun.com/
8
 *
9
 * The Original Code is NetBeans. The Initial Developer of the Original
10
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2005 Sun
11
 * Microsystems, Inc. All Rights Reserved.
12
 */
13
14
package org.netbeans.core.windows.view.ui;
15
16
import java.awt.Component;
17
import java.util.Arrays;
18
import java.util.Collection;
19
import javax.swing.JLabel;
20
import javax.swing.JPanel;
21
import junit.textui.TestRunner;
22
import java.net.*;
23
import org.openide.util.Lookup;
24
import org.openide.util.lookup.AbstractLookup;
25
import org.openide.util.lookup.InstanceContent;
26
import org.openide.util.lookup.Lookups;
27
28
import org.netbeans.junit.*;
29
import org.netbeans.core.*;
30
31
32
/** Test what MainWindow returns the Status Line Elements and
33
 * a listener on lookup.result changes.
34
 * @author Jiri Rechtacek
35
 */
36
public class StatusLineElementProviderTest extends NbTestCase {
37
    
38
    static {
39
        System.setProperty ("org.openide.util.Lookup", "org.netbeans.core.windows.view.ui.StatusLineElementProviderTest$Lkp");
40
    }
41
    
42
    static private InstanceContent ic = null;
43
    static private Impl impl1, impl2;
44
    static private JPanel statusLine;
45
    
46
    public StatusLineElementProviderTest(String name) {
47
        super(name);
48
    }
49
    
50
    public static void main(String[] args) {
51
        TestRunner.run(new NbTestSuite(StatusLineElementProviderTest.class));
52
    }
53
    
54
    protected boolean runInEQ () {
55
        return true;
56
    }
57
    
58
    protected void setUp() {
59
        impl1 = new Impl ("First");
60
        impl2 = new Impl ("Second");
61
        statusLine = new JPanel ();
62
        Lookup.getDefault ();
63
    }
64
    
65
    public void testGetStatusLineElements () {
66
        // initialy contains comp1
67
        JPanel panel = MainWindow.getStatusLineElements (statusLine);
68
        assertNotNull ("getStatusLineElements() returns a panel.", panel);
69
        assertEquals ("Panel contains only one component.", 1, panel.getComponentCount ());
70
        assertTrue ("Panel contains the component Comp1.", Arrays.asList (panel.getComponents ()).contains (impl1.myComponent));
71
        
72
        // remove impl1 from lookup
73
        ic.remove (impl1);
74
        panel = MainWindow.getStatusLineElements (statusLine);
75
        assertNull ("getStatusLineElements() returns null, panel: " + panel, panel);
76
        
77
        // add impl1 back
78
        ic.add (impl1);
79
        panel = MainWindow.getStatusLineElements (statusLine);
80
        assertNotNull ("getStatusLineElements() returns a panel.", panel);
81
        assertEquals ("Panel contains only one component.", 1, panel.getComponentCount ());
82
        assertTrue ("Panel contains the component Comp1.", Arrays.asList (panel.getComponents ()).contains (impl1.myComponent));
83
        
84
        // add impl2
85
        ic.add (impl2);
86
        panel = MainWindow.getStatusLineElements (statusLine);
87
        assertNotNull ("getStatusLineElements() returns a panel.", panel);
88
        assertEquals ("Panel contains two components.", 2, panel.getComponentCount ());
89
        assertTrue ("Panel contains the component from impl1.", Arrays.asList (panel.getComponents ()).contains (impl1.myComponent));
90
        assertTrue ("Panel contains the component from impl2.", Arrays.asList (panel.getComponents ()).contains (impl2.myComponent));
91
    }
92
    
93
94
    public static final class Lkp extends AbstractLookup {
95
        public Lkp () {
96
            this (new InstanceContent ());
97
        }
98
99
        private Lkp (InstanceContent instanceContent) {
100
            super (instanceContent);
101
            ic = instanceContent;
102
            ic.add (impl1);
103
        }
104
    }    
105
106
     private static class Impl implements StatusLineElementProvider {
107
        public Component myComponent; 
108
        private String myId; 
109
        public Impl (String id) {
110
            myId = id;
111
        } 
112
        public Component getStatusLineElement() {
113
            myComponent = new JLabel (myId);
114
            return myComponent;
115
        }
116
     }
117
     
118
}
(-)autoupdate/libsrc/org/netbeans/updater/FlashingIcon.java (+201 lines)
Added Link Here
1
/*
2
 *                 Sun Public License Notice
3
 * 
4
 * The contents of this file are subject to the Sun Public License
5
 * Version 1.0 (the "License"). You may not use this file except in
6
 * compliance with the License. A copy of the License is available at
7
 * http://www.sun.com/
8
 * 
9
 * The Original Code is NetBeans. The Initial Developer of the Original
10
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2005 Sun
11
 * Microsystems, Inc. All Rights Reserved.
12
 */
13
14
package org.netbeans.updater;
15
16
import java.awt.Cursor;
17
import java.awt.Dimension;
18
import java.awt.Point;
19
import java.awt.event.MouseEvent;
20
import java.awt.event.MouseListener;
21
import javax.swing.Icon;
22
import javax.swing.JComponent;
23
import javax.swing.JToolTip;
24
import org.openide.util.RequestProcessor;
25
import org.openide.util.RequestProcessor.Task;
26
27
// XXX Copied from org.netbeans.core.FlashingIcon 
28
/** 
29
 *
30
 * A flashing icon to provide visual feedback for the user when something 
31
 * not very important happens in the system.
32
 * The icon is flashed for a few seconds and then remains visible for a while longer. 
33
 *
34
 * @author saubrecht
35
 */
36
abstract class FlashingIcon extends JComponent implements MouseListener {
37
    
38
    private static final long STOP_FLASHING_DELAY = 10 * 1000;
39
    private static final long DISAPPEAR_DELAY_MILLIS = STOP_FLASHING_DELAY + 50 * 1000;
40
    
41
    private Icon icon;
42
    
43
    private boolean keepRunning = false;
44
    private boolean isIconVisible = false;
45
    private boolean keepFlashing = true;
46
    private long startTime = 0;
47
    private Task timerTask;
48
    
49
    /** 
50
     * Creates a new instance of FlashingIcon 
51
     *
52
     * @param icon The icon that will be flashing (blinking)
53
     */
54
    protected FlashingIcon( Icon icon ) {
55
        this.icon = icon;
56
        Dimension d = new Dimension( icon.getIconWidth(), icon.getIconHeight() );
57
        setMinimumSize( d );
58
        setMaximumSize( d );
59
        setPreferredSize( d );
60
        
61
        addMouseListener( this );
62
    }
63
64
    /**
65
     * Start flashing of the icon. If the icon is already flashing, the timer
66
     * is reset.
67
     * If the icon is visible but not flashing, it starts flashing again
68
     * and the disappear timer is reset.
69
     */
70
    public void startFlashing() {
71
        synchronized( this ) {
72
            startTime = System.currentTimeMillis();
73
            isIconVisible = !isIconVisible;
74
            keepRunning = true;
75
            keepFlashing = true;
76
            if( null == timerTask ) {
77
                timerTask = RequestProcessor.getDefault ().post (new Timer ());
78
            } else {
79
                timerTask.run ();
80
            }
81
        }
82
        repaint();
83
    }
84
    
85
    /**
86
     * Stop the flashing and hide the icon.
87
     */
88
    public void disappear() {
89
        synchronized( this ) {
90
            keepRunning = false;
91
            isIconVisible = false;
92
            keepFlashing = false;
93
            if( null != timerTask )
94
                timerTask.cancel();
95
            timerTask = null;
96
            setToolTipText( null );
97
        }
98
        repaint();
99
    }
100
    
101
    /**
102
     * Stop flashing of the icon. The icon remains visible and active (listens 
103
     * for mouse clicks and displays tooltip) until the disappear timer expires.
104
     */
105
    public void stopFlashing() {
106
        synchronized( this ) {
107
            if( keepRunning && !isIconVisible ) {
108
                isIconVisible = true;
109
                repaint();
110
            }
111
        }
112
        keepFlashing = false;
113
    }
114
    
115
    /**
116
     * Switch the current image and repaint
117
     */
118
    protected void flashIcon() {
119
        isIconVisible = !isIconVisible;
120
        
121
        repaint();
122
    }
123
124
    public void paint(java.awt.Graphics g) {
125
        if( isIconVisible ) {
126
            icon.paintIcon( this, g, 0, 0 );
127
        }
128
    }
129
130
    public void mouseReleased(MouseEvent e) {}
131
132
    public void mousePressed(MouseEvent e) {
133
        stopFlashing();
134
    }
135
136
    public void mouseExited(MouseEvent e) {
137
        stopFlashing();
138
    }
139
140
    public void mouseEntered(MouseEvent e) {
141
        stopFlashing();
142
    }
143
144
    public void mouseClicked(MouseEvent e) {
145
        if( isIconVisible ) {
146
            disappear();
147
            onMouseClick();
148
        }
149
    }
150
    
151
    /**
152
     * Invoked when the user clicks the icon.
153
     */
154
    protected abstract void onMouseClick();
155
156
    /**
157
     * Invoked when the disappear timer expired.
158
     */
159
    protected abstract void timeout();
160
161
    public Cursor getCursor() {
162
163
        if( isIconVisible ) {
164
            return Cursor.getPredefinedCursor( Cursor.HAND_CURSOR );
165
        }
166
        return Cursor.getDefaultCursor();
167
    }
168
169
    public Point getToolTipLocation( MouseEvent event ) {
170
171
        JToolTip tip = createToolTip();
172
        tip.setTipText( getToolTipText() );
173
        Dimension d = tip.getPreferredSize();
174
        
175
        
176
        Point retValue = new Point( getWidth()-d.width, -d.height );
177
        return retValue;
178
    }
179
    
180
    private class Timer implements Runnable {
181
        public void run() {
182
            synchronized( FlashingIcon.this ) {
183
                long currentTime = System.currentTimeMillis();
184
                if( keepFlashing ) {
185
                    if( currentTime - startTime < STOP_FLASHING_DELAY ) {
186
                        flashIcon();
187
                    } else {
188
                        stopFlashing();
189
                    }
190
                }
191
                if( currentTime - startTime >= DISAPPEAR_DELAY_MILLIS ) {
192
                    disappear();
193
                    timeout();
194
                } else {
195
                    if( null != timerTask )
196
                        timerTask.schedule( 500 );
197
                }
198
            }
199
        }
200
    }
201
}
(-)autoupdate/src/org/netbeans/modules/autoupdate/AutoChecker.java (-55 / +88 lines)
Lines 7-20 Link Here
7
 * http://www.sun.com/
7
 * http://www.sun.com/
8
 * 
8
 * 
9
 * The Original Code is NetBeans. The Initial Developer of the Original
9
 * The Original Code is NetBeans. The Initial Developer of the Original
10
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2004 Sun
10
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2005 Sun
11
 * Microsystems, Inc. All Rights Reserved.
11
 * Microsystems, Inc. All Rights Reserved.
12
 */
12
 */
13
13
14
package org.netbeans.modules.autoupdate;
14
package org.netbeans.modules.autoupdate;
15
15
16
import java.awt.Component;
16
import java.util.*;
17
import java.util.*;
17
import java.text.SimpleDateFormat;
18
import org.netbeans.updater.UpdaterFrame;
18
19
19
import org.openide.util.NbBundle;
20
import org.openide.util.NbBundle;
20
import javax.swing.SwingUtilities;
21
import javax.swing.SwingUtilities;
Lines 22-35 Link Here
22
23
23
import org.openide.filesystems.*;
24
import org.openide.filesystems.*;
24
import java.io.*;
25
import java.io.*;
26
import javax.swing.Icon;
27
import javax.swing.ImageIcon;
28
import org.openide.util.RequestProcessor;
29
import org.openide.util.Utilities;
30
import org.netbeans.core.StatusLineElementProvider;
25
31
26
/** This class checks for updates in given period
32
/** This class checks for updates in given period
27
 *
33
 *
28
 * @author  Petr Hrebejk
34
 * @author  Petr Hrebejk, Jiri Rechtacek
29
 */
35
 */
30
class AutoChecker extends Object
36
public class AutoChecker extends Object
31
            implements Runnable,
37
            implements Runnable, Wizard.Validator {
32
    Wizard.Validator {
33
        
38
        
34
    /** Settings of autoupdate module */
39
    /** Settings of autoupdate module */
35
    private Settings settings;
40
    private Settings settings;
Lines 122-128 Link Here
122
                return;
127
                return;
123
            }
128
            }
124
        }
129
        }
125
130
        
131
        RequestProcessor.getDefault ().post (new Runnable () {
132
            public void run () {
133
                runInner ();
134
            }
135
        });
136
    }
137
    
138
    void runInner () {
139
        
126
        Autoupdater.setRunning( true );
140
        Autoupdater.setRunning( true );
127
        Wizard.resetErrorStore ();
141
        Wizard.resetErrorStore ();
128
142
Lines 135-162 Link Here
135
            if (at.isEnabled()) {
149
            if (at.isEnabled()) {
136
                countOfServer++;
150
                countOfServer++;
137
                updates = at.connectForUpdates();
151
                updates = at.connectForUpdates();
138
                updates.checkUpdates( this, at );
152
                updates.checkUpdates( this, at, true );
139
                int res = Wizard.checkConnect(updates, at);
153
                int res = Wizard.checkConnect(updates, at);
140
                if ( res == ConnectingDialog.OK && 
154
                if (updates.getTimeStamp () == null || at.getLastTimeStamp () == null ||
141
                        (updates.getTimeStamp() == null || at.getLastTimeStamp() == null ||
155
                           at.getLastTimeStamp ().before(updates.getTimeStamp ())) {
142
                           at.getLastTimeStamp().before(updates.getTimeStamp()))) {
143
                    allUpdates.put(at, updates);
156
                    allUpdates.put(at, updates);
144
                    countOfConnectedServer++;
157
                    countOfConnectedServer++;
145
                } else if (res == ConnectingDialog.SKIP && Wizard.getStoredErrorType () == Updates.NO_AVAILABLE_MODULES) {
158
                } else if (Wizard.getStoredErrorType () == Updates.NO_AVAILABLE_MODULES) {
146
                    countOfConnectedServer++;
159
                    countOfConnectedServer++;
147
                } else if ( res == ConnectingDialog.CANCEL ) {
148
                    Autoupdater.setRunning( false );
149
                    StatusDisplayer.getDefault().setStatusText( "" );
150
                    return;                                
151
                }
160
                }
152
            }
161
            }
153
        }
162
        }
154
        
163
        
155
        if ( countOfConnectedServer == 0 ) {
164
        if ( countOfConnectedServer == 0 ) {
156
            if (Wizard.isErrorStored () && Updates.NO_NETWORK == Wizard.getStoredErrorType ()) {
165
            if (Wizard.isErrorStored () && Updates.NO_NETWORK == Wizard.getStoredErrorType ()) {
157
                ConnectingErrorDialog.showDialog (Updates.NO_NETWORK, null);
166
                notifyError (Updates.NO_NETWORK);
158
            } else if (countOfServer == 0) {
167
            } else if (countOfServer == 0) {
159
                ConnectingErrorDialog.showDialog(Updates.NO_SERVER_ERROR, null);
168
                notifyError (Updates.NO_SERVER_ERROR);
160
            }
169
            }
161
            canceled = true;
170
            canceled = true;
162
            Autoupdater.setRunning( false );
171
            Autoupdater.setRunning( false );
Lines 164-181 Link Here
164
            return;
173
            return;
165
        }
174
        }
166
        
175
        
167
        // report results after checking
176
        reportResults ();
168
        Runnable runnable = new Runnable ( ) {
169
                                public void run() {
170
                                    reportResults();
171
                                }
172
                            };
173
174
        javax.swing.SwingUtilities.invokeLater( runnable );
175
        
176
    }
177
    }
177
178
178
    void reportResults() {
179
    void reportResults () {
179
        Autoupdater.setRunning( false );
180
        Autoupdater.setRunning( false );
180
        
181
        
181
        StatusDisplayer.getDefault().setStatusText( "" );
182
        StatusDisplayer.getDefault().setStatusText( "" );
Lines 187-228 Link Here
187
        if ( allUpdates.size() == 0 ) {
188
        if ( allUpdates.size() == 0 ) {
188
            // Report it if necessary
189
            // Report it if necessary
189
            if ( settings.isNegativeResults() ) {
190
            if ( settings.isNegativeResults() ) {
190
                AutoCheckInfo info = new AutoCheckInfo(
191
                noUpdatesFound ();
191
                                         NbBundle.getMessage( AutoChecker.class, "MSG_AutoCheck_NotFound" ),
192
                                         javax.swing.JOptionPane.INFORMATION_MESSAGE
193
                                     );
194
                info.showDialog(false);
195
            }
192
            }
196
            return;
193
            return;
197
        }
194
        }
198
195
199
196
200
        if ( getAllModules() != null &&
197
        if (getAllModules () != null && getAllModules ().size () > 0) {
201
                getAllModules().size() > 0 ) {
198
            notifyUpdates ();
202
                    
203
            // Some modules found
204
                    
205
            // by the task #39533, user has to be informed about modules found
206
            // Check was fully automatic inform the user about found modules
207
            // and ask him whether to proceed to the wizard.
208
            AutoCheckInfo info = new AutoCheckInfo(
209
                                     NbBundle.getMessage( AutoChecker.class, "MSG_AutoCheck_Found" ),
210
                                     javax.swing.JOptionPane.INFORMATION_MESSAGE
211
                                 );
212
213
            if (info.showDialog(true)) {
214
                Wizard.go( allUpdates );
215
                Autoupdater.setRunning (false);
216
            }
217
        } else if ( settings.isNegativeResults() ) {
199
        } else if ( settings.isNegativeResults() ) {
218
            // No modules found and we have to report negative results
200
            // No modules found and we have to report negative results
219
            AutoCheckInfo info = new AutoCheckInfo(
201
            noUpdatesFound ();
220
                                     NbBundle.getMessage( AutoChecker.class, "MSG_AutoCheck_NotFound" ),
221
                                     javax.swing.JOptionPane.INFORMATION_MESSAGE
222
                                 );
223
            info.showDialog(false);
224
        }
202
        }
203
        
204
    }
205
    
206
    private void notifyUpdates () {
207
        // Some modules found
208
        Runnable onMouseClick = new Runnable () {
209
            public void run () {
210
                Wizard.go( allUpdates );
211
            }
212
        };
213
        AvailableUpdateVisualizerProvider.UpdatesFlasher flasher = AvailableUpdateVisualizerProvider.getFlasher (onMouseClick);
214
        assert flasher != null : "Updates Flasher cannot be null.";
215
        flasher.setToolTipText (NbBundle.getMessage (AutoChecker.class, "MSG_AutoCheck_Found"));
216
        flasher.startFlashing();
217
    }
218
    
219
    private void notifyError (final int errorType) {
220
        if (settings.isNegativeResults ()) {
221
            ConnectingErrorDialog.showDialog (errorType, null);
222
        } else {
223
            // Some modules found
224
            Runnable onMouseClick = new Runnable () {
225
                public void run () {
226
                    ConnectingErrorDialog.showDialog (errorType, null);
227
                }
228
            };
229
            ProblemsVisualizerProvider.UpdatesFlasher flasher = ProblemsVisualizerProvider.getFlasher (onMouseClick);
230
            assert flasher != null : "Updates Flasher cannot be null.";
231
            flasher.setToolTipText (errorType == Updates.NO_NETWORK ?
232
                    NbBundle.getMessage (AutoChecker.class, "CTL_NoNetwork_titleLabel") :
233
                    NbBundle.getMessage (AutoChecker.class, "CTL_NoServer_titleLabel"));
234
            flasher.startFlashing();
235
        }
236
    }
237
    
238
    private void updatesFound () {
239
        // by the task #39533, user has to be informed about modules found
240
        // Check was fully automatic inform the user about found modules
241
        // and ask him whether to proceed to the wizard.
242
        AutoCheckInfo info = new AutoCheckInfo(
243
                                 NbBundle.getMessage( AutoChecker.class, "MSG_AutoCheck_Found" ),
244
                                 javax.swing.JOptionPane.INFORMATION_MESSAGE
245
                             );
225
246
247
        if (info.showDialog(true)) {
248
            Wizard.go( allUpdates );
249
        }
250
    }
251
    
252
    private void noUpdatesFound () {
253
        AutoCheckInfo info = new AutoCheckInfo(
254
                                 NbBundle.getMessage( AutoChecker.class, "MSG_AutoCheck_NotFound" ),
255
                                 javax.swing.JOptionPane.INFORMATION_MESSAGE
256
                             );
257
        info.showDialog(false);
226
    }
258
    }
227
259
228
    private Collection getAllModules() {
260
    private Collection getAllModules() {
Lines 290-293 Link Here
290
322
291
        }
323
        }
292
    }
324
    }
325
    
293
}
326
}
(-)autoupdate/src/org/netbeans/modules/autoupdate/AvailableUpdateVisualizerProvider.java (+80 lines)
Added Link Here
1
/*
2
 *                 Sun Public License Notice
3
 * 
4
 * The contents of this file are subject to the Sun Public License
5
 * Version 1.0 (the "License"). You may not use this file except in
6
 * compliance with the License. A copy of the License is available at
7
 * http://www.sun.com/
8
 * 
9
 * The Original Code is NetBeans. The Initial Developer of the Original
10
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2005 Sun
11
 * Microsystems, Inc. All Rights Reserved.
12
 */
13
14
package org.netbeans.modules.autoupdate;
15
16
import java.awt.Component;
17
import javax.swing.Icon;
18
import javax.swing.ImageIcon;
19
import org.netbeans.core.StatusLineElementProvider;
20
import org.openide.util.Utilities;
21
22
/**
23
 *
24
 * @author  Jiri Rechtacek
25
 */
26
public final class AvailableUpdateVisualizerProvider implements StatusLineElementProvider {
27
28
    public Component getStatusLineElement () {
29
        return getUpdatesVisualizer ();
30
    }
31
32
    private static UpdatesFlasher flasher = null;
33
    
34
    private static Runnable onMouseClick = null;
35
36
    /**
37
     * Return an icon that is flashing when a new internal exception occurs. 
38
     * Clicking the icon opens the regular exception dialog box. The icon
39
     * disappears (is hidden) after a short period of time and the exception
40
     * list is cleared.
41
     *
42
     * @return A flashing icon component or null if console logging is switched on.
43
     */
44
    private static Component getUpdatesVisualizer () {
45
        if (null == flasher) {
46
            ImageIcon img1 = new ImageIcon (Utilities.loadImage ("org/netbeans/modules/autoupdate/resources/newUpdates.gif", false));
47
            assert img1 != null : "Icon cannot be null.";
48
            flasher = new UpdatesFlasher (img1);
49
        }
50
        return flasher;
51
    }
52
    
53
    static UpdatesFlasher getFlasher (Runnable whatRunOnMouseClick) {
54
        onMouseClick = whatRunOnMouseClick;
55
        return flasher;
56
    }
57
    
58
    static class UpdatesFlasher extends FlashingIcon {
59
        public UpdatesFlasher (Icon img1) {
60
            super (img1);
61
        }
62
63
        /**
64
         * User clicked the flashing icon, display the exception window.
65
         */
66
        protected void onMouseClick () {
67
            if (onMouseClick != null) {
68
                onMouseClick.run ();
69
                disappear ();
70
            }
71
        }
72
        
73
        /**
74
         * The flashing icon disappeared (timed-out), clear the current
75
         * exception list.
76
         */
77
        protected void timeout () {}
78
    }
79
    
80
}
(-)autoupdate/src/org/netbeans/modules/autoupdate/Bundle.properties (-1 / +1 lines)
Lines 389-395 Link Here
389
# CTL_NoAvailableModules_textLabel=No available updates found on {0}.
389
# CTL_NoAvailableModules_textLabel=No available updates found on {0}.
390
CTL_NoAvailableModules_textLabel=No available updates found on selected Update Servers.
390
CTL_NoAvailableModules_textLabel=No available updates found on selected Update Servers.
391
CTL_DefaultServer=Update Server
391
CTL_DefaultServer=Update Server
392
CTL_NoServer_textLabel=To check the web for available updates and new modules you should go to Project -> Settings -> AutoupdateType, add the appropriate update center service and enable it.
392
CTL_NoServer_textLabel=To check the web for available updates and new modules you should go to Tools -> Options -> IDE Configuration -> System -> Autoupdate Types, add the appropriate update center service and enable it.
393
393
394
MSG_NoInfoXml=The NBM package {0} does not contain an Info/info.xml file.
394
MSG_NoInfoXml=The NBM package {0} does not contain an Info/info.xml file.
395
395
(-)autoupdate/src/org/netbeans/modules/autoupdate/Downloader.java (-5 / +3 lines)
Lines 7-13 Link Here
7
 * http://www.sun.com/
7
 * http://www.sun.com/
8
 * 
8
 * 
9
 * The Original Code is NetBeans. The Initial Developer of the Original
9
 * The Original Code is NetBeans. The Initial Developer of the Original
10
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2004 Sun
10
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2005 Sun
11
 * Microsystems, Inc. All Rights Reserved.
11
 * Microsystems, Inc. All Rights Reserved.
12
 */
12
 */
13
13
Lines 15-24 Link Here
15
15
16
import java.io.*;
16
import java.io.*;
17
import java.net.URLConnection;
17
import java.net.URLConnection;
18
import java.net.UnknownHostException;
19
import java.text.MessageFormat;
18
import java.text.MessageFormat;
20
import java.util.Properties;
21
import java.util.jar.*;
22
import java.util.Iterator;
19
import java.util.Iterator;
23
import java.util.List;
20
import java.util.List;
24
import org.netbeans.updater.UpdateTracking;
21
import org.netbeans.updater.UpdateTracking;
Lines 27-32 Link Here
27
24
28
import org.openide.util.NbBundle;
25
import org.openide.util.NbBundle;
29
import org.openide.NotifyDescriptor;
26
import org.openide.NotifyDescriptor;
27
import org.openide.util.RequestProcessor;
30
28
31
/** This class downloads modules and verifies the digital signatures
29
/** This class downloads modules and verifies the digital signatures
32
 * this class also copyies the downloaded modules.
30
 * this class also copyies the downloaded modules.
Lines 86-92 Link Here
86
                            }
84
                            }
87
                        };
85
                        };
88
86
89
        Wizard.getRequestProcessor().post( task );
87
        RequestProcessor.getDefault ().post( task );
90
    }
88
    }
91
89
92
    /** Total size of download in KBytes */
90
    /** Total size of download in KBytes */
(-)autoupdate/src/org/netbeans/modules/autoupdate/FlashingIcon.java (+204 lines)
Added Link Here
1
/*
2
 *                 Sun Public License Notice
3
 * 
4
 * The contents of this file are subject to the Sun Public License
5
 * Version 1.0 (the "License"). You may not use this file except in
6
 * compliance with the License. A copy of the License is available at
7
 * http://www.sun.com/
8
 * 
9
 * The Original Code is NetBeans. The Initial Developer of the Original
10
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2005 Sun
11
 * Microsystems, Inc. All Rights Reserved.
12
 */
13
14
package org.netbeans.modules.autoupdate;
15
16
import java.awt.Cursor;
17
import java.awt.Dimension;
18
import java.awt.Point;
19
import java.awt.event.MouseEvent;
20
import java.awt.event.MouseListener;
21
import javax.swing.Icon;
22
import javax.swing.JComponent;
23
import javax.swing.JToolTip;
24
import org.openide.util.RequestProcessor;
25
import org.openide.util.RequestProcessor.Task;
26
27
// Copied from org.netbeans.core.FlashingIcon 
28
/** 
29
 *
30
 * A flashing icon to provide visual feedback for the user when something 
31
 * not very important happens in the system.
32
 * The icon is flashed for a few seconds and then remains visible for a while longer. 
33
 *
34
 * @author saubrecht
35
 */
36
abstract class FlashingIcon extends JComponent implements MouseListener {
37
    
38
    protected final int STOP_FLASHING_DELAY = 10 * 1000;
39
    protected final int DISAPPEAR_DELAY_MILLIS = STOP_FLASHING_DELAY + 50 * 1000;
40
    protected final int FLASHING_FREQUENCY = 500;
41
    
42
    private Icon icon;
43
    
44
    private boolean keepRunning = false;
45
    private boolean isIconVisible = false;
46
    private boolean keepFlashing = true;
47
    private long startTime = 0;
48
    private Task timerTask;
49
    
50
    /** 
51
     * Creates a new instance of FlashingIcon 
52
     *
53
     * @param icon The icon that will be flashing (blinking)
54
     */
55
    protected FlashingIcon( Icon icon ) {
56
        this.icon = icon;
57
        Dimension d = new Dimension( icon.getIconWidth(), icon.getIconHeight() );
58
        setMinimumSize( d );
59
        setMaximumSize( d );
60
        setPreferredSize( d );
61
        
62
        addMouseListener( this );
63
    }
64
65
    /**
66
     * Start flashing of the icon. If the icon is already flashing, the timer
67
     * is reset.
68
     * If the icon is visible but not flashing, it starts flashing again
69
     * and the disappear timer is reset.
70
     */
71
    public void startFlashing() {
72
        System.out.println("DISAPPEAR_DELAY_MILLIS: " + DISAPPEAR_DELAY_MILLIS);
73
        System.out.println("FLASHING_FREQUENCY: " + FLASHING_FREQUENCY);
74
        synchronized( this ) {
75
            startTime = System.currentTimeMillis();
76
            isIconVisible = !isIconVisible;
77
            keepRunning = true;
78
            keepFlashing = true;
79
            if( null == timerTask ) {
80
                timerTask = RequestProcessor.getDefault ().post (new Timer ());
81
            } else {
82
                timerTask.run ();
83
            }
84
        }
85
        repaint();
86
    }
87
    
88
    /**
89
     * Stop the flashing and hide the icon.
90
     */
91
    public void disappear() {
92
        synchronized( this ) {
93
            keepRunning = false;
94
            isIconVisible = false;
95
            keepFlashing = false;
96
            if( null != timerTask )
97
                timerTask.cancel();
98
            timerTask = null;
99
            setToolTipText( null );
100
        }
101
        repaint();
102
    }
103
    
104
    /**
105
     * Stop flashing of the icon. The icon remains visible and active (listens 
106
     * for mouse clicks and displays tooltip) until the disappear timer expires.
107
     */
108
    public void stopFlashing() {
109
        synchronized( this ) {
110
            if( keepRunning && !isIconVisible ) {
111
                isIconVisible = true;
112
                repaint();
113
            }
114
        }
115
        keepFlashing = false;
116
    }
117
    
118
    /**
119
     * Switch the current image and repaint
120
     */
121
    protected void flashIcon() {
122
        isIconVisible = !isIconVisible;
123
        
124
        repaint();
125
    }
126
127
    public void paint(java.awt.Graphics g) {
128
        if( isIconVisible ) {
129
            icon.paintIcon( this, g, 0, 0 );
130
        }
131
    }
132
133
    public void mouseReleased(MouseEvent e) {}
134
135
    public void mousePressed(MouseEvent e) {
136
        stopFlashing();
137
    }
138
139
    public void mouseExited(MouseEvent e) {
140
        stopFlashing();
141
    }
142
143
    public void mouseEntered(MouseEvent e) {
144
        stopFlashing();
145
    }
146
147
    public void mouseClicked(MouseEvent e) {
148
        if( isIconVisible ) {
149
            disappear();
150
            onMouseClick();
151
        }
152
    }
153
    
154
    /**
155
     * Invoked when the user clicks the icon.
156
     */
157
    protected abstract void onMouseClick();
158
159
    /**
160
     * Invoked when the disappear timer expired.
161
     */
162
    protected abstract void timeout();
163
164
    public Cursor getCursor() {
165
166
        if( isIconVisible ) {
167
            return Cursor.getPredefinedCursor( Cursor.HAND_CURSOR );
168
        }
169
        return Cursor.getDefaultCursor();
170
    }
171
172
    public Point getToolTipLocation( MouseEvent event ) {
173
174
        JToolTip tip = createToolTip();
175
        tip.setTipText( getToolTipText() );
176
        Dimension d = tip.getPreferredSize();
177
        
178
        
179
        Point retValue = new Point( getWidth()-d.width, -d.height );
180
        return retValue;
181
    }
182
    
183
    private class Timer implements Runnable {
184
        public void run() {
185
            synchronized( FlashingIcon.this ) {
186
                long currentTime = System.currentTimeMillis();
187
                if( keepFlashing ) {
188
                    if( currentTime - startTime < STOP_FLASHING_DELAY ) {
189
                        flashIcon();
190
                    } else {
191
                        stopFlashing();
192
                    }
193
                }
194
                if( currentTime - startTime >= DISAPPEAR_DELAY_MILLIS ) {
195
                    disappear();
196
                    timeout();
197
                } else {
198
                    if( null != timerTask )
199
                        timerTask.schedule( FLASHING_FREQUENCY );
200
                }
201
            }
202
        }
203
    }
204
}
(-)autoupdate/src/org/netbeans/modules/autoupdate/ProblemsVisualizerProvider.java (+84 lines)
Added Link Here
1
/*
2
 *                 Sun Public License Notice
3
 * 
4
 * The contents of this file are subject to the Sun Public License
5
 * Version 1.0 (the "License"). You may not use this file except in
6
 * compliance with the License. A copy of the License is available at
7
 * http://www.sun.com/
8
 * 
9
 * The Original Code is NetBeans. The Initial Developer of the Original
10
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2005 Sun
11
 * Microsystems, Inc. All Rights Reserved.
12
 */
13
14
package org.netbeans.modules.autoupdate;
15
16
import java.awt.Component;
17
import javax.swing.Icon;
18
import javax.swing.ImageIcon;
19
import org.netbeans.core.StatusLineElementProvider;
20
import org.openide.util.Utilities;
21
22
/**
23
 *
24
 * @author  Jiri Rechtacek
25
 */
26
public final class ProblemsVisualizerProvider implements StatusLineElementProvider {
27
28
    public Component getStatusLineElement () {
29
        return getProblemsVisualizer ();
30
    }
31
32
    private static UpdatesFlasher flasher = null;
33
    
34
    private static Runnable onMouseClick = null;
35
36
    /**
37
     * Return an icon that is flashing when a new internal exception occurs. 
38
     * Clicking the icon opens the regular exception dialog box. The icon
39
     * disappears (is hidden) after a short period of time and the exception
40
     * list is cleared.
41
     *
42
     * @return A flashing icon component or null if console logging is switched on.
43
     */
44
    private static Component getProblemsVisualizer () {
45
        if (null == flasher) {
46
            ImageIcon img1 = new ImageIcon (Utilities.loadImage ("org/netbeans/modules/autoupdate/resources/problems.gif", false));
47
            assert img1 != null : "Icon cannot be null.";
48
            flasher = new UpdatesFlasher (img1);
49
        }
50
        return flasher;
51
    }
52
    
53
    static UpdatesFlasher getFlasher (Runnable whatRunOnMouseClick) {
54
        onMouseClick = whatRunOnMouseClick;
55
        return flasher;
56
    }
57
    
58
    static class UpdatesFlasher extends FlashingIcon {
59
        protected final int STOP_FLASHING_DELAY = 10 * 1000;
60
        protected final int DISAPPEAR_DELAY_MILLIS = STOP_FLASHING_DELAY + 10 * 1000;
61
        protected final int FLASHING_FREQUENCY = 250;
62
        
63
        public UpdatesFlasher (Icon img1) {
64
            super (img1);
65
        }
66
67
        /**
68
         * User clicked the flashing icon, display the exception window.
69
         */
70
        protected void onMouseClick () {
71
            if (onMouseClick != null) {
72
                onMouseClick.run ();
73
                disappear ();
74
            }
75
        }
76
        
77
        /**
78
         * The flashing icon disappeared (timed-out), clear the current
79
         * exception list.
80
         */
81
        protected void timeout () {}
82
    }
83
    
84
}
(-)autoupdate/src/org/netbeans/modules/autoupdate/SignVerifier.java (-3 / +3 lines)
Lines 7-13 Link Here
7
 * http://www.sun.com/
7
 * http://www.sun.com/
8
 * 
8
 * 
9
 * The Original Code is NetBeans. The Initial Developer of the Original
9
 * The Original Code is NetBeans. The Initial Developer of the Original
10
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2004 Sun
10
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2005 Sun
11
 * Microsystems, Inc. All Rights Reserved.
11
 * Microsystems, Inc. All Rights Reserved.
12
 */
12
 */
13
13
Lines 19-28 Link Here
19
import java.security.cert.Certificate;
19
import java.security.cert.Certificate;
20
import java.util.*;
20
import java.util.*;
21
import java.util.jar.*;
21
import java.util.jar.*;
22
import java.util.zip.*;
23
import java.text.MessageFormat;
22
import java.text.MessageFormat;
24
23
25
import org.openide.util.NbBundle;
24
import org.openide.util.NbBundle;
25
import org.openide.util.RequestProcessor;
26
26
27
27
28
/** Class for verifying signs in NBM Files.
28
/** Class for verifying signs in NBM Files.
Lines 100-106 Link Here
100
                            }
100
                            }
101
                        };
101
                        };
102
102
103
        Wizard.getRequestProcessor().post( task );
103
        RequestProcessor.getDefault ().post( task );
104
    }
104
    }
105
105
106
106
(-)autoupdate/src/org/netbeans/modules/autoupdate/Updates.java (+4 lines)
Lines 53-58 Link Here
53
    /** Checks for updates in separate thread. Displays progress in a dialog
53
    /** Checks for updates in separate thread. Displays progress in a dialog
54
     */
54
     */
55
    public abstract void checkUpdates( final Wizard.Validator validator, AutoupdateType at );
55
    public abstract void checkUpdates( final Wizard.Validator validator, AutoupdateType at );
56
    
57
    protected void checkUpdates (final Wizard.Validator validator, AutoupdateType at, boolean background) {
58
        checkUpdates (validator, at);
59
    }
56
60
57
    public void cancelCheck() {
61
    public void cancelCheck() {
58
        checkCanceled = true;
62
        checkCanceled = true;
(-)autoupdate/src/org/netbeans/modules/autoupdate/Wizard.java (-6 lines)
Lines 382-393 Link Here
382
        return ret;
382
        return ret;
383
    }
383
    }
384
    
384
    
385
    static RequestProcessor getRequestProcessor() {
386
        if ( processor == null )
387
            processor = new RequestProcessor();
388
        return processor;
389
    }
390
    
391
    private static String getBundle( String key ) {
385
    private static String getBundle( String key ) {
392
        return NbBundle.getMessage( Wizard.class, key );
386
        return NbBundle.getMessage( Wizard.class, key );
393
    }
387
    }
(-)autoupdate/src/org/netbeans/modules/autoupdate/XMLUpdates.java (-7 / +16 lines)
Lines 25-30 Link Here
25
import java.util.Iterator;
25
import java.util.Iterator;
26
import java.util.Map;
26
import java.util.Map;
27
import org.openide.ErrorManager;
27
import org.openide.ErrorManager;
28
import org.openide.util.RequestProcessor;
28
29
29
import org.w3c.dom.*;
30
import org.w3c.dom.*;
30
import org.xml.sax.*;
31
import org.xml.sax.*;
Lines 169-185 Link Here
169
    public void checkUpdates( final Wizard.Validator validator, String ucname ) {
170
    public void checkUpdates( final Wizard.Validator validator, String ucname ) {
170
        checkUpdates( validator, AutoupdateType.find( ucname ) );
171
        checkUpdates( validator, AutoupdateType.find( ucname ) );
171
    }
172
    }
173
    
174
    public void checkUpdates( final Wizard.Validator validator, final AutoupdateType at ) {
175
        checkUpdates (validator, at, false);
176
    }
172
        
177
        
173
    /** Checks for updates in separate thread. Displays progress in a dialog
178
    /** Checks for updates in separate thread. Displays progress in a dialog
174
     */
179
     */
175
    public void checkUpdates( final Wizard.Validator validator, final AutoupdateType at ) {
180
    public void checkUpdates (final Wizard.Validator validator, final AutoupdateType at, boolean hidden) {
176
181
177
        currentAT = at;
182
        currentAT = at;
178
        pError = NO_ERROR;
183
        pError = NO_ERROR;
179
        checkCanceled = false;
184
        checkCanceled = false;
180
185
181
        final java.awt.Dialog connDialog = ConnectingDialog.getDialog( at != null ? at.getName() : null );
186
        final java.awt.Dialog connDialog = ConnectingDialog.getDialog( at != null ? at.getName() : null );
182
        Runnable task = new Runnable () {
187
        Runnable runConnect = new Runnable () {
183
                            public void run() {
188
                            public void run() {
184
                                try {
189
                                try {
185
                                    parseDocument();
190
                                    parseDocument();
Lines 209-218 Link Here
209
                                }
214
                                }
210
                            }
215
                            }
211
                        };
216
                        };
212
        Wizard.getRequestProcessor().post( task );
217
        RequestProcessor.Task task = RequestProcessor.getDefault ().post (runConnect);
213
        connDialog.show();
218
        if (!hidden) {
214
        if (ConnectingDialog.isCanceled()) {
219
            connDialog.setVisible (true);
215
            cancelCheck();
220
            if (ConnectingDialog.isCanceled()) {
221
                cancelCheck();
222
            }
223
        } else {
224
            task.waitFinished ();
216
        }
225
        }
217
    }
226
    }
218
    
227
    
Lines 500-504 Link Here
500
        }
509
        }
501
        
510
        
502
    } //end of inner class ErrorPrinter
511
    } //end of inner class ErrorPrinter
503
512
    
504
}
513
}

Return to bug 55828