• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java JBMenuItem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.intellij.openapi.ui.JBMenuItem的典型用法代码示例。如果您正苦于以下问题:Java JBMenuItem类的具体用法?Java JBMenuItem怎么用?Java JBMenuItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



JBMenuItem类属于com.intellij.openapi.ui包,在下文中一共展示了JBMenuItem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getPopupMenu

import com.intellij.openapi.ui.JBMenuItem; //导入依赖的package包/类
@NotNull
private JPopupMenu getPopupMenu(final PackageTemplateWrapper ptWrapper) {
    JPopupMenu popupMenu = new JBPopupMenu();

    JMenuItem itemAddVariable = new JBMenuItem(Localizer.get("AddVariable"), AllIcons.Nodes.Variable);
    JMenuItem itemDelete = new JBMenuItem(Localizer.get("Delete"), AllIcons.Actions.Delete);

    itemAddVariable.addActionListener(e -> addVariable(ptWrapper));
    itemDelete.addActionListener(e -> deleteVariable(ptWrapper));

    popupMenu.add(itemAddVariable);
    addScriptMenuItems(popupMenu, ptWrapper.getProject());
    if (!getGlobalVariable().getName().equals(ATTRIBUTE_BASE_NAME)) {
        popupMenu.add(itemDelete);
    }
    return popupMenu;
}
 
开发者ID:CeH9,项目名称:PackageTemplates,代码行数:18,代码来源:GlobalVariableWrapper.java


示例2: addRightMouseButtonFunctionality

import com.intellij.openapi.ui.JBMenuItem; //导入依赖的package包/类
private void addRightMouseButtonFunctionality(MouseEvent mouseEvent,
                                              final JBList list,
                                              JBScrollPane panel) {

    logger.info("Adding functionality for right mouse button. @CourseTabFactory");
    if (!SwingUtilities.isRightMouseButton(mouseEvent)) {
        return;
    }

    int index = list.locationToIndex(mouseEvent.getPoint());
    list.setSelectedIndex(index);
    PopUpMenu menu = new PopUpMenu();
    JBMenuItem openInExplorer = new JBMenuItem("Open path");
    final Object selectedItem = list.getSelectedValue();
    JBMenuItem deleteFolder = new JBMenuItem("Delete folder");

    openInExplorer.addActionListener(createOpenInExploreListener(list, selectedItem));

    deleteFolder.addActionListener(createDeleteButtonActionListener(list, selectedItem));

    menu.add(openInExplorer);
    menu.add(deleteFolder);
    menu.show(panel, mouseEvent.getX(), mouseEvent.getY());
    menu.setLocation(mouseEvent.getXOnScreen(), mouseEvent.getYOnScreen());

}
 
开发者ID:testmycode,项目名称:tmc-intellij,代码行数:27,代码来源:CourseTabFactory.java


示例3: createPopupForEditMode

import com.intellij.openapi.ui.JBMenuItem; //导入依赖的package包/类
private void createPopupForEditMode(MouseEvent mouseEvent) {
    JPopupMenu popupMenu = new JBPopupMenu();

    JMenuItem itemAddFile = new JBMenuItem(Localizer.get("AddFile"), AllIcons.FileTypes.Text);
    JMenuItem itemAddDirectory = new JBMenuItem(Localizer.get("AddDirectory"), AllIcons.Nodes.Package);
    JMenuItem itemChangeFileTemplate = new JBMenuItem(Localizer.get("action.ChangeFileTemplate"), AllIcons.Actions.Edit);
    JMenuItem itemDelete = new JBMenuItem(Localizer.get("Delete"), AllIcons.Actions.Delete);

    itemAddFile.addActionListener(e -> AddFile());
    itemAddDirectory.addActionListener(e -> addDirectory());
    itemDelete.addActionListener(e -> deleteElement());

    popupMenu.add(itemAddFile);
    popupMenu.add(itemAddDirectory);

    // if NOT root element
    if (getParent() != null) {
        popupMenu.add(itemDelete);
    }

    // Dir Specific
    if (isDirectory()) {
        //nothing
    } else {
        // File Specific
        itemChangeFileTemplate.addActionListener(e -> changeFileTemplate());
        popupMenu.add(itemChangeFileTemplate);
    }

    addScriptMenuItems(popupMenu);
    addCustomPathMenuItems(popupMenu);
    addWriteRulesMenuItems(popupMenu);

    popupMenu.show(jlName, mouseEvent.getX(), mouseEvent.getY());
}
 
