JPanel () { Project[] projects = ProjectManager.getInstance().getOpenProjects(); JPanel panel = new JPanel(new GridBagLayout()); //panel.setBorder(new LineBorder(Color.red)); if (projects.length == 0) return panel; GridBagConstraints gc = new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, JBInsets.emptyInsets(), 0, 0); JButton button = new JButton(LangBundle.message("manage.scopes")); button.setPreferredSize(new Dimension(230, button.getPreferredSize().height)); panel.add(button, gc); gc.gridx = GridBagConstraints.REMAINDER; gc.weightx = 1; panel.add(new JPanel(), gc); gc.gridy++; gc.gridx=0; gc.weighty = 1; panel.add(new JPanel(), gc); button.addActionListener(new ActionListener() { @Override public void actionPerformed(@NotNull ActionEvent e) { DataContext context = DataManager.getInstance().getDataContext(panel); Settings settings = Settings.KEY.getData(context); Project project = CommonDataKeys.PROJECT.getData(context); if (settings != null) { try { if (settings.select(settings.find(ScopeChooserConfigurable.PROJECT_SCOPES)).isRejected()) { EditScopesDialog.showDialog(project, null); } } catch (IllegalStateException ex) { EditScopesDialog.showDialog(project, null); } } } }); return panel; }