[hg] main-silver: #184422 - 5s - FontAndColorsPanel.update() is ...

  • From: Milutin Kristofic < >
  • To:
  • Subject: [hg] main-silver: #184422 - 5s - FontAndColorsPanel.update() is ...
  • Date: Fri, 26 Apr 2013 11:11:10 -0700

changeset 79aab74a341d in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/79aab74a341d
description:
        #184422 - 5s - FontAndColorsPanel.update() is slow

diffstat:

 
options.editor/src/org/netbeans/modules/options/colors/SyntaxColoringPanel.java
 |  21 ++++++++-
 1 files changed, 18 insertions(+), 3 deletions(-)

diffs (51 lines):

diff --git 
a/options.editor/src/org/netbeans/modules/options/colors/SyntaxColoringPanel.java
 
b/options.editor/src/org/netbeans/modules/options/colors/SyntaxColoringPanel.java
--- 
a/options.editor/src/org/netbeans/modules/options/colors/SyntaxColoringPanel.java
+++ 
b/options.editor/src/org/netbeans/modules/options/colors/SyntaxColoringPanel.java
@@ -448,7 +448,7 @@
     }
     
     @Override
-    public void update (ColorModel colorModel) {
+    public void update (final ColorModel colorModel) {
         this.colorModel = colorModel;
         currentProfile = colorModel.getCurrentProfile ();
         currentLanguage = ColorModel.ALL_LANGUAGES;
@@ -463,14 +463,23 @@
         preview.addPropertyChangeListener 
             (Preview.PROP_CURRENT_ELEMENT, this);
         listen = false;
-        List<String> languages = new 
ArrayList<String>(colorModel.getLanguages ());
+        Task update = new 
RequestProcessor("SyntaxColoringPanel2").create(new Runnable() {
+            
+            @Override
+            public void run() {
+                final List<String> languages = new 
ArrayList<String>(colorModel.getLanguages());
+                EventQueue.invokeLater(new Runnable() {
+
+                    @Override
+                    public void run() {
         languages.remove ("text/x-all-languages");
         Collections.sort (languages, new LanguagesComparator ());
         Iterator it = languages.iterator ();
         Object lastLanguage = cbLanguage.getSelectedItem ();
         cbLanguage.removeAllItems ();
-        while (it.hasNext ())
+                        while (it.hasNext()) {
             cbLanguage.addItem (it.next ());
+                        }
         listen = true;
         if (lastLanguage != null) {
             cbLanguage.setSelectedItem (lastLanguage);
@@ -478,6 +487,12 @@
             cbLanguage.setSelectedIndex (0);
         }
     }
+                });
+            }
+        });
+
+        update.schedule(20);
+    }
     
     @Override
     public void cancel () {

[hg] main-silver: #184422 - 5s - FontAndColorsPanel.update() is ...

Milutin Kristofic 04/26/2013

Project Features

About this Project

Editor was started in November 2009, is owned by Martin Ryzl, and has 147 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20140418.2d69abc). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close