hasSelection = tf.getSelectedText().length() > 0;
hasSelection = ((tf.getSelectedText() != null) && (tf.getSelectedText().length() > 0));
        private void ableEditMenu() {            String view = getView();            if ((view != null) && view.equals("EditProjectPanel")) {                if (selectedComponent != null) {                    boolean hasSelection = false;                    if (selectedComponent instanceof JList) {                        JList list = (JList)selectedComponent;                        hasSelection = list.getSelectedIndices().length > 0;                    } else if (selectedComponent instanceof JTextField) {                        JTextField tf = (JTextField)selectedComponent;                        hasSelection = tf.getSelectedText().length() > 0;                    }                                                        cutItem.setEnabled(hasSelection);                    copyItem.setEnabled(hasSelection);                       selectAllItem.setEnabled(true);                                  }//            } else if (view.equals("BugTree")) {           //            } else if (view.equals("ReportPanel")) {                            } else {                cutItem.setEnabled(false);                copyItem.setEnabled(true);                pasteItem.setEnabled(false);                selectAllItem.setEnabled(false);            }                    }