[hg] main-silver: #232827: checked for compatible EditorUI even ...

  • From: Svata Dedic < >
  • To:
  • Subject: [hg] main-silver: #232827: checked for compatible EditorUI even ...
  • Date: Thu, 18 Jul 2013 15:52:36 -0700

changeset f262bffd7705 in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/f262bffd7705
description:
        #232827: checked for compatible EditorUI even on the derived 
JEditorPane

diffstat:

 
editor.bracesmatching/src/org/netbeans/modules/editor/bracesmatching/BraceMatchingSidebarComponent.java
 |  30 +++++++---
 1 files changed, 21 insertions(+), 9 deletions(-)

diffs (63 lines):

diff --git 
a/editor.bracesmatching/src/org/netbeans/modules/editor/bracesmatching/BraceMatchingSidebarComponent.java
 
b/editor.bracesmatching/src/org/netbeans/modules/editor/bracesmatching/BraceMatchingSidebarComponent.java
--- 
a/editor.bracesmatching/src/org/netbeans/modules/editor/bracesmatching/BraceMatchingSidebarComponent.java
+++ 
b/editor.bracesmatching/src/org/netbeans/modules/editor/bracesmatching/BraceMatchingSidebarComponent.java
@@ -86,6 +86,7 @@
 import org.netbeans.editor.BaseDocument;
 import org.netbeans.editor.BaseTextUI;
 import org.netbeans.editor.Coloring;
+import org.netbeans.editor.EditorUI;
 import org.netbeans.editor.PopupManager;
 import org.netbeans.editor.Utilities;
 import org.netbeans.editor.ext.ToolTipSupport;
@@ -429,6 +430,11 @@
                 }
             }
         });
+        try {
+            Thread.sleep(1000);
+        } catch (Exception ex) {
+            
+        }
         SwingUtilities.invokeLater(new Runnable() {
            public void run() {
             braceContext = ctx[0];
@@ -568,9 +574,23 @@
         if (kit == null || !(doc instanceof NbDocument.CustomEditor)) {
             return null;
         }
-
         CustomEditor ed = (NbDocument.CustomEditor)doc;
         Element lineRootElement = doc.getDefaultRootElement();
+
+        // Set the same kit and document
+        tooltipPane.setEditorKit(kit);
+        tooltipPane.setDocument(doc);
+        EditorUI editorUI = Utilities.getEditorUI(tooltipPane);
+        if (editorUI == null) {
+            // see #232827; the NB editor kit is either not yet installed, 
or has been just uninstalled
+            return null;
+        }
+        
+        tooltipPane.setEditable(false);
+        tooltipPane.setFocusable(false);
+        tooltipPane.putClientProperty("nbeditorui.vScrollPolicy", 
JScrollPane.VERTICAL_SCROLLBAR_NEVER);
+        tooltipPane.putClientProperty("nbeditorui.hScrollPolicy", 
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+        tooltipPane.putClientProperty("nbeditorui.selectSidebarLocations", 
"West");
         try {
             // Start-offset of the fold => line start => position
             int lineIndex = lineRootElement.getElementIndex(start);
@@ -584,14 +604,6 @@
             // DocumentView.END_POSITION_PROPERTY
             tooltipPane.putClientProperty("document-view-end-position", pos);
             tooltipPane.putClientProperty("document-view-accurate-span", 
true);
-            // Set the same kit and document
-            tooltipPane.setEditorKit(kit);
-            tooltipPane.setDocument(doc);
-            tooltipPane.setEditable(false);
-            tooltipPane.setFocusable(false);
-            tooltipPane.putClientProperty("nbeditorui.vScrollPolicy", 
JScrollPane.VERTICAL_SCROLLBAR_NEVER);
-            tooltipPane.putClientProperty("nbeditorui.hScrollPolicy", 
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
-            
tooltipPane.putClientProperty("nbeditorui.selectSidebarLocations", "West");
 
             if (braceContext != null) {
                 tooltipPane.putClientProperty(MATCHED_BRACES, origin);

[hg] main-silver: #232827: checked for compatible EditorUI even ...

Svata Dedic 07/18/2013

Project Features

About this Project

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