Search in sources :

Example 1 with LibraryRootsComponent

use of com.intellij.openapi.roots.ui.configuration.libraryEditor.LibraryRootsComponent in project android by JetBrains.

the class LibraryPropertiesDialog method createCenterPanel.

@Nullable
@Override
protected JComponent createCenterPanel() {
    myIconLabel.setIcon(AllIcons.Modules.Library);
    myNameLabel.setText(myLibrary.getName());
    LibraryEditor editor = new SourcesAndDocsOnlyEditor(myLibrary);
    myLibraryEditorComponent = new LibraryRootsComponent(myProject, editor) {

        @Override
        public void updatePropertiesLabel() {
            JComponent c = getComponent();
            if (c != null) {
                MultiLineLabel propertiesLabel = findComponentOfType(c, MultiLineLabel.class);
                if (propertiesLabel != null) {
                    propertiesLabel.setText("Add or remove source/Javadoc attachments");
                }
            }
        }
    };
    myLibraryEditorComponent.updatePropertiesLabel();
    JComponent c = myLibraryEditorComponent.getComponent();
    // Remove "Exclude" button. We don't support this in libraries.
    List<ActionButton> actionButtons = findComponentsOfType(c, ActionButton.class);
    for (ActionButton actionButton : actionButtons) {
        String text = actionButton.getAction().getTemplatePresentation().getText();
        if (text != null && text.startsWith("Exclude")) {
            actionButton.setVisible(false);
            break;
        }
    }
    MultiLineLabel propertiesLabel = findComponentOfType(c, MultiLineLabel.class);
    if (propertiesLabel != null) {
        propertiesLabel.setBorder(BorderFactory.createEmptyBorder(1, 1, 0, 1));
    }
    myTreePanel.add(c, BorderLayout.CENTER);
    myTreePanel.setBorder(customLine(OnePixelDivider.BACKGROUND, 1, 1, 1, 1));
    return myMainPanel;
}
Also used : ExistingLibraryEditor(com.intellij.openapi.roots.ui.configuration.libraryEditor.ExistingLibraryEditor) LibraryEditor(com.intellij.openapi.roots.ui.configuration.libraryEditor.LibraryEditor) ActionButton(com.intellij.openapi.actionSystem.impl.ActionButton) LibraryRootsComponent(com.intellij.openapi.roots.ui.configuration.libraryEditor.LibraryRootsComponent) MultiLineLabel(com.intellij.openapi.ui.ex.MultiLineLabel) Nullable(org.jetbrains.annotations.Nullable)

Example 2 with LibraryRootsComponent

use of com.intellij.openapi.roots.ui.configuration.libraryEditor.LibraryRootsComponent in project intellij-community by JetBrains.

the class LibraryConfigurable method createOptionsPanel.

@Override
public JComponent createOptionsPanel() {
    myLibraryEditorComponent = new LibraryRootsComponent(myProject, () -> getLibraryEditor());
    myLibraryEditorComponent.addListener(() -> {
        myContext.getDaemonAnalyzer().queueUpdate(myProjectStructureElement);
        updateName();
    });
    return myLibraryEditorComponent.getComponent();
}
Also used : LibraryRootsComponent(com.intellij.openapi.roots.ui.configuration.libraryEditor.LibraryRootsComponent)

Aggregations

LibraryRootsComponent (com.intellij.openapi.roots.ui.configuration.libraryEditor.LibraryRootsComponent)2 ActionButton (com.intellij.openapi.actionSystem.impl.ActionButton)1 ExistingLibraryEditor (com.intellij.openapi.roots.ui.configuration.libraryEditor.ExistingLibraryEditor)1 LibraryEditor (com.intellij.openapi.roots.ui.configuration.libraryEditor.LibraryEditor)1 MultiLineLabel (com.intellij.openapi.ui.ex.MultiLineLabel)1 Nullable (org.jetbrains.annotations.Nullable)1