Example #1
0
  private void initSessionSheet(ISession session) {
    ActionCollection coll = getApplication().getActionCollection();
    session.addSeparatorToToolbar();
    session.addToToolbar(coll.get(FindAction.class));
    session.addToToolbar(coll.get(ReplaceAction.class));
    session.addToToolbar(coll.get(ConfigureAutoCorrectAction.class));

    SessionInternalFrame sif = session.getSessionInternalFrame();

    ISQLPanelAPI sqlPanelAPI = sif.getSQLPanelAPI();

    new ToolsPopupHandler(this).initToolsPopup(sif, coll);

    completeSqlPanelEntryAreaMenu(coll, sqlPanelAPI);
  }
Example #2
0
  private void addTreeNodeMenuActionsForDB2(ISession session) {
    try {
      if (DialectFactory.isDB2(session.getMetaData())) {
        // Plugin knows only how to script Views and Stored Procedures on DB2.
        // So if it's not a DB2 Session we tell SQuirreL the Plugin should not be used.

        // Add context menu items to the object tree's view and procedure nodes.
        IObjectTreeAPI otApi = session.getSessionInternalFrame().getObjectTreeAPI();
        otApi.addToPopup(
            DatabaseObjectType.VIEW,
            new ScriptDB2ViewAction(session.getApplication(), _resources, session));
        otApi.addToPopup(
            DatabaseObjectType.PROCEDURE,
            new ScriptDB2ProcedureAction(session.getApplication(), _resources, session));
      }
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
  private void btCreateTableActionPerformed(java.awt.event.ActionEvent evt) {
    ISQLConnection con = _session.getSQLConnection();
    String query = getQuery();
    Statement stmt = null;
    try {
      stmt = con.createStatement();
      stmt.execute(query);
      _session.getSessionInternalFrame().getObjectTreeAPI().refreshTree();
      jd.setVisible(false);
      jd.dispose();
      JOptionPane.showMessageDialog(
          null,
          // i18n[mysql.msgTableCreated=Table {0} created]
          s_stringMgr.getString("mysql.msgTableCreated", tfTableName.getText()));
    } catch (SQLException ex) {
      _session.showErrorMessage(ex);

    } finally {
      SQLUtilities.closeStatement(stmt);
    }
  }