开发者ID:CeH9,项目名称:PackageTemplates,代码行数:36,代码来源:ElementWrapper.java


示例4: addMenuItem

import com.intellij.openapi.ui.JBMenuItem; //导入依赖的package包/类
private void addMenuItem(final String item) {
  if (myNativeSearchPopup != null) {
    myNativeSearchPopup.remove(myNoItems);
    final JMenuItem menuItem = new JBMenuItem(item);
    myNativeSearchPopup.add(menuItem);
    menuItem.addActionListener(new ActionListener() {
      public void actionPerformed(final ActionEvent e) {
        myTextField.setText(item);
        addCurrentTextToHistory();
      }
    });
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:SearchTextField.java


示例5: fillPredefined

import com.intellij.openapi.ui.JBMenuItem; //导入依赖的package包/类
private void fillPredefined(JMenuItem parentMenu) {
  for (final PredefinedCodeStyle predefinedCodeStyle : myPredefinedCodeStyles) {
    JMenuItem predefinedItem = new JBMenuItem(predefinedCodeStyle.getName());
    parentMenu.add(predefinedItem);
    predefinedItem.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
        applyPredefinedStyle(predefinedCodeStyle.getName());
      }
    });
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:TabbedLanguageCodeStylePanel.java


示例6: getMenuItems

import com.intellij.openapi.ui.JBMenuItem; //导入依赖的package包/类
protected List<JBMenuItem> getMenuItems(final ActionListener listener) {
    final List<JBMenuItem> menuItems = new ArrayList<JBMenuItem>();
    menuItems.add(createMenuItem(TfPluginBundle.KEY_VCS_OPEN_IN_BROWSER, null, CMD_OPEN_SELECTED_ITEM_IN_BROWSER, listener));

    // only show create branch option for Git repos
    if (isGitRepo) {
        menuItems.add(createMenuItem(TfPluginBundle.KEY_VCS_WIT_CREATE_BRANCH, null, CMD_CREATE_BRANCH, listener));
    }

    return menuItems;
}
 
开发者ID:Microsoft,项目名称:vso-intellij,代码行数:12,代码来源:VcsWorkItemsForm.java


示例7: showPopupMenu

import com.intellij.openapi.ui.JBMenuItem; //导入依赖的package包/类
/**
 * Display popup menu on the view
 *
 * @param component
 * @param x
 * @param y
 * @param listener
 */
protected void showPopupMenu(final Component component, final int x, final int y, final ActionListener listener) {
    final JBPopupMenu menu = new JBPopupMenu();
    final List<JBMenuItem> openMenuItems = getMenuItems(listener);
    for (JBMenuItem menuItem : openMenuItems) {
        menu.add(menuItem);
    }
    menu.show(component, x, y);
}
 
开发者ID:Microsoft,项目名称:vso-intellij,代码行数:17,代码来源:TabFormImpl.java


示例8: createMenuItem

import com.intellij.openapi.ui.JBMenuItem; //导入依赖的package包/类
private JBMenuItem createMenuItem(final String resourceKey, final Icon icon, final String actionCommand) {
    final String text = TfPluginBundle.message(resourceKey);
    final JBMenuItem menuItem = new JBMenuItem(text, icon);
    menuItem.setActionCommand(actionCommand);
    menuItem.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            menuItemAction(e);
        }
    });

    return menuItem;
}
 
开发者ID:Microsoft,项目名称:vso-intellij,代码行数:14,代码来源:FeedbackAction.java


