Exemplo n.º 1
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"));
    }
  }
Exemplo n.º 2
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);
  }