Search in sources :

Example 1 with VerticalStackLayout

use of com.intellij.openapi.roots.ui.componentsList.layout.VerticalStackLayout in project intellij-community by JetBrains.

the class CommonContentEntriesEditor method createComponentImpl.

@Override
public JPanel createComponentImpl() {
    final Module module = getModule();
    final Project project = module.getProject();
    myContentEntryEditorListener = new MyContentEntryEditorListener();
    final JPanel mainPanel = new JPanel(new BorderLayout());
    addAdditionalSettingsToPanel(mainPanel);
    final DefaultActionGroup group = new DefaultActionGroup();
    final AddContentEntryAction action = new AddContentEntryAction();
    action.registerCustomShortcutSet(KeyEvent.VK_C, InputEvent.ALT_DOWN_MASK, mainPanel);
    group.add(action);
    myEditorsPanel = new ScrollablePanel(new VerticalStackLayout());
    myEditorsPanel.setBackground(BACKGROUND_COLOR);
    JScrollPane myScrollPane = ScrollPaneFactory.createScrollPane(myEditorsPanel, true);
    final ToolbarPanel toolbarPanel = new ToolbarPanel(myScrollPane, group);
    int border = myWithBorders ? 1 : 0;
    toolbarPanel.setBorder(new CustomLineBorder(1, 0, border, border));
    final JBSplitter splitter = new OnePixelSplitter(false);
    splitter.setProportion(0.6f);
    splitter.setHonorComponentsMinimumSize(true);
    myRootTreeEditor = createContentEntryTreeEditor(project);
    final JComponent component = myRootTreeEditor.createComponent();
    component.setBorder(new CustomLineBorder(1, border, border, 0));
    splitter.setFirstComponent(component);
    splitter.setSecondComponent(toolbarPanel);
    JPanel contentPanel = new JPanel(new GridBagLayout());
    final ActionToolbar actionToolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, myRootTreeEditor.getEditingActionsGroup(), true);
    contentPanel.add(new JLabel("Mark as:"), new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, 0, JBUI.insets(0, 10), 0, 0));
    contentPanel.add(actionToolbar.getComponent(), new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, JBUI.emptyInsets(), 0, 0));
    contentPanel.add(splitter, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 2, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, JBUI.emptyInsets(), 0, 0));
    mainPanel.add(contentPanel, BorderLayout.CENTER);
    final JPanel innerPanel = createBottomControl(module);
    if (innerPanel != null) {
        mainPanel.add(innerPanel, BorderLayout.SOUTH);
    }
    final ModifiableRootModel model = getModel();
    if (model != null) {
        final ContentEntry[] contentEntries = model.getContentEntries();
        if (contentEntries.length > 0) {
            for (final ContentEntry contentEntry : contentEntries) {
                addContentEntryPanel(contentEntry.getUrl());
            }
            selectContentEntry(contentEntries[0].getUrl());
        }
    }
    return mainPanel;
}
Also used : OnePixelSplitter(com.intellij.ui.OnePixelSplitter) ModifiableRootModel(com.intellij.openapi.roots.ModifiableRootModel) Project(com.intellij.openapi.project.Project) VerticalStackLayout(com.intellij.openapi.roots.ui.componentsList.layout.VerticalStackLayout) ScrollablePanel(com.intellij.openapi.roots.ui.componentsList.components.ScrollablePanel) CustomLineBorder(com.intellij.ui.border.CustomLineBorder) ContentEntry(com.intellij.openapi.roots.ContentEntry) JBSplitter(com.intellij.ui.JBSplitter) Module(com.intellij.openapi.module.Module) ToolbarPanel(com.intellij.ui.roots.ToolbarPanel)

Aggregations

Module (com.intellij.openapi.module.Module)1 Project (com.intellij.openapi.project.Project)1 ContentEntry (com.intellij.openapi.roots.ContentEntry)1 ModifiableRootModel (com.intellij.openapi.roots.ModifiableRootModel)1 ScrollablePanel (com.intellij.openapi.roots.ui.componentsList.components.ScrollablePanel)1 VerticalStackLayout (com.intellij.openapi.roots.ui.componentsList.layout.VerticalStackLayout)1 JBSplitter (com.intellij.ui.JBSplitter)1 OnePixelSplitter (com.intellij.ui.OnePixelSplitter)1 CustomLineBorder (com.intellij.ui.border.CustomLineBorder)1 ToolbarPanel (com.intellij.ui.roots.ToolbarPanel)1