/*
   * (non-Javadoc)
   *
   * @see com.coolsql.system.menubuild.IMenuLoadListener#action(javax.swing.JMenuItem)
   */
  public void action(final JMenuItem item) {
    if (item instanceof JCheckBoxMenuItem) {
      boolean isDisplay =
          Setting.getInstance()
              .getBoolProperty(PropertyConstant.PROPERTY_VIEW_SQLEDITOR_ISDISPLAY, true);
      if (!isDisplay) ViewManage.getInstance().getSqlEditor().hidePanel(false);
      final JCheckBoxMenuItem m = (JCheckBoxMenuItem) item;
      m.setSelected(isDisplay);

      ViewManage.getInstance()
          .getSqlEditor()
          .addPropertyChangeListener(
              new PropertyChangeListener() {

                public void propertyChange(PropertyChangeEvent evt) {
                  if (View.PROPERTY_HIDDEN.equals(evt.getPropertyName())) {
                    Object ob = evt.getNewValue();
                    if (ob instanceof Boolean) {
                      m.setSelected(((Boolean) evt.getNewValue()).booleanValue());
                      if (!(Boolean) ob) GUIUtil.updateSystemStatusBarForSQLEditor("");
                    }
                  }
                }
              });
    }
  }
 /* (non-Javadoc)
  * @see com.coolsql.system.menubuild.MenuItemEnableCheck#check()
  */
 public boolean check() {
   boolean superValue = super.check();
   if (!superValue) return false;
   String text = ViewManage.getInstance().getSqlEditor().getEditorPane().getSelectedText();
   if (text == null || text.equals("")) return false;
   else return true;
 }
  @Override
  public void executeAction(ActionEvent e) {
    EditorPanel pane = ViewManage.getInstance().getSqlEditor().getEditorPane();

    int startLine = pane.getSelectionStartLine();
    int endLine = pane.getSelectionEndLine();

    int lineCount = pane.getLineCount();

    int endOffset = 0;
    int startOffset = pane.getLineStartOffset(startLine);
    if (lineCount - 1 == endLine) {
      endOffset = pane.getLineEndOffset(endLine) - 1;
    } else {
      endOffset = pane.getLineEndOffset(endLine);
    }

    try {
      int length = endOffset - startOffset;
      pane.getDocument().remove(startOffset, length);
    } catch (BadLocationException e1) {
      LogProxy.errorLog(e1.getMessage(), e1);
    }
  }