コード例 #1
0
  public synchronized void toggleCurrentSQLResultTabSticky() {
    if (null != _stickyTab) {
      if (_stickyTab.equals(_tabbedExecutionsPanel.getSelectedComponent())) {
        // Sticky is turned off. Just remove sticky and return.
        _stickyTab = null;
        _tabbedExecutionsPanel.setIconAt(_tabbedExecutionsPanel.getSelectedIndex(), null);
        return;

      } else {
        // remove old sticky tab
        int indexOfStickyTab = getIndexOfTab(_stickyTab);
        if (-1 != indexOfStickyTab) {
          _tabbedExecutionsPanel.setIconAt(indexOfStickyTab, null);
        }
        _stickyTab = null;
      }
    }

    if (false == _tabbedExecutionsPanel.getSelectedComponent() instanceof IResultTab) {
      // i18n[SQLResultExecuterPanel.nonStickyPanel=Cannot make a cancel panel sticky]
      String msg = s_stringMgr.getString("SQLResultExecuterPanel.nonStickyPanel");
      JOptionPane.showMessageDialog(_session.getApplication().getMainFrame(), msg);
      return;
    }

    _stickyTab = (IResultTab) _tabbedExecutionsPanel.getSelectedComponent();
    int selectedIndex = _tabbedExecutionsPanel.getSelectedIndex();

    ImageIcon icon = getStickyIcon();

    _tabbedExecutionsPanel.setIconAt(selectedIndex, icon);
  }
コード例 #2
0
  /**
   * Called when a session started. Add commands to popup menu in object tree.
   *
   * @param session The session that is starting.
   * @return An implementation of PluginSessionCallback or null to indicate the plugin does not work
   *     with this session
   */
  public PluginSessionCallback sessionStarted(ISession session) {
    // Adds the view and procedure script actions if the session is DB2.
    addTreeNodeMenuActionsForDB2(session);

    // Register a custom ISQLExecutionListener implementation that simply prints all SQL being
    // executed to
    // the message panel.
    IMessageHandler messageHandler = session.getApplication().getMessageHandler();
    ExampleSqlExecutionListener sqlExecutionListener =
        new ExampleSqlExecutionListener(messageHandler);
    session.getSessionSheet().getSQLPaneAPI().addSQLExecutionListener(sqlExecutionListener);

    // We will override the default behavior of formatting exception messages that SQuirreL provides
    // for
    // this session with our own.  If this was a real plugin implementation, care would need to be
    // taken
    // that the custom formatter is only applied to database vendor sessions that this plugin was
    // written
    // for.  SQuirreL doesn't support registering multiple exception formatters for a single
    // session.  The
    // last one to register overrides all former registrations and results in a log warning message.
    session.setExceptionFormatter(new ExampleExceptionFormatter());

    return new PluginSessionCallbackAdaptor(this);
  }
コード例 #3
0
  private static Frame ctorHelper(
      ISession session, MssqlPlugin plugin, IDatabaseObjectInfo[] dbObjs) {
    if (session == null) throw new IllegalArgumentException("ISession == null");
    if (plugin == null) throw new IllegalArgumentException("MssqlPlugin == null");
    if (dbObjs == null) throw new IllegalArgumentException("IDatabaseObjectInfo[] is null");

    return session.getApplication().getMainFrame();
  }
コード例 #4
0
  private void initAccelerator(Class<? extends Action> actionClass, JMenuItem mnuItem) {
    Action action = _session.getApplication().getActionCollection().get(actionClass);

    String accel = (String) action.getValue(Resources.ACCELERATOR_STRING);
    if (null != accel && 0 != accel.trim().length()) {
      mnuItem.setAccelerator(KeyStroke.getKeyStroke(accel));
    }
  }
コード例 #5
0
  @Override
  public void execute(ISQLEntryPanel parent, ExecutionScope executionScope) {
    String sql = parent.getSQLToBeExecuted();
    if (sql == null || sql.length() == 0) return;

    SQLExecuterTask executer =
        new SQLExecuterTask(_session, getExplainSql(sql), new SQLExecutionHandler());
    _session.getApplication().getThreadPool().addTask(executer);
  }
コード例 #6
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);
    }
  }
コード例 #7
0
  private ImageIcon getStickyIcon() {
    ActionCollection actionCollection = _session.getApplication().getActionCollection();

    ImageIcon icon =
        (ImageIcon)
            actionCollection
                .get(ToggleCurrentSQLResultTabStickyAction.class)
                .getValue(Action.SMALL_ICON);
    return icon;
  }
