Search in sources :

Example 1 with SeparatorMenuItem

use of javafx.scene.control.SeparatorMenuItem in project jabref by JabRef.

the class GroupTreeController method createContextMenuForGroup.

private ContextMenu createContextMenuForGroup(GroupNodeViewModel group) {
    ContextMenu menu = new ContextMenu();
    MenuItem editGroup = new MenuItem(Localization.lang("Edit group"));
    editGroup.setOnAction(event -> {
        menu.hide();
        viewModel.editGroup(group);
    });
    MenuItem addSubgroup = new MenuItem(Localization.lang("Add subgroup"));
    addSubgroup.setOnAction(event -> {
        menu.hide();
        viewModel.addNewSubgroup(group);
    });
    MenuItem removeGroupAndSubgroups = new MenuItem(Localization.lang("Remove group and subgroups"));
    removeGroupAndSubgroups.setOnAction(event -> viewModel.removeGroupAndSubgroups(group));
    MenuItem removeGroupKeepSubgroups = new MenuItem(Localization.lang("Remove group, keep subgroups"));
    removeGroupKeepSubgroups.setOnAction(event -> viewModel.removeGroupKeepSubgroups(group));
    MenuItem removeSubgroups = new MenuItem(Localization.lang("Remove subgroups"));
    removeSubgroups.setOnAction(event -> viewModel.removeSubgroups(group));
    MenuItem addEntries = new MenuItem(Localization.lang("Add selected entries to this group"));
    addEntries.setOnAction(event -> viewModel.addSelectedEntries(group));
    MenuItem removeEntries = new MenuItem(Localization.lang("Remove selected entries from this group"));
    removeEntries.setOnAction(event -> viewModel.removeSelectedEntries(group));
    MenuItem sortAlphabetically = new MenuItem(Localization.lang("Sort all subgroups (recursively)"));
    sortAlphabetically.setOnAction(event -> viewModel.sortAlphabeticallyRecursive(group));
    menu.getItems().add(editGroup);
    menu.getItems().add(new SeparatorMenuItem());
    menu.getItems().addAll(addSubgroup, removeSubgroups, removeGroupAndSubgroups, removeGroupKeepSubgroups);
    menu.getItems().add(new SeparatorMenuItem());
    menu.getItems().addAll(addEntries, removeEntries);
    menu.getItems().add(new SeparatorMenuItem());
    menu.getItems().add(sortAlphabetically);
    return menu;
}
Also used : ContextMenu(javafx.scene.control.ContextMenu) MenuItem(javafx.scene.control.MenuItem) SeparatorMenuItem(javafx.scene.control.SeparatorMenuItem) SeparatorMenuItem(javafx.scene.control.SeparatorMenuItem)

Example 2 with SeparatorMenuItem

use of javafx.scene.control.SeparatorMenuItem in project jabref by JabRef.

the class EditorMenus method getDOIMenu.

public static List<MenuItem> getDOIMenu(TextArea textArea) {
    AbstractAction copyDoiUrlAction = new CopyDoiUrlAction(textArea);
    MenuItem copyDoiUrlMenuItem = new MenuItem((String) copyDoiUrlAction.getValue(Action.NAME));
    copyDoiUrlMenuItem.setOnAction(event -> copyDoiUrlAction.actionPerformed(null));
    List<MenuItem> menuItems = new ArrayList<>();
    menuItems.add(copyDoiUrlMenuItem);
    menuItems.add(new SeparatorMenuItem());
    return menuItems;
}
Also used : ArrayList(java.util.ArrayList) SeparatorMenuItem(javafx.scene.control.SeparatorMenuItem) MenuItem(javafx.scene.control.MenuItem) SeparatorMenuItem(javafx.scene.control.SeparatorMenuItem) AbstractAction(javax.swing.AbstractAction) CopyDoiUrlAction(org.jabref.gui.actions.CopyDoiUrlAction)

Example 3 with SeparatorMenuItem

use of javafx.scene.control.SeparatorMenuItem in project jabref by JabRef.

the class ProtectedTermsMenu method updateFiles.

private void updateFiles() {
    externalFiles.getItems().clear();
    for (ProtectedTermsList list : Globals.protectedTermsLoader.getProtectedTermsLists()) {
        if (!list.isInternalList()) {
            MenuItem fileItem = new MenuItem(list.getDescription());
            fileItem.setOnAction(event -> {
                String selectedText = opener.getSelectedText();
                if ((selectedText != null) && !selectedText.isEmpty()) {
                    list.addProtectedTerm(selectedText);
                }
            });
            externalFiles.getItems().add(fileItem);
        }
    }
    externalFiles.getItems().add(new SeparatorMenuItem());
    MenuItem addToNewFileItem = new MenuItem(Localization.lang("New") + "...");
    addToNewFileItem.setOnAction(event -> {
        NewProtectedTermsFileDialog dialog = new NewProtectedTermsFileDialog(JabRefGUI.getMainFrame(), Globals.protectedTermsLoader);
        dialog.setVisible(true);
        if (dialog.isOKPressed()) {
            Globals.prefs.setProtectedTermsPreferences(Globals.protectedTermsLoader);
        }
    });
    externalFiles.getItems().add(addToNewFileItem);
}
Also used : ProtectedTermsList(org.jabref.logic.protectedterms.ProtectedTermsList) NewProtectedTermsFileDialog(org.jabref.gui.protectedterms.NewProtectedTermsFileDialog) SeparatorMenuItem(javafx.scene.control.SeparatorMenuItem) MenuItem(javafx.scene.control.MenuItem) SeparatorMenuItem(javafx.scene.control.SeparatorMenuItem)

