use of com.intellij.openapi.actionSystem.ActionPopupMenu in project intellij-community by JetBrains.
the class StripeButton method showPopup.
private void showPopup(final Component component, final int x, final int y) {
final ActionGroup group = myDecorator.createPopupGroup();
final ActionPopupMenu popupMenu = ActionManager.getInstance().createActionPopupMenu(ActionPlaces.UNKNOWN, group);
popupMenu.getComponent().show(component, x, y);
}
use of com.intellij.openapi.actionSystem.ActionPopupMenu in project intellij-community by JetBrains.
the class TodoCheckinHandler method getBeforeCheckinConfigurationPanel.
@Override
public RefreshableOnComponent getBeforeCheckinConfigurationPanel() {
JCheckBox checkBox = new JCheckBox(VcsBundle.message("before.checkin.new.todo.check", ""));
return new RefreshableOnComponent() {
@Override
public JComponent getComponent() {
JPanel panel = new JPanel(new BorderLayout(4, 0));
panel.add(checkBox, BorderLayout.WEST);
setFilterText(myConfiguration.myTodoPanelSettings.todoFilterName);
if (myConfiguration.myTodoPanelSettings.todoFilterName != null) {
myTodoFilter = TodoConfiguration.getInstance().getTodoFilter(myConfiguration.myTodoPanelSettings.todoFilterName);
}
Consumer<TodoFilter> consumer = todoFilter -> {
myTodoFilter = todoFilter;
String name = todoFilter == null ? null : todoFilter.getName();
myConfiguration.myTodoPanelSettings.todoFilterName = name;
setFilterText(name);
};
LinkLabel linkLabel = new LinkLabel("Configure", null);
linkLabel.setListener(new LinkListener() {
@Override
public void linkSelected(LinkLabel aSource, Object aLinkData) {
DefaultActionGroup group = SetTodoFilterAction.createPopupActionGroup(myProject, myConfiguration.myTodoPanelSettings, consumer);
ActionPopupMenu popupMenu = ActionManager.getInstance().createActionPopupMenu(ActionPlaces.TODO_VIEW_TOOLBAR, group);
popupMenu.getComponent().show(linkLabel, 0, linkLabel.getHeight());
}
}, null);
panel.add(linkLabel, BorderLayout.CENTER);
CheckinHandlerUtil.disableWhenDumb(myProject, checkBox, "TODO check is impossible until indices are up-to-date");
return panel;
}
private void setFilterText(String filterName) {
if (filterName == null) {
checkBox.setText(VcsBundle.message("before.checkin.new.todo.check", IdeBundle.message("action.todo.show.all")));
} else {
checkBox.setText(VcsBundle.message("before.checkin.new.todo.check", "Filter: " + filterName));
}
}
@Override
public void refresh() {
}
@Override
public void saveState() {
myConfiguration.CHECK_NEW_TODO = checkBox.isSelected();
}
@Override
public void restoreState() {
checkBox.setSelected(myConfiguration.CHECK_NEW_TODO);
}
};
}
use of com.intellij.openapi.actionSystem.ActionPopupMenu in project intellij-community by JetBrains.
the class CopyOptionsDialog method createUI.
private void createUI() {
myMainPanel = new JPanel(new BorderLayout());
myBrowser = new RepositoryBrowserComponent(SvnVcs.getInstance(myProject));
final DefaultActionGroup group = new DefaultActionGroup();
group.add(new RepositoryBrowserDialog.MkDirAction(myBrowser) {
@Override
public void update(AnActionEvent e) {
super.update(e);
e.getPresentation().setText("New Remote Folder...");
}
});
group.add(new RepositoryBrowserDialog.DeleteAction(myBrowser));
group.add(new RepositoryBrowserDialog.RefreshAction(myBrowser));
final ActionPopupMenu popupMenu = ActionManager.getInstance().createActionPopupMenu("", group);
final JPopupMenu component = popupMenu.getComponent();
myBrowser.getRepositoryTree().addMouseListener(new PopupHandler() {
@Override
public void invokePopup(Component comp, int x, int y) {
component.show(comp, x, y);
}
});
final Splitter splitter = new Splitter(true);
splitter.setProportion(0.7f);
final JPanel wrapper = createBrowserPartWrapper();
splitter.setFirstComponent(wrapper);
final JPanel commitMessageWrapper = createCommitMessageWrapper();
splitter.setSecondComponent(commitMessageWrapper);
myMainPanel.add(splitter, BorderLayout.CENTER);
final JPanel recentMessagesWrapper = new JPanel(new BorderLayout());
recentMessagesWrapper.add(new JLabel("Recent Messages:"), BorderLayout.NORTH);
myMessagesBox = new JComboBox();
recentMessagesWrapper.add(myMessagesBox, BorderLayout.SOUTH);
recentMessagesWrapper.setBorder(JBUI.Borders.emptyTop(4));
myMainPanel.add(recentMessagesWrapper, BorderLayout.SOUTH);
}
use of com.intellij.openapi.actionSystem.ActionPopupMenu in project intellij-community by JetBrains.
the class SelectCreateExternalTargetDialog method createPopup.
protected JPopupMenu createPopup(boolean toolWindow) {
DefaultActionGroup group = new DefaultActionGroup();
DefaultActionGroup newGroup = new DefaultActionGroup("_New", true);
final RepositoryBrowserComponent browser = getRepositoryBrowser();
newGroup.add(new AddLocationAction(browser));
newGroup.add(new MkDirAction(browser));
group.add(newGroup);
group.addSeparator();
group.add(new RefreshAction(browser));
group.add(new DiscardLocationAction(browser));
ActionPopupMenu menu = ActionManager.getInstance().createActionPopupMenu("", group);
return menu.getComponent();
}
use of com.intellij.openapi.actionSystem.ActionPopupMenu in project intellij-community by JetBrains.
the class SelectionTool method handlePopup.
@Override
protected void handlePopup() {
ActionManager actionManager = ActionManager.getInstance();
ActionPopupMenu popupMenu = actionManager.createActionPopupMenu(myArea.getPopupPlace(), myArea.getPopupActions());
MouseEvent event = (MouseEvent) myInputEvent;
popupMenu.getComponent().show(myArea.getNativeComponent(), event.getX(), event.getY());
}
Aggregations