Exemple #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"));
    }
  }
Exemple #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);
  }
Exemple #3
0
  private void createMenu() {
    IApplication app = getApplication();
    ActionCollection coll = app.getActionCollection();

    JMenu menu = _resources.createMenu(IMenuResourceKeys.MENU);
    app.addToMenu(IApplication.IMenuIDs.SESSION_MENU, menu);

    Action act = new ConfigureAutoCorrectAction(app, _resources, this);
    coll.add(act);
    _resources.addToMenu(act, menu);

    act = new FindAction(getApplication(), _resources);
    coll.add(act);
    _resources.addToMenu(act, menu);

    act = new FindSelectedAction(getApplication(), _resources);
    coll.add(act);
    _resources.addToMenu(act, menu);

    act = new RepeatLastFindAction(getApplication(), _resources);
    coll.add(act);
    _resources.addToMenu(act, menu);

    act = new MarkSelectedAction(getApplication(), _resources);
    coll.add(act);
    _resources.addToMenu(act, menu);

    act = new ReplaceAction(getApplication(), _resources);
    coll.add(act);
    _resources.addToMenu(act, menu);

    act = new UnmarkAction(getApplication(), _resources);
    coll.add(act);
    _resources.addToMenu(act, menu);

    act = new GoToLineAction(getApplication(), _resources);
    coll.add(act);
    _resources.addToMenu(act, menu);

    act = new DuplicateLineAction(getApplication(), _resources);
    coll.add(act);
    _resources.addToMenu(act, menu);

    act = new CommentAction(getApplication(), _resources);
    coll.add(act);
    _resources.addToMenu(act, menu);

    act = new UncommentAction(getApplication(), _resources);
    coll.add(act);
    _resources.addToMenu(act, menu);
  }