Example 4 with SeparatorMenuItem

use of javafx.scene.control.SeparatorMenuItem in project Gargoyle by callakrsos.

the class SqlPane method createTreeContextMenu.

/**
	 * 컨텍스트 메뉴 생성 및 기능 적용
	 *
	 *
	 * 2016-10-27 키 이벤트를 setAccelerator를 사용하지않고 이벤트 방식으로 변경 이유 : 도킹기능을 적용하하면
	 * setAccelerator에 등록된 이벤트가 호출안됨
	 *
	 * @param schemaTree2
	 */
private void createTreeContextMenu(TreeView<K> schemaTree) {
    MenuItem menuSelectScript = new MenuItem("Select Script");
    menuSelectScript.setOnAction(this::applySelectScript);
    MenuItem menuUpdateScript = new MenuItem("Update Script");
    menuUpdateScript.setOnAction(this::applyUpdateScript);
    MenuItem menuDeleteScript = new MenuItem("Delete Script");
    menuDeleteScript.setOnAction(this::applyDeleteSelectScript);
    MenuItem menuInsertScript = new MenuItem("Insert Script");
    menuInsertScript.setOnAction(this::applyInsertScript);
    Menu menu = new Menu("Script", null, menuSelectScript, menuUpdateScript, menuDeleteScript, menuInsertScript);
    // MenuItem menuPrimaryKeys = new MenuItem("Primary Keys");
    MenuItem menuShowData = new MenuItem("Show 100 rows [F1]");
    menuShowData.setOnAction(this::show100RowAction);
    MenuItem menuEditShowData = new MenuItem("Show Editable View  [CTRL + F1]");
    menuEditShowData.setOnAction(this::menuEditShowDataAction);
    MenuItem menuFindTable = new MenuItem("Find Table [CTRL + SHIFT + R]");
    // menuFindTable.setAccelerator(new KeyCodeCombination(KeyCode.R,
    // KeyCombination.CONTROL_DOWN));
    menuFindTable.setOnAction(this::showFileTableOnAction);
    MenuItem menuProperties = new MenuItem("Properties");
    menuProperties.setOnAction(this::showProperties);
    MenuItem menuReflesh = new MenuItem("Reflesh [F5]");
    // menuReflesh.setOnAction(this::menuRefleshOnAction);
    menuReflesh.setAccelerator(new KeyCodeCombination(KeyCode.F5));
    ContextMenu contextMenu = new ContextMenu(menu, menuShowData, menuEditShowData, menuFindTable, menuProperties, new SeparatorMenuItem(), menuReflesh);
    schemaTree.setContextMenu(contextMenu);
}
Also used : MenuItem(javafx.scene.control.MenuItem) SeparatorMenuItem(javafx.scene.control.SeparatorMenuItem) KeyCodeCombination(javafx.scene.input.KeyCodeCombination) ContextMenu(javafx.scene.control.ContextMenu) Menu(javafx.scene.control.Menu) ContextMenu(javafx.scene.control.ContextMenu) SeparatorMenuItem(javafx.scene.control.SeparatorMenuItem)

Example 5 with SeparatorMenuItem

use of javafx.scene.control.SeparatorMenuItem in project Gargoyle by callakrsos.

the class JavaCodeAreaHelper method createMenus.

/**
	 * 메뉴 생성
	 * @작성자 : KYJ
	 * @작성일 : 2016. 10. 6.
	 */
@Override
public void createMenus() {
    super.createMenus();
    menuPmd = new Menu("PMD");
    menuRunPmd = new MenuItem("Run PMD");
    menuAutoComment = new MenuItem("Auto Comment");
    menuRunPmd.setOnAction(this);
    menuAutoComment.setOnAction(this);
    menuPmd.getItems().addAll(menuRunPmd);
    codeArea.getContextMenu().getItems().addAll(menuPmd, new SeparatorMenuItem(), menuAutoComment);
}
Also used : MenuItem(javafx.scene.control.MenuItem) SeparatorMenuItem(javafx.scene.control.SeparatorMenuItem) Menu(javafx.scene.control.Menu) SeparatorMenuItem(javafx.scene.control.SeparatorMenuItem)

Aggregations

SeparatorMenuItem (javafx.scene.control.SeparatorMenuItem)26 MenuItem (javafx.scene.control.MenuItem)24 ContextMenu (javafx.scene.control.ContextMenu)15 Menu (javafx.scene.control.Menu)12 ArrayList (java.util.ArrayList)10 List (java.util.List)8 ObservableList (javafx.collections.ObservableList)8 Collectors (java.util.stream.Collectors)7 Label (javafx.scene.control.Label)7 VBox (javafx.scene.layout.VBox)7 File (java.io.File)6 Scene (javafx.scene.Scene)6 IOException (java.io.IOException)5 FXCollections (javafx.collections.FXCollections)5 Insets (javafx.geometry.Insets)5 Node (javafx.scene.Node)4 TextField (javafx.scene.control.TextField)4 Arrays (java.util.Arrays)3 Map (java.util.Map)3 Optional (java.util.Optional)3