示例9: testGetMenuItems

import com.intellij.openapi.ui.JBMenuItem; //导入依赖的package包/类
@Test
public void testGetMenuItems() {
    List<JBMenuItem> menuItemList = underTest.getMenuItems(null);
    assertEquals(2, menuItemList.size());
    assertEquals(TabForm.CMD_OPEN_SELECTED_ITEM_IN_BROWSER, menuItemList.get(0).getActionCommand());
    assertEquals(VcsPullRequestsForm.CMD_ABANDON_SELECTED_PR, menuItemList.get(1).getActionCommand());
}
 
开发者ID:Microsoft,项目名称:vso-intellij,代码行数:8,代码来源:VcsPullRequestsFormTest.java


示例10: testGetMenuItems_Git

import com.intellij.openapi.ui.JBMenuItem; //导入依赖的package包/类
@Test
public void testGetMenuItems_Git() {
    List<JBMenuItem> menuItemList = underTest.getMenuItems(null);
    assertEquals(2, menuItemList.size());
    assertEquals(TabForm.CMD_OPEN_SELECTED_ITEM_IN_BROWSER, menuItemList.get(0).getActionCommand());
    assertEquals(VcsWorkItemsForm.CMD_CREATE_BRANCH, menuItemList.get(1).getActionCommand());
}
 
开发者ID:Microsoft,项目名称:vso-intellij,代码行数:8,代码来源:VcsWorkItemsFormTest.java


示例11: testGetMenuItems_TFVC

import com.intellij.openapi.ui.JBMenuItem; //导入依赖的package包/类
@Test
public void testGetMenuItems_TFVC() {
    underTest = spy(new VcsWorkItemsForm(false, mockWorkItemQueryDropDown));

    List<JBMenuItem> menuItemList = underTest.getMenuItems(null);
    assertEquals(1, menuItemList.size());
    assertEquals(TabForm.CMD_OPEN_SELECTED_ITEM_IN_BROWSER, menuItemList.get(0).getActionCommand());
}
 
开发者ID:Microsoft,项目名称:vso-intellij,代码行数:9,代码来源:VcsWorkItemsFormTest.java


示例12: addMenuItem

