use of com.intellij.openapi.actionSystem.DefaultActionGroup in project intellij-community by JetBrains.
the class ChangeListViewerDialog method createCenterPanel.
public JComponent createCenterPanel() {
final JPanel mainPanel = new JPanel();
mainPanel.setLayout(new BorderLayout());
final Splitter splitter = new Splitter(true, 0.8f);
myChangesBrowser = new RepositoryChangesBrowser(myProject, Collections.singletonList(myChangeList), new ArrayList<>(myChangeList.getChanges()), myChangeList, myToSelect) {
@Override
protected void buildToolBar(DefaultActionGroup toolBarGroup) {
super.buildToolBar(toolBarGroup);
toolBarGroup.add(ActionManager.getInstance().getAction(VcsActions.ACTION_COPY_REVISION_NUMBER));
}
};
Disposer.register(getDisposable(), myChangesBrowser);
myChangesBrowser.setUseCase(myInAir ? CommittedChangesBrowserUseCase.IN_AIR : null);
splitter.setFirstComponent(myChangesBrowser);
if (myCommitMessageArea != null) {
JPanel commitPanel = new JPanel(new BorderLayout());
JComponent separator = SeparatorFactory.createSeparator(VcsBundle.message("label.commit.comment"), myCommitMessageArea);
commitPanel.add(separator, BorderLayout.NORTH);
commitPanel.add(commitMessageScroll, BorderLayout.CENTER);
splitter.setSecondComponent(commitPanel);
}
mainPanel.add(splitter, BorderLayout.CENTER);
final String description = getDescription();
if (description != null) {
JPanel descPanel = new JPanel();
descPanel.add(new JLabel(XmlStringUtil.wrapInHtml(description)));
descPanel.setBorder(BorderFactory.createEtchedBorder());
mainPanel.add(descPanel, BorderLayout.NORTH);
}
return mainPanel;
}
use of com.intellij.openapi.actionSystem.DefaultActionGroup 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.DefaultActionGroup in project intellij-community by JetBrains.
the class TabLabel method handlePopup.
private void handlePopup(final MouseEvent e) {
if (e.getClickCount() != 1 || !e.isPopupTrigger())
return;
if (e.getX() < 0 || e.getX() >= e.getComponent().getWidth() || e.getY() < 0 || e.getY() >= e.getComponent().getHeight())
return;
String place = myTabs.getPopupPlace();
place = place != null ? place : ActionPlaces.UNKNOWN;
myTabs.myPopupInfo = myInfo;
final DefaultActionGroup toShow = new DefaultActionGroup();
if (myTabs.getPopupGroup() != null) {
toShow.addAll(myTabs.getPopupGroup());
toShow.addSeparator();
}
JBTabsImpl tabs = JBTabsImpl.NAVIGATION_ACTIONS_KEY.getData(DataManager.getInstance().getDataContext(e.getComponent(), e.getX(), e.getY()));
if (tabs == myTabs && myTabs.myAddNavigationGroup) {
toShow.addAll(myTabs.myNavigationActions);
}
if (toShow.getChildrenCount() == 0)
return;
myTabs.myActivePopup = myTabs.myActionManager.createActionPopupMenu(place, toShow).getComponent();
myTabs.myActivePopup.addPopupMenuListener(myTabs.myPopupListener);
myTabs.myActivePopup.addPopupMenuListener(myTabs);
myTabs.myActivePopup.show(e.getComponent(), e.getX(), e.getY());
}
use of com.intellij.openapi.actionSystem.DefaultActionGroup 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.DefaultActionGroup 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();
}
Aggregations