示例#1
0
 /** Creates a new instance of SaveAllAction */
 public SaveAllAction(JabRefFrame frame) {
   super(IconTheme.getImage("saveAll"));
   this.frame = frame;
   putValue(Action.ACCELERATOR_KEY, Globals.prefs.getKey("Save all"));
   putValue(Action.SHORT_DESCRIPTION, Localization.lang("Save all open databases"));
   putValue(Action.NAME, Localization.menuTitle("Save all"));
 }
示例#2
0
  public RightClickMenu(JabRefFrame frame, BasePanel panel) {
    this.panel = panel;
    JMenu typeMenu = new ChangeEntryTypeMenu().getChangeEntryTypeMenu(panel);
    // Are multiple entries selected?
    boolean multiple = areMultipleEntriesSelected();

    // If only one entry is selected, get a reference to it for adapting the menu.
    BibEntry be = null;
    if (panel.getMainTable().getSelectedRowCount() == 1) {
      be = panel.getMainTable().getSelected().get(0);
    }

    addPopupMenuListener(this);

    JMenu copySpecialMenu = new JMenu(Localization.lang("Copy") + "...");
    copySpecialMenu.add(new GeneralAction(Actions.COPY_KEY, Localization.lang("Copy BibTeX key")));
    copySpecialMenu.add(
        new GeneralAction(Actions.COPY_CITE_KEY, Localization.lang("Copy \\cite{BibTeX key}")));
    copySpecialMenu.add(
        new GeneralAction(
            Actions.COPY_KEY_AND_TITLE, Localization.lang("Copy BibTeX key and title")));
    copySpecialMenu.add(
        new GeneralAction(
            Actions.EXPORT_TO_CLIPBOARD,
            Localization.lang("Export to clipboard"),
            IconTheme.JabRefIcon.EXPORT_TO_CLIPBOARD.getSmallIcon()));

    add(
        new GeneralAction(
            Actions.COPY, Localization.lang("Copy"), IconTheme.JabRefIcon.COPY.getSmallIcon()));
    add(copySpecialMenu);
    add(
        new GeneralAction(
            Actions.PASTE, Localization.lang("Paste"), IconTheme.JabRefIcon.PASTE.getSmallIcon()));
    add(
        new GeneralAction(
            Actions.CUT, Localization.lang("Cut"), IconTheme.JabRefIcon.CUT.getSmallIcon()));
    add(
        new GeneralAction(
            Actions.DELETE,
            Localization.lang("Delete"),
            IconTheme.JabRefIcon.DELETE_ENTRY.getSmallIcon()));
    add(
        new GeneralAction(
            Actions.PRINT_PREVIEW,
            Localization.lang("Print entry preview"),
            IconTheme.JabRefIcon.PRINTED.getSmallIcon()));
    addSeparator();

    add(
        new GeneralAction(
            Actions.SEND_AS_EMAIL,
            Localization.lang("Send as email"),
            IconTheme.JabRefIcon.EMAIL.getSmallIcon()));
    addSeparator();

    JMenu markSpecific = JabRefFrame.subMenu(Localization.menuTitle("Mark specific color"));
    for (int i = 0; i < EntryMarker.MAX_MARKING_LEVEL; i++) {
      markSpecific.add(new MarkEntriesAction(frame, i).getMenuItem());
    }

    if (multiple) {
      add(
          new GeneralAction(
              Actions.MARK_ENTRIES,
              Localization.lang("Mark entries"),
              IconTheme.JabRefIcon.MARK_ENTRIES.getSmallIcon()));
      add(markSpecific);
      add(
          new GeneralAction(
              Actions.UNMARK_ENTRIES,
              Localization.lang("Unmark entries"),
              IconTheme.JabRefIcon.UNMARK_ENTRIES.getSmallIcon()));
    } else if (be != null) {
      Optional<String> marked = be.getFieldOptional(FieldName.MARKED_INTERNAL);
      // We have to check for "" too as the marked field may be empty
      if ((!marked.isPresent()) || marked.get().isEmpty()) {
        add(
            new GeneralAction(
                Actions.MARK_ENTRIES,
                Localization.lang("Mark entry"),
                IconTheme.JabRefIcon.MARK_ENTRIES.getSmallIcon()));
        add(markSpecific);
      } else {
        add(markSpecific);
        add(
            new GeneralAction(
                Actions.UNMARK_ENTRIES,
                Localization.lang("Unmark entry"),
                IconTheme.JabRefIcon.UNMARK_ENTRIES.getSmallIcon()));
      }
    }

    if (Globals.prefs.getBoolean(JabRefPreferences.PREF_SPECIALFIELDSENABLED)) {
      if (Globals.prefs.getBoolean(JabRefPreferences.PREF_SHOWCOLUMN_RANKING)) {
        JMenu rankingMenu = new JMenu();
        RightClickMenu.populateSpecialFieldMenu(rankingMenu, Rank.getInstance(), frame);
        add(rankingMenu);
      }

      // TODO: multiple handling for relevance and quality-assurance
      // if multiple values are selected ("if (multiple)"), two options (set / clear) should be
      // offered
      // if one value is selected either set or clear should be offered
      if (Globals.prefs.getBoolean(JabRefPreferences.PREF_SHOWCOLUMN_RELEVANCE)) {
        add(Relevance.getInstance().getValues().get(0).getMenuAction(frame));
      }
      if (Globals.prefs.getBoolean(JabRefPreferences.PREF_SHOWCOLUMN_QUALITY)) {
        add(Quality.getInstance().getValues().get(0).getMenuAction(frame));
      }
      if (Globals.prefs.getBoolean(JabRefPreferences.PREF_SHOWCOLUMN_PRINTED)) {
        add(Printed.getInstance().getValues().get(0).getMenuAction(frame));
      }

      if (Globals.prefs.getBoolean(JabRefPreferences.PREF_SHOWCOLUMN_PRIORITY)) {
        JMenu priorityMenu = new JMenu();
        RightClickMenu.populateSpecialFieldMenu(priorityMenu, Priority.getInstance(), frame);
        add(priorityMenu);
      }

      if (Globals.prefs.getBoolean(JabRefPreferences.PREF_SHOWCOLUMN_READ)) {
        JMenu readStatusMenu = new JMenu();
        RightClickMenu.populateSpecialFieldMenu(readStatusMenu, ReadStatus.getInstance(), frame);
        add(readStatusMenu);
      }
    }

    addSeparator();

    add(
        new GeneralAction(Actions.OPEN_FOLDER, Localization.lang("Open folder")) {
          {
            if (!isFieldSetForSelectedEntry(FieldName.FILE)) {
              this.setEnabled(false);
            }
          }
        });

    add(
        new GeneralAction(
            Actions.OPEN_EXTERNAL_FILE,
            Localization.lang("Open file"),
            getFileIconForSelectedEntry()) {
          {
            if (!isFieldSetForSelectedEntry(FieldName.FILE)) {
              this.setEnabled(false);
            }
          }
        });

    add(
        new GeneralAction(
            Actions.OPEN_URL,
            Localization.lang("Open URL or DOI"),
            IconTheme.JabRefIcon.WWW.getSmallIcon()) {
          {
            if (!(isFieldSetForSelectedEntry(FieldName.URL)
                || isFieldSetForSelectedEntry(FieldName.DOI))) {
              this.setEnabled(false);
            }
          }
        });

    addSeparator();

    add(typeMenu);

    add(
        new GeneralAction(
            Actions.MERGE_WITH_FETCHED_ENTRY,
            Localization.lang(
                "Get BibTeX data from %0", FetchAndMergeEntry.getDisplayNameOfSupportedFields())) {
          {
            if (!(isAnyFieldSetForSelectedEntry(FetchAndMergeEntry.SUPPORTED_FIELDS))) {
              this.setEnabled(false);
            }
          }
        });
    add(frame.getMassSetField());
    add(
        new GeneralAction(
            Actions.ADD_FILE_LINK,
            Localization.lang("Attach file"),
            IconTheme.JabRefIcon.ATTACH_FILE.getSmallIcon()));
    add(frame.getManageKeywords());
    add(
        new GeneralAction(
            Actions.MERGE_ENTRIES,
            Localization.lang("Merge entries") + "...",
            IconTheme.JabRefIcon.MERGE_ENTRIES.getSmallIcon()) {

          {
            if (!(areExactlyTwoEntriesSelected())) {
              this.setEnabled(false);
            }
          }
        });

    addSeparator(); // for "add/move/remove to/from group" entries (appended here)

    groupAdd =
        new JMenuItem(new GeneralAction(Actions.ADD_TO_GROUP, Localization.lang("Add to group")));
    add(groupAdd);
    groupRemove =
        new JMenuItem(
            new GeneralAction(Actions.REMOVE_FROM_GROUP, Localization.lang("Remove from group")));
    add(groupRemove);

    groupMoveTo = add(new GeneralAction(Actions.MOVE_TO_GROUP, Localization.lang("Move to group")));
    add(groupMoveTo);

    // create disabledIcons for all menu entries
    frame.createDisabledIconsForMenuEntries(this);
  }