コード例 #8
0
 private void validateSQL() {
   final ISQLPanelAPI api = _session.getSQLPanelAPI(_plugin);
   final String sql = api.getSQLScriptToBeExecuted();
   if (sql != null && sql.trim().length() > 0) {
     final SessionProperties sessionProps = _session.getProperties();
     final WebServiceSessionProperties wssProps = _plugin.getWebServiceSessionProperties(_session);
     final char stmtSepChar = sessionProps.getSQLStatementSeparatorChar();
     final String solComment = sessionProps.getStartOfLineComment();
     final ValidationProps valProps =
         new ValidationProps(
             _prefs, wssProps, _session.getMessageHandler(), sql, stmtSepChar, solComment);
     new Executor(_session.getApplication(), valProps).execute();
   } else {
     _session.getMessageHandler().showErrorMessage("No SQL specified");
   }
 }
コード例 #9
0
  private void propertiesHaveChanged(String propName) {
    final SessionProperties props = _session.getProperties();

    if (propName == null || propName.equals(SessionProperties.IPropertyNames.AUTO_COMMIT)) {
      SetAutoCommitTask task = new SetAutoCommitTask();
      if (SwingUtilities.isEventDispatchThread()) {
        _session.getApplication().getThreadPool().addTask(task);
      } else {
        task.run();
      }
    }

    if (propName == null
        || propName.equals(SessionProperties.IPropertyNames.SQL_EXECUTION_TAB_PLACEMENT)) {
      _tabbedExecutionsPanel.setTabPlacement(props.getSQLExecutionTabPlacement());
    }
  }
コード例 #10
0
ファイル: SyntaxPlugin.java プロジェクト: hergos/repository
    public void propertyChange(PropertyChangeEvent evt) {
      String propName = evt.getPropertyName();

      if (false == SyntaxPreferences.IPropertyNames.USE_RSYNTAX_CONTROL.equals(propName)) {

        // Not the Textcontrol itself changed but some other of the Syntax Preferences, for example
        // a
        // color.
        // So we tell the current control to update the preferences.
        Object pluginObject =
            _session.getPluginObject(_plugin, IConstants.ISessionKeys.SQL_ENTRY_CONTROL);

        if (pluginObject instanceof RSyntaxSQLEntryPanel) {
          ((RSyntaxSQLEntryPanel) pluginObject).updateFromPreferences();
        }
      } else {
        /*
        We don't support switching the entry control during a session
        because serveral things, that are attached to the entry control
        from outside this plugin would need to reinitialze too.
        For example code completion and edit extras.

        synchronized (_session)
        {
        	ISQLEntryPanelFactory factory = _plugin.getSQLEntryAreaFactory();
        	ISQLEntryPanel pnl = factory.createSQLEntryPanel(_session);
        	_session.getSQLPanelAPI(_plugin).installSQLEntryPanel(pnl);
        }
        */

        String msg =
            // i18n[syntax.switchingNotSupported=Switching the editor of a runninig session is not
            // supported.\nYou may switch the entry area in the New Session Properties dialog]
            s_stringMgr.getString("syntax.switchingNotSupported");

        JOptionPane.showMessageDialog(_session.getApplication().getMainFrame(), msg);

        throw new SyntaxPrefChangeNotSupportedException();
      }
    }
コード例 #11
0
  private void populateAvailableTable(JTable table) {
    DatabaseObjectInfoTableModel model = (DatabaseObjectInfoTableModel) table.getModel();

    try {
      String catalog = _session.getSQLConnection().getCatalog();
      SQLDatabaseMetaData metaData = _session.getSQLConnection().getSQLMetaData();

      int i;

      /* add the tables. */
      ITableInfo[] tables =
          _session
              .getSchemaInfo()
              .getITableInfos(catalog, null, new ObjFilterMatcher(), new String[] {"TABLE"});
      for (i = 0; i < tables.length; i++) model.addElement(tables[i]);

      /* add the views. */
      ITableInfo[] views =
          _session
              .getSchemaInfo()
              .getITableInfos(catalog, null, new ObjFilterMatcher(), new String[] {"VIEW"});
      for (i = 0; i < views.length; i++) model.addElement(views[i]);

      /* add the procedures. */
      // IProcedureInfo[] procs = metaData.getProcedures(catalog,null,null);
      IProcedureInfo[] procs =
          _session.getSchemaInfo().getStoredProceduresInfos(catalog, null, new ObjFilterMatcher());
      for (i = 0; i < procs.length; i++)
        if (!procs[i].getSimpleName().startsWith("dt_")) model.addElement(procs[i]);

      /* add the UDTs. */
      IUDTInfo[] udts = metaData.getUDTs(catalog, null, null, null);
      for (i = 0; i < udts.length; i++) model.addElement(udts[i]);
    } catch (SQLException ex) {
      _session.getApplication().showErrorDialog(ex.getMessage(), ex);
    }
  }
