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(); } }
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; }
private void setEmpty() { myDetails.setContent(null); myDetails.setEmptyContentText(getEmptySelectionString()); }
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; }