List of usage examples for com.intellij.openapi.ui SplitterProportionsData restoreSplitterProportions
void restoreSplitterProportions(Component root);
From source file:com.intellij.history.integration.ui.views.HistoryDialog.java
License:Apache License
private void restoreSplitterProportion() { SplitterProportionsData d = createSplitterData(); d.externalizeFromDimensionService(getPropertiesKey()); d.restoreSplitterProportions(mySplitter); }
From source file:com.vladsch.MissingInActions.util.ContentChooser.java
License:Apache License
@Override protected JComponent createCenterPanel() { final int selectionMode = myAllowMultipleSelections ? ListSelectionModel.MULTIPLE_INTERVAL_SELECTION : ListSelectionModel.SINGLE_SELECTION; myList.setSelectionMode(selectionMode); if (myUseIdeaEditor) { EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme(); myList.setFont(scheme.getFont(EditorFontType.PLAIN)); Color fg = ObjectUtils.chooseNotNull(scheme.getDefaultForeground(), new JBColor(UIUtil::getListForeground)); Color bg = ObjectUtils.chooseNotNull(scheme.getDefaultBackground(), new JBColor(UIUtil::getListBackground)); myList.setForeground(fg);//from w w w . j ava2s .c o m myList.setBackground(bg); } new DoubleClickListener() { @Override protected boolean onDoubleClick(MouseEvent e) { close(OK_EXIT_CODE); return true; } }.installOn(myList); myList.setCellRenderer(new MyListCellRenderer()); myList.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_DELETE) { int newSelectionIndex = -1; for (Object o : myList.getSelectedValues()) { int i = ((Item) o).index; removeContentAt(myAllContents.get(i)); if (newSelectionIndex < 0) { newSelectionIndex = i; } } rebuildListContent(); if (myAllContents.isEmpty()) { close(CANCEL_EXIT_CODE); return; } newSelectionIndex = Math.min(newSelectionIndex, myAllContents.size() - 1); myList.setSelectedIndex(newSelectionIndex); } else if (e.getKeyCode() == KeyEvent.VK_ENTER) { doOKAction(); } else { final char aChar = e.getKeyChar(); if (aChar >= '0' && aChar <= '9') { int idx = aChar == '0' ? 9 : aChar - '1'; if (idx < myAllContents.size()) { myList.setSelectedIndex(idx); e.consume(); doOKAction(); } } else { listKeyPressed(e); } } } }); mySplitter.setFirstComponent( ListWithFilter.wrap(myList, ScrollPaneFactory.createScrollPane(myList), o -> ((Item) o).longText)); mySplitter.setSecondComponent(new JPanel()); rebuildListContent(); ScrollingUtil.installActions(myList); ScrollingUtil.ensureSelectionExists(myList); updateViewerForSelection(); myList.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { myUpdateAlarm.cancelAllRequests(); myUpdateAlarm.addRequest(() -> updateViewerForSelection(), 100); } }); mySplitter.setPreferredSize(JBUI.size(500, 500)); SplitterProportionsData d = new SplitterProportionsDataImpl(); d.externalizeToDimensionService(getClass().getName()); d.restoreSplitterProportions(mySplitter); return mySplitter; }