コード例 #12
0
  public void actionPerformed(ActionEvent evt) {
    if (_session != null) {
      ObjectTreeNode[] selectedNodes =
          _session.getSessionSheet().getObjectTreePanel().getSelectedNodes();

      Positioner positioner = new Positioner();
      GraphController toAddTo = null;

      for (int i = 0; i < selectedNodes.length; i++) {
        if (selectedNodes[i].getDatabaseObjectType() == DatabaseObjectType.TABLE) ;
        {
          if (null == toAddTo) {
            GraphController[] controllers = _plugin.getGraphControllers(_session);
            if (0 == controllers.length) {
              toAddTo = _plugin.createNewGraphControllerForSession(_session, false);
            } else {
              GraphSelectionDialogController dlg =
                  new GraphSelectionDialogController(
                      controllers, _session.getApplication().getMainFrame());
              dlg.doModal();

              if (false == dlg.isOK()) {
                return;
              }
              if (null == dlg.getSelectedController()) {
                toAddTo = _plugin.createNewGraphControllerForSession(_session, false);
              } else {
                toAddTo = dlg.getSelectedController();
              }
            }
          }

          toAddTo.addTable(selectedNodes[i], positioner);
        }
      }
    }
  }
コード例 #13
0
  /**
   * This method is called from within the constructor to initialize the form. WARNING: Do NOT
   * modify this code. The content of this method is always regenerated by the Form Editor.
   */
  private void initComponents() {
    lbTableName = new javax.swing.JLabel();
    tfTableName = new javax.swing.JTextField();
    lbTableType = new javax.swing.JLabel();
    cbTableType = new javax.swing.JComboBox();
    lbFields = new javax.swing.JLabel();
    tfFieldName = new javax.swing.JTextField();
    btAdd = new javax.swing.JButton();
    lbFieldProp = new javax.swing.JLabel();
    lbFieldType = new javax.swing.JLabel();
    cbFieldType = new javax.swing.JComboBox();
    lbFieldLength = new javax.swing.JLabel();
    tfFieldLength = new javax.swing.JTextField();
    lbDefault = new javax.swing.JLabel();
    tfDefault = new javax.swing.JTextField();
    chPrimary = new javax.swing.JCheckBox();
    chIndex = new javax.swing.JCheckBox();
    chUnique = new javax.swing.JCheckBox();
    chBinary = new javax.swing.JCheckBox();
    chNotNull = new javax.swing.JCheckBox();
    chUnsigned = new javax.swing.JCheckBox();
    chAuto = new javax.swing.JCheckBox();
    chZeroFill = new javax.swing.JCheckBox();
    listFields = new javax.swing.JList(new DefaultListModel());
    btCreateTable = new javax.swing.JButton();
    btRemove = new javax.swing.JButton();
    btCancel = new javax.swing.JButton();
    jd =
        new JDialog(
            _session.getApplication().getMainFrame(),
            // i18n[mysql.createTableComm=Create Table...]
            s_stringMgr.getString("mysql.createTableComm"));
    jd.getContentPane().setLayout(null);

    addWindowListener(
        new java.awt.event.WindowAdapter() {
          public void windowClosing(java.awt.event.WindowEvent evt) {
            closeDialog(evt);
          }
        });

    // i18n[mysql.tableNamelbl=Table Name:]
    lbTableName.setText(s_stringMgr.getString("mysql.tableNamelbl"));
    jd.getContentPane().add(lbTableName);
    lbTableName.setBounds(20, 30, 70, 16);

    tfTableName.setText("TableName");
    jd.getContentPane().add(tfTableName);
    tfTableName.setBounds(120, 30, 100, 20);

    lbTableType.setFont(new java.awt.Font("Dialog", 0, 12));
    lbTableType.setText("Table Type:");
    jd.getContentPane().add(lbTableType);
    lbTableType.setBounds(20, 60, 70, 16);

    cbTableType.setFont(new java.awt.Font("Dialog", 0, 12));
    cbTableType.setModel(
        new javax.swing.DefaultComboBoxModel(
            new String[] {"<Automatic>", "ISAM", "MyISAM", "MERGE", "InnoDb", "HEAP", "BDB"}));
    jd.getContentPane().add(cbTableType);
    cbTableType.setBounds(120, 60, 100, 20);

    lbFields.setText("Fields:");
    lbFields.setBorder(new javax.swing.border.EmptyBorder(new java.awt.Insets(1, 1, 1, 1)));
    jd.getContentPane().add(lbFields);
    lbFields.setBounds(10, 120, 40, 18);

    tfFieldName.setText("FieldName");
    tfFieldName.addFocusListener(
        new java.awt.event.FocusAdapter() {
          public void focusGained(java.awt.event.FocusEvent evt) {
            tfFieldNameFocusGained(evt);
          }
        });
    jd.getContentPane().add(tfFieldName);
    tfFieldName.setBounds(10, 150, 110, 20);

    btAdd.setFont(new java.awt.Font("Dialog", 0, 12));
    // i18n[mysql.createAdd=Add]
    btAdd.setText(s_stringMgr.getString("mysql.createAdd"));
    btAdd.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            btAddActionPerformed(evt);
          }
        });

    jd.getContentPane().add(btAdd);
    btAdd.setBounds(130, 150, 80, 26);

    // i18n[mysql.fieldProps=Field Properties:]
    lbFieldProp.setText(s_stringMgr.getString("mysql.fieldProps"));
    lbFieldProp.setBorder(new javax.swing.border.EmptyBorder(new java.awt.Insets(1, 1, 1, 1)));
    jd.getContentPane().add(lbFieldProp);
    lbFieldProp.setBounds(220, 150, 100, 20);

    lbFieldType.setFont(new java.awt.Font("Dialog", 0, 12));
    lbFieldType.setText("Type");
    jd.getContentPane().add(lbFieldType);
    lbFieldType.setBounds(220, 190, 41, 16);

    cbFieldType.setFont(new java.awt.Font("Dialog", 0, 12));
    cbFieldType.setModel(
        new javax.swing.DefaultComboBoxModel(
            new String[] {
              "TINYINT",
              "SMALLINT",
              "MEDIUMINT",
              "INT",
              "BIGINT",
              "FLOAT",
              "DOUBLE",
              "DECIMAL",
              "DATE",
              "DATETIME",
              "TIMESTAMP",
              "TIME",
              "YEAR",
              "CHAR",
              "VARCHAR",
              "TINYBLOB",
              "TINYTEXT",
              "TEXT",
              "BLOB",
              "MEDIUMBLOB",
              "MEDIUMTEXT",
              "LONGBLOB",
              "LONGTEXT",
              "ENUM",
              "SET"
            }));
    cbFieldType.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            cbFieldTypeActionPerformed(evt);
          }
        });
    jd.getContentPane().add(cbFieldType);
    cbFieldType.setBounds(300, 190, 110, 20);

    lbFieldLength.setFont(new java.awt.Font("Dialog", 0, 12));
    // i18n[mysql.lengtSet=Length/Set]
    lbFieldLength.setText(s_stringMgr.getString("mysql.lengtSet"));
    jd.getContentPane().add(lbFieldLength);
    lbFieldLength.setBounds(220, 220, 70, 16);

    jd.getContentPane().add(tfFieldLength);
    tfFieldLength.setBounds(300, 220, 110, 20);

    lbDefault.setFont(new java.awt.Font("Dialog", 0, 12));
    // i18n[mysql.defaultValue=Default Value]
    lbDefault.setText(s_stringMgr.getString("mysql.defaultValue"));
    jd.getContentPane().add(lbDefault);
    lbDefault.setBounds(220, 250, 80, 16);

    jd.getContentPane().add(tfDefault);
    tfDefault.setBounds(300, 250, 110, 20);

    chPrimary.setFont(new java.awt.Font("Dialog", 0, 12));
    chPrimary.setText("Primary");
    chPrimary.addItemListener(
        new java.awt.event.ItemListener() {
          public void itemStateChanged(java.awt.event.ItemEvent evt) {
            chPrimaryItemStateChanged(evt);
          }
        });
    jd.getContentPane().add(chPrimary);
    chPrimary.setBounds(220, 290, 67, 20);

    chIndex.setFont(new java.awt.Font("Dialog", 0, 12));
    chIndex.setText("Index");
    jd.getContentPane().add(chIndex);
    chIndex.setBounds(290, 290, 54, 20);

    chUnique.setFont(new java.awt.Font("Dialog", 0, 12));
    chUnique.setText("Unique");
    jd.getContentPane().add(chUnique);
    chUnique.setBounds(350, 290, 65, 20);

    chBinary.setFont(new java.awt.Font("Dialog", 0, 12));
    chBinary.setText("Binary");
    jd.getContentPane().add(chBinary);
    chBinary.setBounds(220, 320, 70, 20);

    chNotNull.setFont(new java.awt.Font("Dialog", 0, 12));
    chNotNull.setText("Not Null");
    jd.getContentPane().add(chNotNull);
    chNotNull.setBounds(290, 320, 70, 20);

    chUnsigned.setFont(new java.awt.Font("Dialog", 0, 12));
    chUnsigned.setText("Unsigned");
    jd.getContentPane().add(chUnsigned);
    chUnsigned.setBounds(360, 320, 80, 20);

    chAuto.setFont(new java.awt.Font("Dialog", 0, 12));
    chAuto.setText("Auto Increment");
    jd.getContentPane().add(chAuto);
    chAuto.setBounds(220, 350, 110, 20);

    chZeroFill.setFont(new java.awt.Font("Dialog", 0, 12));
    chZeroFill.setText("Zero Fill");
    jd.getContentPane().add(chZeroFill);
    chZeroFill.setBounds(330, 350, 69, 20);

    listFields.addListSelectionListener(
        new javax.swing.event.ListSelectionListener() {
          public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
            listFieldsValueChanged(evt);
          }
        });
    JScrollPane scrollPane = new JScrollPane(listFields);
    jd.getContentPane().add(scrollPane);
    scrollPane.setBounds(10, 190, 110, 150);

    btCreateTable.setFont(new java.awt.Font("Dialog", 0, 12));
    // i18n[mysql.createTableBtn=Create table]
    btCreateTable.setText(s_stringMgr.getString("mysql.createTableBtn"));
    btCreateTable.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            btCreateTableActionPerformed(evt);
          }
        });
    jd.getContentPane().add(btCreateTable);

    btCreateTable.setBounds(221, 380, 110, 26);
    btRemove.setFont(new java.awt.Font("Dialog", 0, 12));
    // i18n[mysql.btRemove=Remove]
    btRemove.setText(s_stringMgr.getString("mysql.btRemove"));
    btRemove.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            btRemoveActionPerformed(evt);
          }
        });
    jd.getContentPane().add(btRemove);
    btRemove.setBounds(130, 190, 80, 26);

    btCancel.setFont(new java.awt.Font("Dialog", 0, 12));
    // i18n[mysql.btCancel=Cancel]
    btCancel.setText(s_stringMgr.getString("mysql.btCancel"));
    btCancel.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            btCancelActionPerformed(evt);
          }
        });

    jd.getContentPane().add(btCancel);
    btCancel.setBounds(340, 380, 73, 26);

    jd.pack();
    jd.setSize(450, 450);
    jd.setLocation(100, 100);
    jd.setVisible(true);
  }
