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) { |