private void setupCentralPanel() {
    myCentralPanel.removeAll();
    if (myUsagePreviewPanel != null) {
      Disposer.dispose(myUsagePreviewPanel);
      myUsagePreviewPanel = null;
    }
    JScrollPane pane = ScrollPaneFactory.createScrollPane(myTree);

    if (UsageViewSettings.getInstance().IS_PREVIEW_USAGES) {
      Splitter splitter =
          new Splitter(false, UsageViewSettings.getInstance().PREVIEW_USAGES_SPLITTER_PROPORTIONS);
      pane.putClientProperty(UIUtil.KEEP_BORDER_SIDES, SideBorder.RIGHT);

      splitter.setFirstComponent(pane);
      myUsagePreviewPanel = new UsagePreviewPanel(myProject);
      myUsagePreviewPanel.setBorder(IdeBorderFactory.createBorder(SideBorder.LEFT));
      Disposer.register(this, myUsagePreviewPanel);
      splitter.setSecondComponent(myUsagePreviewPanel);
      myCentralPanel.add(splitter, BorderLayout.CENTER);
    } else {
      myCentralPanel.add(pane, BorderLayout.CENTER);
    }
    myCentralPanel.add(myButtonPanel, BorderLayout.SOUTH);

    myRootPanel.revalidate();
  }
  private void layoutPanel() {
    if (myUsagePreviewPanel != null) {
      Disposer.dispose(myUsagePreviewPanel);
    }
    removeAll();
    JScrollPane pane = ScrollPaneFactory.createScrollPane(myTree);

    if (isPreview()) {
      pane.setBorder(IdeBorderFactory.createBorder(SideBorder.LEFT | SideBorder.RIGHT));

      boolean vertical =
          myToolWindow.getAnchor() == ToolWindowAnchor.LEFT
              || myToolWindow.getAnchor() == ToolWindowAnchor.RIGHT;
      Splitter splitter =
          new Splitter(
              vertical, UsageViewSettings.getInstance().PREVIEW_USAGES_SPLITTER_PROPORTIONS);
      splitter.setFirstComponent(pane);
      myUsagePreviewPanel = new UsagePreviewPanel(myProject, new UsageViewPresentation());
      myUsagePreviewPanel.setBorder(IdeBorderFactory.createBorder(SideBorder.LEFT));

      Disposer.register(this, myUsagePreviewPanel);
      splitter.setSecondComponent(myUsagePreviewPanel);
      add(splitter, BorderLayout.CENTER);
    } else {
      pane.setBorder(IdeBorderFactory.createBorder(SideBorder.LEFT));
      add(pane, BorderLayout.CENTER);
    }

    add(createToolbar().getComponent(), BorderLayout.WEST);

    myTree.getParent().setBackground(UIManager.getColor("Tree.background"));

    revalidate();
  }
  private JPanel readSplitter(
      JPanel panel, Element splitterElement, Ref<EditorWindow> currentWindow) {
    final boolean orientation =
        "vertical".equals(splitterElement.getAttributeValue("split-orientation"));
    final float proportion =
        Float.valueOf(splitterElement.getAttributeValue("split-proportion")).floatValue();
    final Element first = splitterElement.getChild("split-first");
    final Element second = splitterElement.getChild("split-second");

    Splitter splitter;
    if (panel == null) {
      panel = new JPanel(new BorderLayout());
      panel.setOpaque(false);
      splitter = new Splitter(orientation, proportion, 0.1f, 0.9f);
      panel.add(splitter, BorderLayout.CENTER);
      splitter.setFirstComponent(readExternalPanel(first, null, currentWindow));
      splitter.setSecondComponent(readExternalPanel(second, null, currentWindow));
    } else if (panel.getComponent(0) instanceof Splitter) {
      splitter = (Splitter) panel.getComponent(0);
      readExternalPanel(first, (JPanel) splitter.getFirstComponent(), currentWindow);
      readExternalPanel(second, (JPanel) splitter.getSecondComponent(), currentWindow);
    } else {
      readExternalPanel(first, panel, currentWindow);
      readExternalPanel(second, panel, currentWindow);
    }
    return panel;
  }
  public GridImpl(ViewContextEx viewContext, String sessionName) {
    myViewContext = viewContext;
    mySessionName = sessionName;

    Disposer.register(myViewContext, this);
    Disposer.register(this, myTopSplit);

    Placeholder left = new Placeholder();
    myPlaceInGrid2Cell.put(
        PlaceInGrid.left, new GridCellImpl(myViewContext, this, left, PlaceInGrid.left));
    Placeholder center = new Placeholder();
    myPlaceInGrid2Cell.put(
        PlaceInGrid.center, new GridCellImpl(myViewContext, this, center, PlaceInGrid.center));
    Placeholder right = new Placeholder();
    myPlaceInGrid2Cell.put(
        PlaceInGrid.right, new GridCellImpl(myViewContext, this, right, PlaceInGrid.right));
    Placeholder bottom = new Placeholder();
    myPlaceInGrid2Cell.put(
        PlaceInGrid.bottom, new GridCellImpl(myViewContext, this, bottom, PlaceInGrid.bottom));

    setContent(mySplitter);
    setOpaque(false);
    setFocusCycleRoot(true);

    myTopSplit.setFirstComponent(left);
    myTopSplit.setInnerComponent(center);
    myTopSplit.setLastComponent(right);
    myTopSplit.setMinSize(48);
    mySplitter.setFirstComponent(myTopSplit);
    mySplitter.setSecondComponent(bottom);
  }
  @Override
  public JComponent createComponent() {
    if (myMainComponent == null) {
      myMainComponent = new JPanel(new BorderLayout());
      myCbUseSoftWrapsAtConsole =
          new JCheckBox(ApplicationBundle.message("checkbox.use.soft.wraps.at.console"), false);
      myCommandsHistoryLimitField = new JTextField(3);
      myCbOverrideConsoleCycleBufferSize =
          new JCheckBox(
              ApplicationBundle.message(
                  "checkbox.override.console.cycle.buffer.size",
                  String.valueOf(ConsoleBuffer.getLegacyCycleBufferSize() / 1024)),
              false);
      myCbOverrideConsoleCycleBufferSize.addChangeListener(
          new ChangeListener() {
            @Override
            public void stateChanged(ChangeEvent e) {
              myConsoleCycleBufferSizeField.setEnabled(
                  myCbOverrideConsoleCycleBufferSize.isSelected());
            }
          });
      myConsoleCycleBufferSizeField = new JTextField(3);

      JPanel northPanel = new JPanel(new GridBagLayout());
      GridBag gridBag = new GridBag();
      gridBag.anchor(GridBagConstraints.WEST).setDefaultAnchor(GridBagConstraints.WEST);
      northPanel.add(myCbUseSoftWrapsAtConsole, gridBag.nextLine().next());
      northPanel.add(Box.createHorizontalGlue(), gridBag.next().coverLine());
      northPanel.add(
          new JLabel(ApplicationBundle.message("editbox.console.history.limit")),
          gridBag.nextLine().next());
      northPanel.add(myCommandsHistoryLimitField, gridBag.next());
      if (ConsoleBuffer.useCycleBuffer()) {
        northPanel.add(myCbOverrideConsoleCycleBufferSize, gridBag.nextLine().next());
        northPanel.add(myConsoleCycleBufferSizeField, gridBag.next());
      }
      if (!editFoldingsOnly()) {
        JPanel wrapper = new JPanel(new BorderLayout());
        wrapper.add(northPanel, BorderLayout.WEST);
        myMainComponent.add(wrapper, BorderLayout.NORTH);
      }
      Splitter splitter = new Splitter(true);
      myMainComponent.add(splitter, BorderLayout.CENTER);
      myPositivePanel =
          new MyAddDeleteListPanel(
              "Fold console lines that contain",
              "Enter a substring of a console line you'd like to see folded:");
      myNegativePanel =
          new MyAddDeleteListPanel(
              "Exceptions", "Enter a substring of a console line you don't want to fold:");
      splitter.setFirstComponent(myPositivePanel);
      splitter.setSecondComponent(myNegativePanel);

      myPositivePanel.getEmptyText().setText("Fold nothing");
      myNegativePanel.getEmptyText().setText("No exceptions");
    }
    return myMainComponent;
  }
  public void editSelectedMongoDocument() {

    DBObject mongoDocument = getSelectedMongoDocument();

    if (mongoDocument == null) {
      return;
    }

    mongoEditionPanel.updateEditionTree(mongoDocument);

    splitter.setSecondComponent(mongoEditionPanel);
  }
  public void createGUI() {
    this.setLayout(new BorderLayout());

    // Had to set min size / preferred size in InputPanel.form to get slider to allow left shift of
    // divider
    Splitter splitPane = new Splitter();
    inputPanel = getEditorPanel();
    splitPane.setFirstComponent(inputPanel.getComponent());
    splitPane.setSecondComponent(createParseTreeAndProfileTabbedPanel());

    this.add(splitPane, BorderLayout.CENTER);
  }
示例#8
0
 public DependenciesPanel(BaseTool tool, Project project) {
   super(new BorderLayout());
   myTool = tool;
   myIsMeta = false;
   myInitTree = new DependencyTree(this);
   myProject = project;
   myTargetsView = new TargetsView(myProject, this);
   myReferencesView = new ReferencesView(myProject, this);
   myReferencesView.setRunOptions(
       null, null, new UsagesView.ButtonConfiguration(false, false, false));
   JBScrollPane leftPane = new JBScrollPane(myInitTree);
   Splitter treeSplitter = new Splitter(false);
   treeSplitter.setFirstComponent(leftPane);
   treeSplitter.setSecondComponent(myTargetsView.getTreeComponent());
   Splitter splitter = new Splitter(true);
   splitter.setFirstComponent(treeSplitter);
   splitter.setSecondComponent(myReferencesView.getComponent());
   splitter.setDividerWidth(5);
   treeSplitter.setDividerWidth(5);
   add(splitter, BorderLayout.CENTER);
   add(createToolbar(), BorderLayout.NORTH);
 }
  @Override
  public void createToolWindowContent(final Project project, ToolWindow toolWindow) {
    Component component = toolWindow.getComponent();

    changeListPanel = new GerritChangeListPanel(Lists.<ChangeInfo>newArrayList(), null);

    SimpleToolWindowPanel panel = new SimpleToolWindowPanel(false, true);

    ActionToolbar toolbar = createToolbar();
    toolbar.setTargetComponent(changeListPanel);
    panel.setToolbar(toolbar.getComponent());

    myRepositoryChangesBrowser = createRepositoryChangesBrowser(project);

    myDetailsSplitter = new Splitter(true, 0.6f);
    myDetailsSplitter.setShowDividerControls(true);

    changeListPanel.setBorder(
        IdeBorderFactory.createBorder(SideBorder.TOP | SideBorder.RIGHT | SideBorder.BOTTOM));
    myDetailsSplitter.setFirstComponent(changeListPanel);

    myDetailsPanel = new GerritChangeDetailsPanel(project);
    JPanel details = myDetailsPanel.getComponent();
    details.setBorder(IdeBorderFactory.createBorder(SideBorder.TOP | SideBorder.RIGHT));
    myDetailsSplitter.setSecondComponent(details);

    Splitter myHorizontalSplitter = new Splitter(false, 0.7f);
    myHorizontalSplitter.setShowDividerControls(true);
    myHorizontalSplitter.setFirstComponent(myDetailsSplitter);
    myHorizontalSplitter.setSecondComponent(myRepositoryChangesBrowser);

    panel.setContent(myHorizontalSplitter);

    component.getParent().add(panel);

    reloadChanges(project, false);

    setupRefreshTask(project);
  }
示例#10
0
  public ServersToolWindowContent(@NotNull Project project) {
    super(new BorderLayout());
    myProject = project;

    myTreeModel = new DefaultTreeModel(new DefaultMutableTreeNode());
    myTree = new Tree(myTreeModel);
    myTree.setRootVisible(false);

    myTree.setShowsRootHandles(true);
    myTree.setCellRenderer(new NodeRenderer());
    myTree.setLineStyleAngled();

    getMainPanel().add(createToolbar(), BorderLayout.WEST);
    Splitter splitter = new Splitter(false, 0.3f);
    splitter.setFirstComponent(ScrollPaneFactory.createScrollPane(myTree, SideBorder.LEFT));
    myPropertiesPanelLayout = new CardLayout();
    myPropertiesPanel = new JPanel(myPropertiesPanelLayout);
    myMessageLabel = new JLabel(EMPTY_SELECTION_MESSAGE, SwingConstants.CENTER);
    myPropertiesPanel.add(MESSAGE_CARD, new Wrapper(myMessageLabel));
    splitter.setSecondComponent(myPropertiesPanel);
    getMainPanel().add(splitter, BorderLayout.CENTER);

    setupBuilder(project);

    for (RemoteServersViewContributor contributor :
        RemoteServersViewContributor.EP_NAME.getExtensions()) {
      contributor.setupTree(myProject, myTree, myBuilder);
    }

    myTree.addTreeSelectionListener(
        new TreeSelectionListener() {
          @Override
          public void valueChanged(TreeSelectionEvent e) {
            onSelectionChanged();
          }
        });
    new DoubleClickListener() {
      @Override
      protected boolean onDoubleClick(MouseEvent event) {
        Set<ServersTreeStructure.RemoteServerNode> nodes = getSelectedRemoteServerNodes();
        if (nodes.size() == 1) {
          RemoteServer<?> server = nodes.iterator().next().getValue();
          ServerConnectionManager.getInstance().getOrCreateConnection(server);
          return true;
        }
        return false;
      }
    }.installOn(myTree);
  }
    @Override
    protected JComponent createCenterPanel() {
      final JComponent tree = super.createCenterPanel();

      myCommitMessagePanel = new CommitMessage(myProject);
      myCommitMessagePanel.setCommitMessage("Initial commit");

      Splitter splitter = new Splitter(true);
      splitter.setHonorComponentsMinimumSize(true);
      splitter.setFirstComponent(tree);
      splitter.setSecondComponent(myCommitMessagePanel);
      splitter.setProportion(0.7f);

      return splitter;
    }
  protected JComponent createEditorContent() {
    JPanel result = new JPanel(new BorderLayout());
    Splitter p;

    result.add(BorderLayout.CENTER, p = new Splitter(true, 0.5f));
    p.setFirstComponent(super.createEditorContent());

    replaceCriteriaEdit =
        createEditor(searchContext, mySavedEditorText != null ? mySavedEditorText : "");
    JPanel replace = new JPanel(new BorderLayout());
    replace.add(BorderLayout.NORTH, new JLabel(SSRBundle.message("replacement.template.label")));
    replace.add(BorderLayout.CENTER, replaceCriteriaEdit.getComponent());
    replaceCriteriaEdit.getComponent().setMinimumSize(new Dimension(150, 100));

    p.setSecondComponent(replace);

    return result;
  }
  private JPanel createSignaturePanel() {
    mySignature = new GrMethodSignatureComponent("", myProject);
    myTable =
        new ParameterTablePanel() {
          @Override
          protected void updateSignature() {
            GrIntroduceParameterDialog.this.updateSignature();
          }

          @Override
          protected void doEnterAction() {
            clickDefaultButton();
          }

          @Override
          protected void doCancelAction() {
            GrIntroduceParameterDialog.this.doCancelAction();
          }
        };

    mySignature.setBorder(
        IdeBorderFactory.createTitledBorder(
            GroovyRefactoringBundle.message("signature.preview.border.title"), false));

    Splitter splitter = new Splitter(true);

    splitter.setFirstComponent(myTable);
    splitter.setSecondComponent(mySignature);

    mySignature.setPreferredSize(JBUI.size(500, 100));
    mySignature.setSize(JBUI.size(500, 100));

    splitter.setShowDividerIcon(false);

    final JPanel panel = new JPanel(new BorderLayout());
    panel.add(splitter, BorderLayout.CENTER);
    myForceReturnCheckBox =
        new JCheckBox(UIUtil.replaceMnemonicAmpersand("Use e&xplicit return statement"));
    panel.add(myForceReturnCheckBox, BorderLayout.NORTH);

    return panel;
  }
  public JComponent createComponent() {
    if (myMainComponent == null) {
      myMainComponent = new JPanel(new BorderLayout());
      Splitter splitter = new Splitter(true);
      myMainComponent.add(splitter);
      myPositivePanel =
          new MyAddDeleteListPanel(
              "Fold console lines that contain",
              "Enter a substring of a console line you'd like to see folded:");
      myNegativePanel =
          new MyAddDeleteListPanel(
              "Exceptions", "Enter a substring of a console line you don't want to fold:");
      splitter.setFirstComponent(myPositivePanel);
      splitter.setSecondComponent(myNegativePanel);

      myPositivePanel.getEmptyText().setText("Fold nothing");
      myNegativePanel.getEmptyText().setText("No exceptions");
    }
    return myMainComponent;
  }
示例#15
0
  public UnitTestViewComponent(
      Project project,
      ConsoleView console,
      TestRunState testRunState,
      _FunctionTypes._void_P0_E0 closeListener) {
    myProject = project;
    myTestState = testRunState;
    StatisticsTableModel statisticsModel = new StatisticsTableModel(myTestState);

    myTreeComponent = new TestTree(myTestState, ProjectHelper.toMPSProject(project), this);
    myTestNavigator = new FailedTestOccurrenceNavigator(myTreeComponent);
    myActionToolComponent = new TestToolbarPanel(myTreeComponent, myTestNavigator);

    JComponent leftPanel = createTreeComponent(myActionToolComponent, myTreeComponent);

    myProgressLineComponent = new ProgressLine(myTestState);
    myProgressLineComponent.setMinimumSize(
        new Dimension(0, myProgressLineComponent.getMinimumSize().height));
    myOutputComponent = new TestOutputComponent(myProject, this, console, myTestState);
    myTreeComponent.addTreeSelectionListener(
        new TestTreeSelectionListener(myTreeComponent, statisticsModel, myOutputComponent));
    myTreeComponent.addMouseListener(
        new TestTreeRootMouseListener(myTreeComponent, statisticsModel, myOutputComponent));

    JPanel rightPanel =
        createOutputComponent(
            console, myProgressLineComponent, myOutputComponent.getComponent(), statisticsModel);

    Splitter splitter = new Splitter(false);
    initSplitterProportion(splitter, 0.2f, "tree");
    splitter.setFirstComponent(leftPanel);
    splitter.setSecondComponent(rightPanel);
    setLayout(new BorderLayout());

    add(splitter, BorderLayout.CENTER);

    myTestState.addView(myTreeComponent);
    myTestState.addView(myProgressLineComponent);
    myTestState.addView(myOutputComponent);
    addCloseListener(closeListener);
  }
示例#16
0
  private JPanel createOutputComponent(
      ConsoleView console,
      JComponent progressLine,
      JComponent testOutput,
      StatisticsTableModel statisticsModel) {
    JPanel rightPanel = new JPanel(new GridBagLayout());

    JComponent stackTraceActions = createActionsToolbar(console);
    stackTraceActions.setMaximumSize(
        new Dimension(rightPanel.getWidth(), stackTraceActions.getMaximumSize().height));

    Splitter outputStatisticSplitter = new Splitter(false);
    initSplitterProportion(outputStatisticSplitter, 0.5f, "statistic");
    outputStatisticSplitter.setFirstComponent(testOutput);
    JComponent statistics = createStatisticsComponent(statisticsModel);
    outputStatisticSplitter.setSecondComponent(statistics);

    GridBagConstraints c = new GridBagConstraints();
    rightPanel.setBorder(null);
    c.fill = GridBagConstraints.VERTICAL;
    c.anchor = GridBagConstraints.LINE_START;
    c.gridx = 0;
    c.gridy = 1;
    c.weighty = 1;
    c.weightx = 0;
    rightPanel.add(stackTraceActions, c);
    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridx = 1;
    c.gridy = 0;
    c.weighty = 0;
    c.weightx = 1;
    rightPanel.add(progressLine, c);
    c.fill = GridBagConstraints.BOTH;
    c.gridx = 1;
    c.gridy = 1;
    c.weighty = 1;
    c.weightx = 1;
    rightPanel.add(outputStatisticSplitter, c);
    return rightPanel;
  }
  public GenerateByPatternDialog(Project project, PatternDescriptor[] descriptors) {
    super(project);
    myProject = project;
    setTitle("Generate by Pattern");
    setOKButtonText("Generate");

    myMap = new MultiMap<>();
    for (PatternDescriptor descriptor : descriptors) {
      myMap.putValue(descriptor.getParentId(), descriptor);
    }
    DefaultMutableTreeNode root = createNode(null);

    myTree = new SimpleTree() {};

    myTree.setRootVisible(false);
    myTree.setCellRenderer(
        new DefaultTreeCellRenderer() {
          @NotNull
          @Override
          public Component getTreeCellRendererComponent(
              @NotNull JTree tree,
              Object value,
              boolean sel,
              boolean expanded,
              boolean leaf,
              int row,
              boolean hasFocus) {
            Component component =
                super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);

            Object object = ((DefaultMutableTreeNode) value).getUserObject();
            if (object instanceof PatternDescriptor) {
              setText(((PatternDescriptor) object).getName());
              setIcon(((PatternDescriptor) object).getIcon());
            }
            return component;
          }
        });

    myTree.setModel(new DefaultTreeModel(root));
    myTree
        .getSelectionModel()
        .addTreeSelectionListener(
            new TreeSelectionListener() {
              @Override
              public void valueChanged(@NotNull TreeSelectionEvent e) {
                update();
              }
            });
    myEditor = TemplateEditorUtil.createEditor(true, "");

    mySplitter.setFirstComponent(ScrollPaneFactory.createScrollPane(myTree));
    JPanel details = new JPanel(new BorderLayout());
    details.add(myEditor.getComponent(), BorderLayout.CENTER);
    mySplitter.setSecondComponent(details);
    mySplitter.setHonorComponentsMinimumSize(true);
    mySplitter.setShowDividerControls(true);

    myTree.setSelectionRow(0);

    init();
  }
  public InspectionResultsView(
      @NotNull final Project project,
      final InspectionProfile inspectionProfile,
      @NotNull AnalysisScope scope,
      @NotNull GlobalInspectionContextImpl globalInspectionContext,
      @NotNull InspectionRVContentProvider provider) {
    setLayout(new BorderLayout());

    myProject = project;
    myInspectionProfile = inspectionProfile;
    myScope = scope;
    myGlobalInspectionContext = globalInspectionContext;
    myProvider = provider;

    myTree = new InspectionTree(project, globalInspectionContext);
    initTreeListeners();

    myOccurenceNavigator = initOccurenceNavigator();

    myBrowser = new Browser(this);

    mySplitter =
        new OnePixelSplitter(false, AnalysisUIOptions.getInstance(myProject).SPLITTER_PROPORTION);

    mySplitter.setFirstComponent(
        ScrollPaneFactory.createScrollPane(myTree, SideBorder.LEFT | SideBorder.RIGHT));
    mySplitter.setSecondComponent(myBrowser);

    mySplitter.addPropertyChangeListener(
        new PropertyChangeListener() {
          @Override
          public void propertyChange(PropertyChangeEvent evt) {
            if (Splitter.PROP_PROPORTION.equals(evt.getPropertyName())) {
              myGlobalInspectionContext.setSplitterProportion(
                  ((Float) evt.getNewValue()).floatValue());
            }
          }
        });
    add(mySplitter, BorderLayout.CENTER);

    myBrowser.addClickListener(
        new Browser.ClickListener() {
          @Override
          public void referenceClicked(final Browser.ClickEvent e) {
            if (e.getEventType() == Browser.ClickEvent.REF_ELEMENT) {
              final RefElement refElement = e.getClickedElement();
              final OpenFileDescriptor descriptor = getOpenFileDescriptor(refElement);
              if (descriptor != null) {
                FileEditorManager.getInstance(project).openTextEditor(descriptor, false);
              }
            } else if (e.getEventType() == Browser.ClickEvent.FILE_OFFSET) {
              final VirtualFile file = e.getFile();
              final OpenFileDescriptor descriptor =
                  new OpenFileDescriptor(project, file, e.getStartOffset());
              final Editor editor =
                  FileEditorManager.getInstance(project).openTextEditor(descriptor, true);
              if (editor != null) {
                final TextAttributes selectionAttributes =
                    EditorColorsManager.getInstance()
                        .getGlobalScheme()
                        .getAttributes(EditorColors.SEARCH_RESULT_ATTRIBUTES);
                HighlightManager.getInstance(project)
                    .addRangeHighlight(
                        editor,
                        e.getStartOffset(),
                        e.getEndOffset(),
                        selectionAttributes,
                        true,
                        null);
              }
            }
          }
        });

    createActionsToolbar();
    TreeUtil.selectFirstNode(myTree);
  }
  public AddSupportForFrameworksPanel(
      final List<FrameworkSupportInModuleProvider> providers,
      final FrameworkSupportModelBase model,
      boolean vertical,
      @Nullable JPanel associatedFrameworksPanel) {
    myModel = model;
    myAssociatedFrameworksPanel = associatedFrameworksPanel;
    myLibrariesContainer = model.getLibrariesContainer();

    myLabel.setVisible(!vertical);
    Splitter splitter =
        vertical ? new Splitter(true, 0.6f, 0.2f, 0.8f) : new Splitter(false, 0.3f, 0.3f, 0.7f);
    splitter.setHonorComponentsMinimumSize(false);
    myFrameworksTree =
        new FrameworksTree(model) {
          @Override
          protected void onNodeStateChanged(CheckedTreeNode node) {
            if (!(node instanceof FrameworkSupportNode)) return;

            final FrameworkSupportNode frameworkSupportNode = (FrameworkSupportNode) node;
            if (frameworkSupportNode == getSelectedNode()) {
              updateOptionsPanel();
            }
            final FrameworkSupportInModuleConfigurable configurable =
                frameworkSupportNode.getConfigurable();
            configurable.onFrameworkSelectionChanged(node.isChecked());
            myModel.onFrameworkSelectionChanged(frameworkSupportNode);
            onFrameworkStateChanged();
          }
        };
    model.addFrameworkVersionListener(
        new FrameworkVersionListener() {
          @Override
          public void versionChanged(FrameworkVersion version) {
            ((DefaultTreeModel) myFrameworksTree.getModel()).nodeChanged(getSelectedNode());
          }
        },
        this);

    myFrameworksTree.addTreeSelectionListener(
        new TreeSelectionListener() {
          public void valueChanged(TreeSelectionEvent e) {
            onSelectionChanged();
          }
        });

    JPanel treePanel = new JPanel(new BorderLayout());
    treePanel.add(ScrollPaneFactory.createScrollPane(myFrameworksTree), BorderLayout.CENTER);
    treePanel.setMinimumSize(new Dimension(200, 300));

    splitter.setFirstComponent(treePanel);
    myOptionsPanel = new JPanel(new CardLayout());
    JPanel emptyCard = new JPanel();
    emptyCard.setPreferredSize(new Dimension(400, 100));
    myOptionsPanel.add(EMPTY_CARD, emptyCard);

    splitter.setSecondComponent(myOptionsPanel);
    myFrameworksPanel.add(splitter, BorderLayout.CENTER);

    setProviders(providers);
  }
  public DependenciesPanel(
      Project project, final List<DependenciesBuilder> builders, final Set<PsiFile> excluded) {
    super(new BorderLayout());
    myBuilders = builders;
    myExcluded = excluded;
    final DependenciesBuilder main = myBuilders.get(0);
    myForward = !main.isBackward();
    myScopeOfInterest = main.getScopeOfInterest();
    myTransitiveBorder = main.getTransitiveBorder();
    myDependencies = new HashMap<PsiFile, Set<PsiFile>>();
    myIllegalDependencies = new HashMap<PsiFile, Map<DependencyRule, Set<PsiFile>>>();
    for (DependenciesBuilder builder : builders) {
      myDependencies.putAll(builder.getDependencies());
      myIllegalDependencies.putAll(builder.getIllegalDependencies());
    }
    exclude(excluded);
    myProject = project;
    myUsagesPanel = new DependenciesUsagesPanel(myProject, myBuilders);
    Disposer.register(this, myUsagesPanel);

    final Splitter treeSplitter = new Splitter();
    Disposer.register(
        this,
        new Disposable() {
          public void dispose() {
            treeSplitter.dispose();
          }
        });
    treeSplitter.setFirstComponent(ScrollPaneFactory.createScrollPane(myLeftTree));
    treeSplitter.setSecondComponent(ScrollPaneFactory.createScrollPane(myRightTree));

    final Splitter splitter = new Splitter(true);
    Disposer.register(
        this,
        new Disposable() {
          public void dispose() {
            splitter.dispose();
          }
        });
    splitter.setFirstComponent(treeSplitter);
    splitter.setSecondComponent(myUsagesPanel);
    add(splitter, BorderLayout.CENTER);
    add(createToolbar(), BorderLayout.NORTH);

    myRightTreeExpansionMonitor = PackageTreeExpansionMonitor.install(myRightTree, myProject);
    myLeftTreeExpansionMonitor = PackageTreeExpansionMonitor.install(myLeftTree, myProject);

    myRightTreeMarker =
        new Marker() {
          public boolean isMarked(VirtualFile file) {
            return myIllegalsInRightTree.contains(file);
          }
        };

    myLeftTreeMarker =
        new Marker() {
          public boolean isMarked(VirtualFile file) {
            return myIllegalDependencies.containsKey(file);
          }
        };

    updateLeftTreeModel();
    updateRightTreeModel();

    myLeftTree
        .getSelectionModel()
        .addTreeSelectionListener(
            new TreeSelectionListener() {
              public void valueChanged(TreeSelectionEvent e) {
                updateRightTreeModel();
                final StringBuffer denyRules = new StringBuffer();
                final StringBuffer allowRules = new StringBuffer();
                final TreePath[] paths = myLeftTree.getSelectionPaths();
                if (paths == null) {
                  return;
                }
                for (TreePath path : paths) {
                  PackageDependenciesNode selectedNode =
                      (PackageDependenciesNode) path.getLastPathComponent();
                  traverseToLeaves(selectedNode, denyRules, allowRules);
                }
                if (denyRules.length() + allowRules.length() > 0) {
                  StatusBar.Info.set(
                      AnalysisScopeBundle.message(
                          "status.bar.rule.violation.message",
                          ((denyRules.length() == 0 || allowRules.length() == 0) ? 1 : 2),
                          (denyRules.length() > 0
                                  ? denyRules.toString() + (allowRules.length() > 0 ? "; " : "")
                                  : " ")
                              + (allowRules.length() > 0 ? allowRules.toString() : " ")),
                      myProject);
                } else {
                  StatusBar.Info.set(
                      AnalysisScopeBundle.message("status.bar.no.rule.violation.message"),
                      myProject);
                }
              }
            });

    myRightTree
        .getSelectionModel()
        .addTreeSelectionListener(
            new TreeSelectionListener() {
              public void valueChanged(TreeSelectionEvent e) {
                SwingUtilities.invokeLater(
                    new Runnable() {
                      public void run() {
                        final Set<PsiFile> searchIn = getSelectedScope(myLeftTree);
                        final Set<PsiFile> searchFor = getSelectedScope(myRightTree);
                        if (searchIn.isEmpty() || searchFor.isEmpty()) {
                          myUsagesPanel.setToInitialPosition();
                          processDependencies(
                              searchIn,
                              searchFor,
                              new Processor<List<PsiFile>>() { // todo do not show too many usages
                                public boolean process(final List<PsiFile> path) {
                                  searchFor.add(path.get(1));
                                  return true;
                                }
                              });
                        } else {
                          myUsagesPanel.findUsages(searchIn, searchFor);
                        }
                      }
                    });
              }
            });

    initTree(myLeftTree, false);
    initTree(myRightTree, true);

    if (builders.size() == 1) {
      AnalysisScope scope = builders.get(0).getScope();
      if (scope.getScopeType() == AnalysisScope.FILE) {
        Set<PsiFile> oneFileSet = myDependencies.keySet();
        if (oneFileSet.size() == 1) {
          selectElementInLeftTree(oneFileSet.iterator().next());
          return;
        }
      }
    }
    TreeUtil.selectFirstNode(myLeftTree);
  }
  public JPanel getPanel() {
    if (mySplitter == null) {
      mySplitter = new Splitter(false, 0.5f);
      final String value = PropertiesComponent.getInstance().getValue(SPLITTER_PROPORTION);
      if (value != null) {
        mySplitter.setProportion(Float.parseFloat(value));
      }

      mySplitter.setFirstComponent(
          ToolbarDecorator.createDecorator(myMacrosList)
              .setEditAction(
                  new AnActionButtonRunnable() {
                    @Override
                    public void run(AnActionButton button) {
                      final int selIndex = myMacrosList.getSelectedIndex();
                      if (selIndex == -1) return;
                      final ActionMacro macro = (ActionMacro) myMacrosModel.getElementAt(selIndex);
                      String newName;
                      do {
                        newName =
                            Messages.showInputDialog(
                                mySplitter,
                                IdeBundle.message("prompt.enter.new.name"),
                                IdeBundle.message("title.rename.macro"),
                                Messages.getQuestionIcon(),
                                macro.getName(),
                                null);
                        if (newName == null || macro.getName().equals(newName)) return;
                      } while (!canRenameMacro(newName));

                      if (myRenamingList == null)
                        myRenamingList = new ArrayList<Pair<String, String>>();
                      myRenamingList.add(new Pair<String, String>(macro.getName(), newName));
                      macro.setName(newName);
                      myMacrosList.repaint();
                    }

                    private boolean canRenameMacro(final String name) {
                      final Enumeration elements = myMacrosModel.elements();
                      while (elements.hasMoreElements()) {
                        final ActionMacro macro = (ActionMacro) elements.nextElement();
                        if (macro.getName().equals(name)) {
                          if (Messages.showYesNoDialog(
                                  IdeBundle.message("message.macro.exists", name),
                                  IdeBundle.message("title.macro.name.already.used"),
                                  Messages.getWarningIcon())
                              != 0) {
                            return false;
                          }
                          myMacrosModel.removeElement(macro);
                          break;
                        }
                      }
                      return true;
                    }
                  })
              .disableAddAction()
              .disableUpDownActions()
              .createPanel());

      mySplitter.setSecondComponent(
          ToolbarDecorator.createDecorator(myMacroActionsList)
              .setRemoveAction(
                  new AnActionButtonRunnable() {
                    @Override
                    public void run(AnActionButton button) {
                      final int macrosSelectedIndex = myMacrosList.getSelectedIndex();
                      if (macrosSelectedIndex != -1) {
                        final ActionMacro macro =
                            (ActionMacro) myMacrosModel.getElementAt(macrosSelectedIndex);
                        macro.deleteAction(myMacroActionsList.getSelectedIndex());
                      }
                      ListUtil.removeSelectedItems(myMacroActionsList);
                    }
                  })
              .disableAddAction()
              .disableUpDownActions()
              .createPanel());
    }
    return mySplitter;
  }
 public void addMongoDocument() {
   mongoEditionPanel.updateEditionTree(null);
   splitter.setSecondComponent(mongoEditionPanel);
 }
 private void hideEditionPanel() {
   splitter.setSecondComponent(null);
 }
  @Override
  public JComponent createComponent() {
    myMainPanel = new JPanel(new GridBagLayout());
    myNameField = new JTextField();
    myExtensionField = new JTextField();
    mySplitter = new Splitter(true, 0.4f);

    myTemplateEditor = createEditor();

    myDescriptionComponent = new JEditorPane(UIUtil.HTML_MIME, EMPTY_HTML);
    myDescriptionComponent.setEditable(false);

    myAdjustBox = new JCheckBox(IdeBundle.message("checkbox.reformat.according.to.style"));
    myTopPanel = new JPanel(new GridBagLayout());

    myDescriptionPanel = new JPanel(new GridBagLayout());
    myDescriptionPanel.add(
        SeparatorFactory.createSeparator(IdeBundle.message("label.description"), null),
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(0, 0, 2, 0),
            0,
            0));
    myDescriptionPanel.add(
        ScrollPaneFactory.createScrollPane(myDescriptionComponent),
        new GridBagConstraints(
            0,
            1,
            1,
            1,
            1.0,
            1.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(2, 0, 0, 0),
            0,
            0));

    myMainPanel.add(
        myTopPanel,
        new GridBagConstraints(
            0,
            0,
            4,
            1,
            1.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL,
            new Insets(0, 0, 2, 0),
            0,
            0));
    myMainPanel.add(
        myAdjustBox,
        new GridBagConstraints(
            0,
            1,
            4,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 0, 2, 0),
            0,
            0));
    myMainPanel.add(
        mySplitter,
        new GridBagConstraints(
            0,
            2,
            4,
            1,
            1.0,
            1.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(2, 0, 0, 0),
            0,
            0));

    mySplitter.setSecondComponent(myDescriptionPanel);
    setShowInternalMessage(null);

    myNameField.addFocusListener(
        new FocusAdapter() {
          @Override
          public void focusLost(FocusEvent e) {
            onNameChanged();
          }
        });
    myExtensionField.addFocusListener(
        new FocusAdapter() {
          @Override
          public void focusLost(FocusEvent e) {
            onNameChanged();
          }
        });
    myMainPanel.setPreferredSize(new Dimension(400, 300));
    return myMainPanel;
  }
  public DetectedPluginsPanel() {
    super(PluginDownloader.class);
    final JTable entryTable = getEntryTable();
    myHeader = new PluginHeaderPanel(null, entryTable);
    entryTable.setTableHeader(null);
    entryTable.setDefaultRenderer(
        PluginDownloader.class,
        new ColoredTableCellRenderer() {
          protected void customizeCellRenderer(
              final JTable table,
              final Object value,
              final boolean selected,
              final boolean hasFocus,
              final int row,
              final int column) {
            setBorder(null);
            final PluginDownloader downloader = (PluginDownloader) value;
            if (downloader != null) {
              final String pluginName = downloader.getPluginName();
              append(pluginName, SimpleTextAttributes.REGULAR_ATTRIBUTES);
              final IdeaPluginDescriptor ideaPluginDescriptor =
                  PluginManager.getPlugin(PluginId.getId(downloader.getPluginId()));
              if (ideaPluginDescriptor != null) {
                final String oldPluginName = ideaPluginDescriptor.getName();
                if (!Comparing.strEqual(pluginName, oldPluginName)) {
                  append(" - " + oldPluginName, SimpleTextAttributes.REGULAR_ATTRIBUTES);
                }
              }
              final String loadedVersion = downloader.getPluginVersion();
              if (loadedVersion != null
                  || (ideaPluginDescriptor != null && ideaPluginDescriptor.getVersion() != null)) {
                final String installedVersion =
                    ideaPluginDescriptor != null && ideaPluginDescriptor.getVersion() != null
                        ? "v. "
                            + ideaPluginDescriptor.getVersion()
                            + (loadedVersion != null ? " -> " : "")
                        : "";
                final String availableVersion = loadedVersion != null ? loadedVersion : "";
                append(
                    " (" + installedVersion + availableVersion + ")",
                    SimpleTextAttributes.GRAY_ATTRIBUTES);
              }
            }
          }
        });
    entryTable
        .getSelectionModel()
        .addListSelectionListener(
            new ListSelectionListener() {
              public void valueChanged(ListSelectionEvent e) {
                final int selectedRow = entryTable.getSelectedRow();
                if (selectedRow != -1) {
                  final PluginDownloader selection = getValueAt(selectedRow);
                  final IdeaPluginDescriptor descriptor = selection.getDescriptor();
                  if (descriptor != null) {
                    PluginManagerMain.pluginInfoUpdate(
                        descriptor, null, myDescriptionPanel, myHeader, null);
                  }
                }
              }
            });
    setCheckboxColumnName("");
    myDescriptionPanel.setPreferredSize(new Dimension(400, -1));
    myDescriptionPanel.setEditable(false);
    myDescriptionPanel.setContentType(UIUtil.HTML_MIME);
    myDescriptionPanel.addHyperlinkListener(new PluginManagerMain.MyHyperlinkListener());
    removeAll();

    final Splitter splitter = new Splitter(false);
    splitter.setFirstComponent(ScrollPaneFactory.createScrollPane(entryTable));
    splitter.setSecondComponent(ScrollPaneFactory.createScrollPane(myDescriptionPanel));
    add(splitter, BorderLayout.CENTER);
  }