示例#3
0
 public DbImpAction() {
   super();
   putValue(Action.NAME, Localization.menuTitle("Import from external SQL database"));
 }
示例#4
0
 public DonateAction() {
   super(Localization.menuTitle("Donate to JabRef"));
   putValue(Action.SHORT_DESCRIPTION, Localization.lang("Donate to JabRef"));
   putValue(Action.SMALL_ICON, IconTheme.JabRefIcon.DONATE.getSmallIcon());
   putValue(Action.LARGE_ICON_KEY, IconTheme.JabRefIcon.DONATE.getIcon());
 }
示例#5
0
 @Override
 public String getTitle() {
   return Localization.menuTitle(getKeyName());
 }
 public ForkMeOnGitHubAction() {
   super(Localization.menuTitle("Fork me on GitHub"));
   putValue(Action.SHORT_DESCRIPTION, Localization.lang("Opens JabRef's GitHub page"));
 }
 public EditExternalFileTypesAction(JDialog dialog) {
   super();
   putValue(Action.NAME, Localization.menuTitle("Manage external file types"));
   this.dialog = dialog;
 }
 public EditExternalFileTypesAction(JabRefFrame frame) {
   super();
   putValue(Action.NAME, Localization.menuTitle("Manage external file types"));
   this.frame = frame;
 }