mbien commented on code in PR #6660:
URL: https://github.com/apache/netbeans/pull/6660#discussion_r1382684252


##########
platform/core.output2/src/org/netbeans/core/output2/options/OutputSettingsPanel.java:
##########
@@ -583,27 +578,21 @@ private void initPreview() {
         }
         previewInputOutput.getOut().close();
         previewInputOutput.getErr().close();
-        outputOptions.addPropertyChangeListener(new PropertyChangeListener() {
-            @Override
-            public void propertyChange(PropertyChangeEvent evt) {
-                if 
(!evt.getPropertyName().equals(OutputOptions.PROP_INITIALIZED)
-                        && outputOptions.isInitialized()) {
-                    controller.changed(outputOptions.isChanged());
-                }
-                updateControlsByModel();
+        outputOptions.addPropertyChangeListener((PropertyChangeEvent evt) -> {
+            if (!evt.getPropertyName().equals(OutputOptions.PROP_INITIALIZED)
+                    && outputOptions.isInitialized()) {
+                controller.changed(outputOptions.isChanged());
             }
+            updateControlsByModel();
         });
-        SwingUtilities.invokeLater(new Runnable() {
-            @Override
-            public void run() {
-                Component component = previewPanel.getComponent(0);
-                if (component instanceof AbstractOutputTab) {
-                    ((AbstractOutputTab) component).inputSent("Input from 
keyboard");
-                }
-                try {
-                    in.close();
-                } catch (IOException ex) {}
+        SwingUtilities.invokeLater(() -> {
+            Component component1 = previewPanel.getComponent(0);
+            if (component1 instanceof AbstractOutputTab) {
+                ((AbstractOutputTab) component1).inputSent("Input from 
keyboard");
             }
+            try {
+                in.close();

Review Comment:
   yeah this looks weird but I believe `getIn()` does more than just opening a 
stream:
   ```
   If a reader is ever requested, an input line is added to the tab and used to 
read one line at a time.
   ```
   this sounds like it makes a visual difference and is the reason why it is 
opened that early and closed once it displayed something - but i could be wrong.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to