Пример #1
0
  public void displayObjects(HibernateConnection con, String hqlQuery) {
    if (_hibernateSQLPanel._chkAlwaysViewObjects.isSelected()) {
      boolean limitObjectCount = _hibernateSQLPanel._chkLimitObjectCount.isSelected();
      int limitObjectCountVal = _hibernateSQLPanel._nbrLimitRows.getInt();

      _objectResultController.displayObjects(con, hqlQuery, limitObjectCount, limitObjectCountVal);
      _hibernateSQLPanel._tabResult_code.setSelectedComponent(_objectResultController.getPanel());
    }
  }
Пример #2
0
  public SQLPanelManager(final ISession session, HibernatePluginResources resource) {
    super(session);
    init(null, null);

    _resultExecuterPanel = new SQLResultExecuterPanel(session);
    _objectResultController = new ObjectResultController(session, resource);
    _hibernateSQLPanel =
        new HibernateSQLPanel(
            super.getComponent(), _resultExecuterPanel, _objectResultController.getPanel());

    session
        .getApplication()
        .getSessionManager()
        .addSessionListener(
            new SessionAdapter() {

              public void sessionClosing(SessionEvent evt) {
                onSessionClosing();
                session.getApplication().getSessionManager().removeSessionListener(this);
              }
            });

    _hibernateSQLPanel._btnFormatSql.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            onFormatSql();
          }
        });

    _hibernateSQLPanel._chkAppendSql.setSelected(
        Preferences.userRoot().getBoolean(PREF_KEY_APPEND_SQL, false));
    _hibernateSQLPanel._chkAlwaysFormatSql.setSelected(
        Preferences.userRoot().getBoolean(PREF_KEY_FORMAT_SQL, false));
    _hibernateSQLPanel._chkAlwaysExecuteSql.setSelected(
        Preferences.userRoot().getBoolean(PREF_KEY_EXECUTE_SQL, false));
    _hibernateSQLPanel._chkAlwaysViewObjects.setSelected(
        Preferences.userRoot().getBoolean(PREF_KEY_VIEW_OBJECTS, false));
    _hibernateSQLPanel._chkLimitObjectCount.setSelected(
        Preferences.userRoot().getBoolean(PREF_KEY_VIEW_LIMIT_OBJECT_COUNT, false));

    _hibernateSQLPanel._nbrLimitRows.setInt(
        Preferences.userRoot().getInt(PREF_KEY_VIEW_LIMIT_OBJECT_COUNT_VAL, 100));
    _hibernateSQLPanel._nbrLimitRows.setEnabled(
        _hibernateSQLPanel._chkLimitObjectCount.isSelected());

    _hibernateSQLPanel._chkAlwaysViewObjects.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            onViewObjectsChanged();
          }
        });
    onViewObjectsChanged();

    _hibernateSQLPanel._chkLimitObjectCount.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            onLimitRowsChanged();
          }
        });
  }