コード例 #14
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();
          }
        });
  }
コード例 #15
0
  public GraphDesktopController(
      GraphDesktopListener listener,
      ISession session,
      GraphPlugin plugin,
      ModeManager modeManager,
      boolean showDndDesktopImageAtStartup) {
    _listener = listener;
    _session = session;
    _plugin = plugin;
    _graphPluginResources = new GraphPluginResources(_plugin);

    ImageIcon startUpImage = null;

    if (showDndDesktopImageAtStartup) {
      startUpImage = _graphPluginResources.getIcon(GraphPluginResources.IKeys.DND);
    }

    _desktopPane = new GraphDesktopPane(_session.getApplication(), startUpImage);
    _desktopPane.setBackground(Color.white);

    _modeManager = modeManager;

    DropTarget dt = new DropTarget();

    try {
      dt.addDropTargetListener(
          new DropTargetAdapter() {
            public void drop(DropTargetDropEvent dtde) {
              onTablesDroped(dtde);
            }
          });
    } catch (TooManyListenersException e) {
      throw new RuntimeException(e);
    }

    _desktopPane.setDropTarget(dt);

    _desktopPane.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            onMouseClicked(e);
          }

          public void mousePressed(MouseEvent e) {
            onMousePressed(e);
          }

          public void mouseReleased(MouseEvent e) {
            onMouseReleased(e);
          }
        });

    _desktopPane.addMouseMotionListener(
        new MouseMotionAdapter() {
          public void mouseDragged(MouseEvent e) {
            onMouseDragged(e);
          }
        });

    createPopUp();
  }
コード例 #16
0
 public void reRunTab(ExplainTab tab) {
   SQLExecuterTask executer =
       new SQLExecuterTask(_session, getExplainSql(tab.getQuery()), new SQLExecutionHandler(tab));
   _session.getApplication().getThreadPool().addTask(executer);
 }