Example #1
0
  /**
   * Called when a session created but the UI hasn't been built for the session.
   *
   * @param session The session that is starting.
   */
  public void sessionCreated(ISession session) {
    SyntaxPreferences prefs = null;

    try {
      prefs = (SyntaxPreferences) _newSessionPrefs.clone();
    } catch (CloneNotSupportedException ex) {
      throw new InternalError("CloneNotSupportedException for SyntaxPreferences");
    }

    session.putPluginObject(this, IConstants.ISessionKeys.PREFS, prefs);

    SessionPreferencesListener lis = new SessionPreferencesListener(this, session);
    prefs.addPropertyChangeListener(lis);
    _prefListeners.put(session.getIdentifier(), lis);
  }
  /** @see ISQLEntryPanelFactory#createSQLEntryPanel() */
  public ISQLEntryPanel createSQLEntryPanel(ISession session) throws IllegalArgumentException {
    if (session == null) {
      throw new IllegalArgumentException("Null ISession passed");
    }

    JeditPreferences prefs =
        (JeditPreferences) session.getPluginObject(_plugin, JeditConstants.ISessionKeys.PREFS);
    if (prefs.getUseJeditTextControl()) {
      JeditSQLEntryPanel pnl =
          (JeditSQLEntryPanel)
              session.getPluginObject(_plugin, JeditConstants.ISessionKeys.JEDIT_SQL_ENTRY_CONTROL);
      if (pnl == null) {
        pnl = new JeditSQLEntryPanel(session, _plugin, prefs);
        //				final JEditTextArea ta = pnl.getTypedComponent();
        session.putPluginObject(_plugin, JeditConstants.ISessionKeys.JEDIT_SQL_ENTRY_CONTROL, pnl);
      }
      return pnl;
    }
    session.removePluginObject(_plugin, JeditConstants.ISessionKeys.JEDIT_SQL_ENTRY_CONTROL);
    return _originalFactory.createSQLEntryPanel(session);
  }