JComponent () { myClassTree = new Tree(); myClassTree.setRootVisible(false); myClassTree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent e) { final TreePath leadSelectionPath = e.getNewLeadSelectionPath(); if (leadSelectionPath == null) return; final DefaultMutableTreeNode node = (DefaultMutableTreeNode)leadSelectionPath.getLastPathComponent(); mySelectedClass = (Class<?>)node.getUserObject(); updateSelectedProperties(); } }); myClassTree.setCellRenderer(new ColoredTreeCellRenderer() { @Override public void customizeCellRenderer(@NotNull JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { DefaultMutableTreeNode node = (DefaultMutableTreeNode)value; if (node.getUserObject() instanceof Class<?> cls) { @NlsSafe String name = cls.getName(); append(name, SimpleTextAttributes.REGULAR_ATTRIBUTES); } } }); fillClassTree(); myPropertiesTable = new JBTable(); myPropertiesTable.setModel(myTableModel); mySplitter = new JBSplitter("ConfigureClientPropertiesDialog.splitterProportion", 0.5f); mySplitter.setFirstComponent( ToolbarDecorator.createDecorator(myClassTree) .setAddAction(new AnActionButtonRunnable() { @Override public void run(AnActionButton button) { ClassNameInputDialog dlg = new ClassNameInputDialog(myProject, mySplitter); dlg.show(); if (dlg.getExitCode() == OK_EXIT_CODE) { String className = dlg.getClassName(); if (className.isEmpty()) return; final Class<?> aClass; try { aClass = Class.forName(className, true, LoaderFactory.getInstance(myProject).getProjectClassLoader()); } catch (ClassNotFoundException ex) { Messages.showErrorDialog(mySplitter, UIDesignerBundle.message("client.properties.class.not.found", className), UIDesignerBundle.message("client.properties.title")); return; } if (!JComponent.class.isAssignableFrom(aClass)) { Messages.showErrorDialog(mySplitter, UIDesignerBundle .message("client.properties.class.not.component", className), UIDesignerBundle.message("client.properties.title")); return; } myManager.addClientPropertyClass(className); fillClassTree(); } } }).setRemoveAction(new AnActionButtonRunnable() { @Override public void run(AnActionButton button) { if (mySelectedClass != null) { myManager.removeClientPropertyClass(mySelectedClass); fillClassTree(); } } }).setToolbarPosition(SystemInfo.isMac ? ActionToolbarPosition.BOTTOM : ActionToolbarPosition.RIGHT).createPanel()); mySplitter.setSecondComponent( ToolbarDecorator.createDecorator(myPropertiesTable).disableUpDownActions() .setAddAction(new AnActionButtonRunnable() { @Override public void run(AnActionButton button) { AddClientPropertyDialog dlg = new AddClientPropertyDialog(myProject); dlg.show(); if (dlg.getExitCode() == OK_EXIT_CODE) { for (ClientPropertiesManager.ClientProperty prop : myManager.getClientProperties(mySelectedClass)) { if (prop.getName().equalsIgnoreCase(dlg.getEnteredProperty().getName())) { Messages.showErrorDialog(mySplitter, UIDesignerBundle.message("client.properties.already.defined", prop.getName()), UIDesignerBundle.message("client.properties.title")); return; } } myManager.addConfiguredProperty(mySelectedClass, dlg.getEnteredProperty()); updateSelectedProperties(); } } }).setRemoveAction(new AnActionButtonRunnable() { @Override public void run(AnActionButton button) { int row = myPropertiesTable.getSelectedRow(); if (row >= 0 && row < mySelectedProperties.size()) { myManager.removeConfiguredProperty(mySelectedClass, mySelectedProperties.get(row).getName()); updateSelectedProperties(); if (!mySelectedProperties.isEmpty()) { if (row >= mySelectedProperties.size()) { row--; } myPropertiesTable.getSelectionModel().setSelectionInterval(row, row); } } } }).createPanel()); return mySplitter; }