Example #1
0
  public void actionPerformed(ActionEvent e) {
    int[] bounds = _panel.getSQLEntryPanel().getBoundsOfSQLToBeExecuted();

    if (bounds[0] == bounds[1]) {
      return;
    }

    String sqlToBeExecuted = _panel.getSQLEntryPanel().getSQLToBeExecuted();

    StringSelection contents = new StringSelection(sqlToBeExecuted);
    Toolkit.getDefaultToolkit().getSystemClipboard().setContents(contents, contents);
  }
 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");
   }
 }
Example #3
0
 public void setSQLPanel(ISQLPanelAPI panel) {
   if (null != panel) {
     _session = panel.getSession();
   } else {
     _session = null;
   }
   setEnabled(null != _session);
 }
  public void actionPerformed(ActionEvent e) {
    if (null == _panel) {
      return;
    }

    RecentFilesController recentFilesController = new RecentFilesController(_panel);
    File fileToOpen = recentFilesController.getFileToOpen();

    if (null != fileToOpen) {
      _panel.fileOpen(fileToOpen, recentFilesController.isAppend());
    }
  }
Example #5
0
  private void configureRichTextAction(
      ISQLPanelAPI sqlPanelAPI,
      SquirrelRSyntaxTextArea rsEdit,
      String rtaKey,
      KeyStroke acceleratorKeyStroke,
      String acceleratorDescription,
      String shortDescription) {
    Action action = SquirreLRSyntaxTextAreaUI.getActionForName(rsEdit, rtaKey);
    action.putValue(Resources.ACCELERATOR_STRING, acceleratorDescription);

    action.putValue(Action.SHORT_DESCRIPTION, shortDescription);
    action.putValue(Action.MNEMONIC_KEY, 0);
    action.putValue(Action.ACCELERATOR_KEY, acceleratorKeyStroke);

    JMenuItem mnu = sqlPanelAPI.addToSQLEntryAreaMenu(action);
    mnu.setText((String) action.getValue(Action.SHORT_DESCRIPTION));
    _resources.configureMenuItem(action, mnu);
  }
Example #6
0
  private void completeSqlPanelEntryAreaMenu(ActionCollection coll, ISQLPanelAPI sqlPanelAPI) {
    JMenuItem mnuUnmark = sqlPanelAPI.addToSQLEntryAreaMenu(coll.get(UnmarkAction.class));
    _resources.configureMenuItem(coll.get(UnmarkAction.class), mnuUnmark);

    JMenuItem mnuComment = sqlPanelAPI.addToSQLEntryAreaMenu(coll.get(CommentAction.class));
    _resources.configureMenuItem(coll.get(CommentAction.class), mnuComment);
    JMenuItem mnuUncomment = sqlPanelAPI.addToSQLEntryAreaMenu(coll.get(UncommentAction.class));
    _resources.configureMenuItem(coll.get(UncommentAction.class), mnuUncomment);

    if (sqlPanelAPI.getSQLEntryPanel().getTextComponent() instanceof SquirrelRSyntaxTextArea) {

      JMenuItem mnuCopyToRtf =
          sqlPanelAPI.addToSQLEntryAreaMenu(coll.get(SquirrelCopyAsRtfAction.class));
      _resources.configureMenuItem(coll.get(SquirrelCopyAsRtfAction.class), mnuCopyToRtf);

      SquirrelRSyntaxTextArea rsEdit =
          (SquirrelRSyntaxTextArea) sqlPanelAPI.getSQLEntryPanel().getTextComponent();

      configureRichTextAction(
          sqlPanelAPI,
          rsEdit,
          RTextAreaEditorKit.rtaUpperSelectionCaseAction,
          SquirreLRSyntaxTextAreaUI.RS_ACCELERATOR_KEY_STROKE_TO_UPPER_CASE,
          SquirreLRSyntaxTextAreaUI.RS_ACCELERATOR_STRING_TO_UPPER_CASE,
          s_stringMgr.getString("SyntaxPlugin.ToUpperShortDescription"));
      configureRichTextAction(
          sqlPanelAPI,
          rsEdit,
          RTextAreaEditorKit.rtaLowerSelectionCaseAction,
          SquirreLRSyntaxTextAreaUI.RS_ACCELERATOR_KEY_STROKE_TO_LOWER_CASE,
          SquirreLRSyntaxTextAreaUI.RS_ACCELERATOR_STRING_TO_LOWER_CASE,
          s_stringMgr.getString("SyntaxPlugin.ToLowerShortDescription"));

      configureRichTextAction(
          sqlPanelAPI,
          rsEdit,
          RTextAreaEditorKit.rtaLineUpAction,
          SquirreLRSyntaxTextAreaUI.RS_ACCELERATOR_KEY_STROKE_LINE_UP,
          SquirreLRSyntaxTextAreaUI.RS_ACCELERATOR_LINE_UP,
          s_stringMgr.getString("SyntaxPlugin.LineUpShortDescription"));
      configureRichTextAction(
          sqlPanelAPI,
          rsEdit,
          RTextAreaEditorKit.rtaLineDownAction,
          SquirreLRSyntaxTextAreaUI.RS_ACCELERATOR_KEY_STROKE_LINE_DOWN,
          SquirreLRSyntaxTextAreaUI.RS_ACCELERATOR_LINE_DOWN,
          s_stringMgr.getString("SyntaxPlugin.LineDownShortDescription"));
    }
  }