JComponent () { if (myCenterPanel == null) { myCenterPanel = new JPanel(new GridBagLayout()); final GridBagConstraints centralGb = createConstraints(); myPatchFileLabel = new JLabel(VcsBundle.message("patch.apply.file.name.field")); myPatchFileLabel.setLabelFor(myPatchFile); myCenterPanel.add(myPatchFileLabel, centralGb); centralGb.fill = GridBagConstraints.HORIZONTAL; ++centralGb.gridy; myCenterPanel.add(myPatchFile, centralGb); JPanel treePanel = new JPanel(new GridBagLayout()); final GridBagConstraints gb = createConstraints(); final DefaultActionGroup group = new DefaultActionGroup(); final MyShowDiff diffAction = new MyShowDiff(); diffAction.registerCustomShortcutSet(CommonShortcuts.getDiff(), getRootPane()); group.add(diffAction); ActionGroup mapDirectoryActionGroup = new ActionGroup(VcsBundle.message("patch.apply.change.directory.paths.group"), null, AllIcons.Vcs.Folders) { @Override public AnAction @NotNull [] getChildren(@Nullable AnActionEvent e) { return new AnAction[]{ new MapDirectory(), new StripUp(IdeBundle.messagePointer("action.Anonymous.text.remove.leading.directory")), new ZeroStrip(), new StripDown(IdeBundle.messagePointer("action.Anonymous.text.restore.leading.directory")), new ResetStrip()}; } }; mapDirectoryActionGroup.setPopup(true); group.add(mapDirectoryActionGroup); if (myCanChangePatchFile) { group.add(new DumbAwareAction(VcsBundle.messagePointer("action.DumbAware.ApplyPatchDifferentiatedDialog.text.refresh"), VcsBundle.messagePointer("action.DumbAware.ApplyPatchDifferentiatedDialog.description.refresh"), AllIcons.Actions.Refresh) { @Override public void actionPerformed(@NotNull AnActionEvent e) { syncUpdatePatchFileAndScheduleReloadIfNeeded(null); } }); } group.add(Separator.getInstance()); group.add(ActionManager.getInstance().getAction(ChangesTree.GROUP_BY_ACTION_GROUP)); final ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("APPLY_PATCH", group, true); TreeActionsToolbarPanel toolbarPanel = new TreeActionsToolbarPanel(toolbar, myChangesTreeList); gb.fill = GridBagConstraints.HORIZONTAL; treePanel.add(toolbarPanel, gb); ++gb.gridy; gb.weighty = 1; gb.fill = GridBagConstraints.BOTH; JPanel changeTreePanel = JBUI.Panels.simplePanel(myChangesTreeLoadingPanel).addToTop(myErrorNotificationPanel); treePanel.add(ScrollPaneFactory.createScrollPane(changeTreePanel), gb); ++gb.gridy; gb.weighty = 0; gb.fill = GridBagConstraints.NONE; gb.insets.bottom = UIUtil.DEFAULT_VGAP; treePanel.add(myCommitLegendPanel.getComponent(), gb); ++gb.gridy; ++centralGb.gridy; centralGb.weighty = 1; centralGb.fill = GridBagConstraints.BOTH; if (myChangeListChooser != null) { Splitter splitter = new Splitter(true, 0.7f); splitter.setFirstComponent(treePanel); splitter.setSecondComponent(myChangeListChooser); myCenterPanel.add(splitter, centralGb); } else { myCenterPanel.add(treePanel, centralGb); } } return myCenterPanel; }