use of com.intellij.openapi.ui.Splitter in project intellij-community by JetBrains.
the class CallerChooserBase method createCenterPanel.
@Override
protected JComponent createCenterPanel() {
Splitter splitter = new Splitter(false, (float) 0.6);
JPanel result = new JPanel(new BorderLayout());
if (myTree == null) {
myTree = createTree();
} else {
final CheckedTreeNode root = (CheckedTreeNode) myTree.getModel().getRoot();
myRoot = (MethodNodeBase) root.getFirstChild();
}
myTreeSelectionListener = new TreeSelectionListener() {
@Override
public void valueChanged(TreeSelectionEvent e) {
final TreePath path = e.getPath();
if (path != null) {
final MethodNodeBase<M> node = (MethodNodeBase) path.getLastPathComponent();
myAlarm.cancelAllRequests();
myAlarm.addRequest(() -> updateEditorTexts(node), 300);
}
}
};
myTree.getSelectionModel().addTreeSelectionListener(myTreeSelectionListener);
JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTree);
splitter.setFirstComponent(scrollPane);
final JComponent callSitesViewer = createCallSitesViewer();
TreePath selectionPath = myTree.getSelectionPath();
if (selectionPath == null) {
selectionPath = new TreePath(myRoot.getPath());
myTree.getSelectionModel().addSelectionPath(selectionPath);
}
final MethodNodeBase<M> node = (MethodNodeBase) selectionPath.getLastPathComponent();
updateEditorTexts(node);
splitter.setSecondComponent(callSitesViewer);
result.add(splitter);
return result;
}
use of com.intellij.openapi.ui.Splitter in project intellij-community by JetBrains.
the class CallerChooserBase method createCallSitesViewer.
private JComponent createCallSitesViewer() {
Splitter splitter = new Splitter(true);
myCallerEditor = createEditor();
myCalleeEditor = createEditor();
final JComponent callerComponent = myCallerEditor.getComponent();
callerComponent.setBorder(IdeBorderFactory.createTitledBorder(RefactoringBundle.message("caller.chooser.caller.method"), false));
splitter.setFirstComponent(callerComponent);
final JComponent calleeComponent = myCalleeEditor.getComponent();
calleeComponent.setBorder(IdeBorderFactory.createTitledBorder(RefactoringBundle.message("caller.chooser.callee.method"), false));
splitter.setSecondComponent(calleeComponent);
splitter.setBorder(IdeBorderFactory.createRoundedBorder());
return splitter;
}
use of com.intellij.openapi.ui.Splitter in project intellij-community by JetBrains.
the class SelectTemplateDialog method createCenterPanel.
protected JComponent createCenterPanel() {
final JPanel centerPanel = new JPanel(new BorderLayout());
Splitter splitter;
centerPanel.add(BorderLayout.CENTER, splitter = new Splitter(false, 0.3f));
centerPanel.add(splitter);
splitter.setFirstComponent(showHistory ? existingTemplatesComponent.getHistoryPanel() : existingTemplatesComponent.getTemplatesPanel());
final JPanel panel;
splitter.setSecondComponent(panel = new JPanel(new BorderLayout()));
searchPatternEditor = UIUtil.createEditor(EditorFactory.getInstance().createDocument(""), project, false, true, ContainerUtil.findInstance(TemplateContextType.EP_NAME.getExtensions(), TemplateContextType.class));
JComponent centerComponent;
if (replace) {
replacePatternEditor = UIUtil.createEditor(EditorFactory.getInstance().createDocument(""), project, false, true, ContainerUtil.findInstance(TemplateContextType.EP_NAME.getExtensions(), TemplateContextType.class));
centerComponent = new Splitter(true);
((Splitter) centerComponent).setFirstComponent(searchPatternEditor.getComponent());
((Splitter) centerComponent).setSecondComponent(replacePatternEditor.getComponent());
} else {
centerComponent = searchPatternEditor.getComponent();
}
myCardLayout = new CardLayout();
myPreviewPanel = new JPanel(myCardLayout);
myPreviewPanel.add(centerComponent, PREVIEW_CARD);
JPanel selectPanel = new JPanel(new GridBagLayout());
GridBagConstraints gb = new GridBagConstraints(0, 0, 0, 0, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0);
selectPanel.add(new JLabel(SSRBundle.message("selecttemplate.template.label.please.select.template")), gb);
myPreviewPanel.add(selectPanel, SELECT_TEMPLATE_CARD);
panel.add(BorderLayout.CENTER, myPreviewPanel);
final JPanel labelPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 2, 0));
labelPanel.add(new JLabel(SSRBundle.message("selecttemplate.template.preview")));
labelPanel.add(UIUtil.createCompleteMatchInfo(() -> {
final Configuration[] configurations = getSelectedConfigurations();
return configurations.length != 1 ? null : configurations[0];
}));
panel.add(BorderLayout.NORTH, labelPanel);
return centerPanel;
}
use of com.intellij.openapi.ui.Splitter in project intellij-community by JetBrains.
the class OverridingMethodsDialog method createCenterPanel.
protected JComponent createCenterPanel() {
JPanel panel = new JPanel(new BorderLayout());
panel.setBorder(BorderFactory.createEmptyBorder(8, 0, 4, 0));
final MyTableModel tableModel = new MyTableModel();
myTable = new Table(tableModel);
myTable.setShowGrid(false);
TableColumnModel columnModel = myTable.getColumnModel();
// columnModel.getColumn(DISPLAY_NAME_COLUMN).setCellRenderer(new MemberSelectionTable.MyTableRenderer());
TableColumn checkboxColumn = columnModel.getColumn(CHECK_COLUMN);
TableUtil.setupCheckboxColumn(checkboxColumn);
checkboxColumn.setCellRenderer(new BooleanTableCellRenderer());
// make SPACE check/uncheck selected rows
@NonNls InputMap inputMap = myTable.getInputMap();
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0), "enable_disable");
@NonNls final ActionMap actionMap = myTable.getActionMap();
actionMap.put("enable_disable", new AbstractAction() {
public void actionPerformed(ActionEvent e) {
if (myTable.isEditing())
return;
int[] rows = myTable.getSelectedRows();
if (rows.length > 0) {
boolean valueToBeSet = false;
for (int row : rows) {
if (!myChecked[row]) {
valueToBeSet = true;
break;
}
}
for (int row : rows) {
myChecked[row] = valueToBeSet;
}
tableModel.updateData();
}
}
});
/*Border titledBorder = IdeBorderFactory.createBoldTitledBorder("Select methods");
Border emptyBorder = BorderFactory.createEmptyBorder(0, 5, 5, 5);
Border border = BorderFactory.createCompoundBorder(titledBorder, emptyBorder);
panel.setBorder(border);*/
panel.setLayout(new BorderLayout());
JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTable);
panel.add(scrollPane, BorderLayout.CENTER);
ListSelectionListener selectionListener = new ListSelectionListener() {
public void valueChanged(final ListSelectionEvent e) {
int index = myTable.getSelectionModel().getLeadSelectionIndex();
if (index != -1) {
UsageInfo usageInfo = myOverridingMethods.get(index);
myUsagePreviewPanel.updateLayout(Collections.singletonList(usageInfo));
} else {
myUsagePreviewPanel.updateLayout(null);
}
}
};
myTable.getSelectionModel().addListSelectionListener(selectionListener);
final Splitter splitter = new Splitter(true, 0.3f);
splitter.setFirstComponent(panel);
splitter.setSecondComponent(myUsagePreviewPanel);
myUsagePreviewPanel.updateLayout(null);
Disposer.register(myDisposable, new Disposable() {
public void dispose() {
splitter.dispose();
}
});
if (tableModel.getRowCount() != 0) {
myTable.getSelectionModel().addSelectionInterval(0, 0);
}
return splitter;
}
use of com.intellij.openapi.ui.Splitter in project intellij-community by JetBrains.
the class ReplaceConstructorWithBuilderDialog method createCenterPanel.
protected JComponent createCenterPanel() {
final Splitter splitter = new Splitter(true);
splitter.setFirstComponent(createTablePanel());
splitter.setSecondComponent(myWholePanel);
final ActionListener enableDisableListener = new ActionListener() {
public void actionPerformed(final ActionEvent e) {
setEnabled(myCreateBuilderClassRadioButton.isSelected());
IdeFocusManager.getInstance(myProject).requestFocus(myCreateBuilderClassRadioButton.isSelected() ? myNewClassName : myExistentClassTF.getChildComponent(), true);
validateButtons();
}
};
myCreateBuilderClassRadioButton.addActionListener(enableDisableListener);
myExistingBuilderClassRadioButton.addActionListener(enableDisableListener);
myCreateBuilderClassRadioButton.setSelected(true);
setEnabled(true);
final DocumentAdapter validateButtonsListener = new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent e) {
validateButtons();
}
};
myNewClassName.getDocument().addDocumentListener(validateButtonsListener);
final PsiClass psiClass = myConstructors[0].getContainingClass();
LOG.assertTrue(psiClass != null);
myNewClassName.setText(psiClass.getName() + "Builder");
return splitter;
}
Aggregations