import com.intellij.openapi.ui.JBMenuItem; //导入依赖的package包/类
private void addMenuItem(final String item) {
  if (myNativeSearchPopup != null) {
    myNativeSearchPopup.remove(myNoItems);
    final JMenuItem menuItem = new JBMenuItem(item);
    myNativeSearchPopup.add(menuItem);
    menuItem.addActionListener(new ActionListener() {
      public void actionPerformed(final ActionEvent e) {
        myTextField.setText(item);
      }
    });
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:13,代码来源:SearchTextField.java


示例13: addMenuItem

import com.intellij.openapi.ui.JBMenuItem; //导入依赖的package包/类
private void addMenuItem(final String item) {
  if (myNativeSearchPopup != null) {
    myNativeSearchPopup.remove(myNoItems);
    final JMenuItem menuItem = new JBMenuItem(item);
    myNativeSearchPopup.add(menuItem);
    menuItem.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(final ActionEvent e) {
        myTextField.setText(item);
        addCurrentTextToHistory();
      }
    });
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:15,代码来源:SearchTextField.java


示例14: addItemToMenu

import com.intellij.openapi.ui.JBMenuItem; //导入依赖的package包/类
public void addItemToMenu(JBMenuItem item) {
    add(item);
}
 
开发者ID:testmycode,项目名称:tmc-intellij,代码行数:4,代码来源:PopUpMenu.java


示例15: createMenuItem

import com.intellij.openapi.ui.JBMenuItem; //导入依赖的package包/类
@NotNull
private static JBMenuItem createMenuItem(@NotNull DeviceUiAction action) {
  JBMenuItem item = new JBMenuItem(action);
  item.setText(action.getText());
  return item;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:DeviceDefinitionList.java


示例16: getMenuItems

import com.intellij.openapi.ui.JBMenuItem; //导入依赖的package包/类
protected List<JBMenuItem> getMenuItems(final ActionListener listener) {
    return Arrays.asList(
            createMenuItem(TfPluginBundle.KEY_VCS_OPEN_IN_BROWSER, null, CMD_OPEN_SELECTED_ITEM_IN_BROWSER, listener),
            createMenuItem(TfPluginBundle.KEY_VCS_PR_ABANDON, null, VcsPullRequestsForm.CMD_ABANDON_SELECTED_PR, listener));
}
 
开发者ID:Microsoft,项目名称:vso-intellij,代码行数:6,代码来源:VcsPullRequestsForm.java


示例17: setUp

import com.intellij.openapi.ui.JBMenuItem; //导入依赖的package包/类
@Before
@SuppressWarnings("unchecked")
public void setUp() {
    underTest = Mockito.spy(new TabFormImpl<WorkItemsTableModel>(TAB_TITLE,
            CREATE_DIALOG_TITLE,
            REFRESH_TOOLTIP,
            TOOLBAR_LOCATION) {
        @Override
        protected void createCustomView() {
            scrollPanel = new JBScrollPane();
        }

        @Override
        protected void addCustomTools(final JPanel panel) {
        }

        @Override
        protected List<JBMenuItem> getMenuItems(ActionListener listener) {
            return null;
        }

        @Override
        public void setModelForView(WorkItemsTableModel modelView) {

        }

        @Override
        public Operation.CredInputsImpl getOperationInputs() {
            return null;
        }

        @Override
        public void refresh(boolean isTeamServicesRepository) {

        }
    });
    underTest.statusLabel = new JLabel();
    underTest.statusLink = new Hyperlink();

    // Mock needed for creating DefaultActionGroup in create group tests
    PowerMockito.mockStatic(ActionManager.class);
    ActionManager actionManager = Mockito.mock(ActionManager.class);
    Mockito.when(ActionManager.getInstance()).thenReturn(actionManager);
}
 
开发者ID:Microsoft,项目名称:vso-intellij,代码行数:45,代码来源:TabFormImplTest.java


示例18: testCreateMenuItem

import com.intellij.openapi.ui.JBMenuItem; //导入依赖的package包/类
@Test
public void testCreateMenuItem() {
    JBMenuItem item = underTest.createMenuItem(TAB_TITLE, null, "action", null);
    assertEquals(TfPluginBundle.message(TAB_TITLE), item.getText());
    assertEquals("action", item.getActionCommand());
}
 
开发者ID:Microsoft,项目名称:vso-intellij,代码行数:7,代码来源:TabFormImplTest.java


示例19: makeMenuItem

import com.intellij.openapi.ui.JBMenuItem; //导入依赖的package包/类
@Override
@Nonnull
public JMenuItem makeMenuItem(@Nonnull final String s, final Icon icon) {
    return new JBMenuItem(s, icon);
}
 
开发者ID:raydac,项目名称:netbeans-mmd-plugin,代码行数:6,代码来源:IdeaUIComponentFactory.java


示例20: createMenuItem

import com.intellij.openapi.ui.JBMenuItem; //导入依赖的package包/类
/**
 * Creates a menu item to use in the popup menu
 *
 * @param resourceKey
 * @param icon
 * @param actionCommand
 * @param listener
 * @return menu item
 */
protected JBMenuItem createMenuItem(final String resourceKey, final Icon icon, final String actionCommand, final ActionListener listener) {
    final String text = TfPluginBundle.message(resourceKey);
    final JBMenuItem menuItem = new JBMenuItem(text, icon);
    menuItem.setActionCommand(actionCommand);
    menuItem.addActionListener(listener);
    return menuItem;
}
 
开发者ID:Microsoft,项目名称:vso-intellij,代码行数:17,代码来源:TabFormImpl.java



注:本文中的com.intellij.openapi.ui.JBMenuItem类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java EnvelopeImpl类代码示例发布时间:2022-05-23
下一篇:
Java Hexdump类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap