Exemplo n.º 1
0
  protected void updateSelection(@Nullable NamedConfigurable configurable) {
    myDetails.setText(configurable != null ? configurable.getBannerSlogan() : null);

    myCurrentConfigurable = configurable;

    if (configurable != null) {
      final JComponent comp = configurable.createComponent();
      if (comp == null) {
        setEmpty();
        LOG.error("createComponent() returned null. configurable=" + configurable);
      } else {
        myDetails.setContent(comp);
        ensureInitialized(configurable);
        myHistory.pushPlaceForElement(TREE_OBJECT, configurable.getEditableObject());
      }
    } else {
      setEmpty();
    }
  }
Exemplo n.º 2
0
 public void disposeUIResources() {
   myState.getProportions().saveSplitterProportions(myWholePanel);
   myAutoScrollHandler.cancelAllRequests();
   myDetails.disposeUIResources();
   myInitializedConfigurables.clear();
   clearChildren();
   final String key = getComponentStateKey();
   final MasterDetailsStateService stateService = getStateService();
   if (key != null && stateService != null) {
     stateService.setComponentState(key, getState());
   }
   myCurrentConfigurable = null;
 }
Exemplo n.º 3
0
 private void setEmpty() {
   myDetails.setContent(null);
   myDetails.setEmptyContentText(getEmptySelectionString());
 }
Exemplo n.º 4
0
  protected void reInitWholePanelIfNeeded() {
    if (!myToReInitWholePanel) return;

    myWholePanel =
        new JPanel(new BorderLayout()) {
          public void addNotify() {
            super.addNotify();
            MasterDetailsComponent.this.addNotify();

            TreeModel m = myTree.getModel();
            if (m instanceof DefaultTreeModel) {
              DefaultTreeModel model = (DefaultTreeModel) m;
              for (int eachRow = 0; eachRow < myTree.getRowCount(); eachRow++) {
                TreePath eachPath = myTree.getPathForRow(eachRow);
                Object component = eachPath.getLastPathComponent();
                if (component instanceof TreeNode) {
                  model.nodeChanged((TreeNode) component);
                }
              }
            }
          }
        };
    mySplitter.setHonorComponentsMinimumSize(true);
    myWholePanel.add(mySplitter, BorderLayout.CENTER);

    JPanel left =
        new JPanel(new BorderLayout()) {
          public Dimension getMinimumSize() {
            final Dimension original = super.getMinimumSize();
            return new Dimension(Math.max(original.width, 100), original.height);
          }
        };

    if (isNewProjectSettings()) {
      ToolbarDecorator decorator = ToolbarDecorator.createDecorator(myTree);
      DefaultActionGroup group = createToolbarActionGroup();
      if (group != null) {
        decorator.setActionGroup(group);
      }
      // left.add(myNorthPanel, BorderLayout.NORTH);
      myMaster =
          decorator.setAsUsualTopToolbar().setPanelBorder(JBUI.Borders.empty()).createPanel();
      myNorthPanel.setVisible(false);
    } else {
      left.add(myNorthPanel, BorderLayout.NORTH);
      myMaster = ScrollPaneFactory.createScrollPane(myTree);
    }
    left.add(myMaster, BorderLayout.CENTER);
    mySplitter.setFirstComponent(left);

    final JPanel right = new JPanel(new BorderLayout());
    right.add(myDetails.getComponent(), BorderLayout.CENTER);
    if (!isNewProjectSettings()) {
      myWholePanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    }

    mySplitter.setSecondComponent(right);

    GuiUtils.replaceJSplitPaneWithIDEASplitter(myWholePanel);

    myToReInitWholePanel = false;
  }