From b6e8770e45c5db55e48948d39861cd89bde929cd Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Wed, 29 Jun 2022 10:51:19 +0200 Subject: [PATCH] ui: better layout in 'Project Libraries' configurable * Remove duplicated border * Remove gap for invisible bottom warning label GitOrigin-RevId: 1635c95fbacf4f0dd8bc413ecf8e7b5c243713f5 --- .../LibraryRootsComponentForm.form | 10 +++++----- .../libraryEditor/LibraryRootsComponent.java | 17 +++++++++++------ 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/LibraryRootsComponentForm.form b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/LibraryRootsComponentForm.form index 1a5cb135c8b6..6eef219fcd5c 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/LibraryRootsComponentForm.form +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/LibraryRootsComponentForm.form @@ -33,14 +33,14 @@ - + - - - - + + + + diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/LibraryRootsComponent.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/LibraryRootsComponent.java index e5066a405e7f..02385c58dc82 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/LibraryRootsComponent.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/LibraryRootsComponent.java @@ -68,10 +68,10 @@ public class LibraryRootsComponent implements Disposable, LibraryEditorComponent private JPanel myTreePanel; private MultiLineLabel myPropertiesLabel; private JPanel myPropertiesPanel; - private JPanel myBottomPanel; + private JLabel myBottomLabel; private LibraryPropertiesEditor myPropertiesEditor; private Tree myTree; - private final ModificationOfImportedModelWarningComponent myModificationOfImportedModelWarningComponent; + private ModificationOfImportedModelWarningComponent myModificationOfImportedModelWarningComponent; private VirtualFile myLastChosen; private final Collection myListeners = ContainerUtil.createLockFreeCopyOnWriteList(); @@ -105,8 +105,6 @@ public class LibraryRootsComponent implements Disposable, LibraryEditorComponent myDescriptor = new DefaultLibraryRootsComponentDescriptor(); } myRootRemovalHandler = myDescriptor.createRootRemovalHandler(); - myModificationOfImportedModelWarningComponent = new ModificationOfImportedModelWarningComponent(); - myBottomPanel.add(BorderLayout.CENTER, myModificationOfImportedModelWarningComponent.getLabel()); init(new LibraryTreeStructure(this, myDescriptor)); updatePropertiesLabel(); onRootsChanged(); @@ -169,7 +167,6 @@ public class LibraryRootsComponent implements Disposable, LibraryEditorComponent myTreePanel.setLayout(new BorderLayout()); ToolbarDecorator toolbarDecorator = ToolbarDecorator.createDecorator(myTree).disableUpDownActions() - .setPanelBorder(JBUI.Borders.empty()) .setRemoveActionName(JavaUiBundle.message("library.remove.action")) .disableRemoveAction(); final List popupItems = new ArrayList<>(); @@ -256,7 +253,10 @@ public class LibraryRootsComponent implements Disposable, LibraryEditorComponent } }); - myTreePanel.add(toolbarDecorator.createPanel(), BorderLayout.CENTER); + JPanel panel = toolbarDecorator.createPanel(); + panel.setBorder(null); + + myTreePanel.add(panel, BorderLayout.CENTER); } public JComponent getComponent() { @@ -339,6 +339,11 @@ public class LibraryRootsComponent implements Disposable, LibraryEditorComponent updateModificationOfImportedModelWarning(); } + private void createUIComponents() { + myModificationOfImportedModelWarningComponent = new ModificationOfImportedModelWarningComponent(); + myBottomLabel = myModificationOfImportedModelWarningComponent.getLabel(); + } + @Nullable private static Object getPathElement(final TreePath selectionPath) { if (selectionPath == null) {