[hg] main-silver: Do not try set status text for editors without...

  • From: Milutin Kristofic < >
  • To: ,
  • Subject: [hg] main-silver: Do not try set status text for editors without...
  • Date: Thu, 24 Jan 2013 12:17:21 -0800

changeset 1f30503286b7 in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/1f30503286b7
description:
        Do not try set status text for editors without editorui

diffstat:

 editor.lib2/src/org/netbeans/modules/editor/lib2/ComponentUtils.java |  23 
+++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)

diffs (62 lines):

diff --git 
a/editor.lib2/src/org/netbeans/modules/editor/lib2/ComponentUtils.java 
b/editor.lib2/src/org/netbeans/modules/editor/lib2/ComponentUtils.java
--- a/editor.lib2/src/org/netbeans/modules/editor/lib2/ComponentUtils.java
+++ b/editor.lib2/src/org/netbeans/modules/editor/lib2/ComponentUtils.java
@@ -89,6 +89,9 @@
         // TODO: fix this, do not use reflection
         try {
             Object editorUI = getEditorUI(c);
+            if (editorUI == null) {
+                return;
+            }
             Method getSbMethod = 
editorUI.getClass().getMethod("getStatusBar");
             Object statusBar = getSbMethod.invoke(editorUI);
             Method setTextMethod = statusBar.getClass().getMethod("setText", 
String.class, String.class);
@@ -106,6 +109,9 @@
         // TODO: fix this, do not use reflection
         try {
             Object editorUI = getEditorUI(c);
+            if (editorUI == null) {
+                return;
+            }
             Method getSbMethod = 
editorUI.getClass().getMethod("getStatusBar");
             Object statusBar = getSbMethod.invoke(editorUI);
             Method setTextMethod = statusBar.getClass().getMethod("setText", 
String.class, int.class);
@@ -139,6 +145,9 @@
         // TODO: fix this, do not use reflection
         try {
             Object editorUI = getEditorUI(c);
+            if (editorUI == null) {
+                return;
+            }
             Method getSbMethod = 
editorUI.getClass().getMethod("getStatusBar"); //NOI18N
             Object statusBar = getSbMethod.invoke(editorUI);
             Method setTextMethod = 
statusBar.getClass().getMethod("setBoldText", String.class, String.class); 
//NOI18N
@@ -156,6 +165,9 @@
         // TODO: fix this, do not use reflection
         try {
             Object editorUI = getEditorUI(c);
+            if (editorUI == null) {
+                return "";
+            }
             Method getSbMethod = 
editorUI.getClass().getMethod("getStatusBar"); //NOI18N
             Object statusBar = getSbMethod.invoke(editorUI);
             Method getTextMethod = statusBar.getClass().getMethod("getText", 
String.class); //NOI18N
@@ -176,8 +188,17 @@
     private static Object getEditorUI(JTextComponent c) throws Exception {
         // TODO: fix this, do not use reflection
         TextUI textUI = c.getUI();
-        Method getEuiMethod = textUI.getClass().getMethod("getEditorUI"); 
//NOI18N
+        Method getEuiMethod = null;
+        try {
+            getEuiMethod = textUI.getClass().getMethod("getEditorUI"); 
//NOI18N
+        } catch (NoSuchMethodException nsme) {
+            LOG.log(Level.INFO, nsme.getMessage(), nsme);
+        }
+        if (getEuiMethod != null) {
         return getEuiMethod.invoke(textUI);
+        } else {
+            return null;
+        }
     }
     
     private static Frame getParentFrame(Component c) {

[hg] main-silver: Do not try set status text for editors without...

Milutin Kristofic 01/24/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