use of com.intellij.openapi.ui.Splitter in project intellij-community by JetBrains.
the class ToBeMergedDialog method initUI.
private void initUI() {
final ListSelectionListener selectionListener = e -> {
List<SvnChangeList> changeLists = myRevisionsList.getSelectedObjects();
myAlreadyMerged.clear();
for (SvnChangeList changeList : changeLists) {
myAlreadyMerged.addAll(getAlreadyMergedPaths(changeList));
}
myRepositoryChangesBrowser.setChangesToDisplay(collectChanges(changeLists, false));
mySplitter.doLayout();
myRepositoryChangesBrowser.repaint();
};
final MyListCellRenderer listCellRenderer = new MyListCellRenderer();
myRevisionsList = new TableView<SvnChangeList>() {
@Override
public TableCellRenderer getCellRenderer(int row, int column) {
return listCellRenderer;
}
@Override
public void valueChanged(ListSelectionEvent e) {
super.valueChanged(e);
selectionListener.valueChanged(e);
}
};
myRevisionsList.setExpandableItemsEnabled(false);
new TableViewSpeedSearch<SvnChangeList>(myRevisionsList) {
@Override
protected String getItemText(@NotNull SvnChangeList element) {
return element.getComment();
}
};
myRevisionsList.setModelAndUpdateColumns(myRevisionsModel);
myRevisionsList.setTableHeader(null);
myRevisionsList.setShowGrid(false);
final AbstractBaseTagMouseListener mouseListener = new AbstractBaseTagMouseListener() {
@Override
public Object getTagAt(@NotNull MouseEvent e) {
JTable table = (JTable) e.getSource();
int row = table.rowAtPoint(e.getPoint());
int column = table.columnAtPoint(e.getPoint());
if (row == -1 || column == -1)
return null;
listCellRenderer.customizeCellRenderer(table, table.getValueAt(row, column), table.isRowSelected(row));
return listCellRenderer.myRenderer.getFragmentTagAt(e.getPoint().x - table.getCellRect(row, column, false).x);
}
};
mouseListener.installOn(myRevisionsList);
myMore100Action = new MoreXAction(100);
myMore500Action = new MoreXAction(500);
BorderLayoutPanel panel = JBUI.Panels.simplePanel().addToCenter(ScrollPaneFactory.createScrollPane(myRevisionsList)).addToTop(createToolbar().getComponent());
mySplitter = new Splitter(false, 0.7f);
mySplitter.setFirstComponent(panel);
myRepositoryChangesBrowser = new RepositoryChangesBrowser(myMergeContext.getProject(), Collections.<SvnChangeList>emptyList(), emptyList(), null);
myRepositoryChangesBrowser.getDiffAction().registerCustomShortcutSet(myRepositoryChangesBrowser.getDiffAction().getShortcutSet(), myRevisionsList);
setChangesDecorator();
mySplitter.setSecondComponent(myRepositoryChangesBrowser);
mySplitter.setDividerWidth(2);
addRevisionListListeners();
myPanel.add(mySplitter, BorderLayout.CENTER);
}
use of com.intellij.openapi.ui.Splitter in project intellij-community by JetBrains.
the class ModuleAwareProjectConfigurable method createComponent.
@Override
public JComponent createComponent() {
if (myProject.isDefault()) {
T configurable = createDefaultProjectConfigurable();
if (configurable != null) {
myModuleConfigurables.put(null, configurable);
return configurable.createComponent();
}
}
final List<Module> modules = ContainerUtil.filter(ModuleAttachProcessor.getSortedModules(myProject), module -> isSuitableForModule(module));
final T projectConfigurable = createProjectConfigurable();
if (modules.size() == 1 && projectConfigurable == null) {
Module module = modules.get(0);
final T configurable = createModuleConfigurable(module);
myModuleConfigurables.put(module, configurable);
return configurable.createComponent();
}
final Splitter splitter = new Splitter(false, 0.25f);
CollectionListModel<Module> listDataModel = new CollectionListModel<>(modules);
final JBList moduleList = new JBList(listDataModel);
new ListSpeedSearch(moduleList, (Function<Object, String>) o -> {
if (o == null) {
return getProjectConfigurableItemName();
} else if (o instanceof Module) {
return ((Module) o).getName();
}
return null;
});
moduleList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
moduleList.setCellRenderer(new ModuleListCellRenderer() {
@Override
public void customize(JList list, Module module, int index, boolean selected, boolean hasFocus) {
if (module == null) {
setText(getProjectConfigurableItemName());
setIcon(getProjectConfigurableItemIcon());
} else {
super.customize(list, module, index, selected, hasFocus);
}
}
});
splitter.setFirstComponent(new JBScrollPane(moduleList));
final CardLayout layout = new CardLayout();
final JPanel cardPanel = new JPanel(layout);
splitter.setSecondComponent(cardPanel);
if (projectConfigurable != null) {
myModuleConfigurables.put(null, projectConfigurable);
final JComponent component = projectConfigurable.createComponent();
cardPanel.add(component, PROJECT_ITEM_KEY);
listDataModel.add(0, null);
}
for (Module module : modules) {
final T configurable = createModuleConfigurable(module);
myModuleConfigurables.put(module, configurable);
final JComponent component = configurable.createComponent();
cardPanel.add(component, module.getName());
}
moduleList.addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
final Module value = (Module) moduleList.getSelectedValue();
layout.show(cardPanel, value == null ? PROJECT_ITEM_KEY : value.getName());
}
});
if (moduleList.getItemsCount() > 0) {
moduleList.setSelectedIndex(0);
Module module = listDataModel.getElementAt(0);
layout.show(cardPanel, module == null ? PROJECT_ITEM_KEY : module.getName());
}
return splitter;
}
use of com.intellij.openapi.ui.Splitter in project intellij-community by JetBrains.
the class TodoPanel method createCenterComponent.
protected JComponent createCenterComponent() {
Splitter splitter = new OnePixelSplitter(false);
splitter.setSecondComponent(myUsagePreviewPanel);
splitter.setFirstComponent(ScrollPaneFactory.createScrollPane(myTree));
return splitter;
}
use of com.intellij.openapi.ui.Splitter in project intellij-community by JetBrains.
the class SlicePanel method layoutPanel.
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();
}
use of com.intellij.openapi.ui.Splitter in project intellij-community by JetBrains.
the class ConsoleConfigurable method createComponent.
@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(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());
northPanel.add(new JLabel(" KB"), 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;
}
Aggregations