use of com.intellij.openapi.ui.Splitter in project intellij-community by JetBrains.
the class EditorWindow method findSiblings.
public EditorWindow[] findSiblings() {
checkConsistency();
final ArrayList<EditorWindow> res = new ArrayList<>();
if (myPanel.getParent() instanceof Splitter) {
final Splitter splitter = (Splitter) myPanel.getParent();
for (final EditorWindow win : myOwner.getWindows()) {
if (win != this && SwingUtilities.isDescendingFrom(win.myPanel, splitter)) {
res.add(win);
}
}
}
return res.toArray(new EditorWindow[res.size()]);
}
use of com.intellij.openapi.ui.Splitter in project intellij-community by JetBrains.
the class UsageViewImpl method setupCentralPanel.
private void setupCentralPanel() {
ApplicationManager.getApplication().assertIsDispatchThread();
myCentralPanel.removeAll();
disposeUsageContextPanels();
JScrollPane treePane = ScrollPaneFactory.createScrollPane(myTree);
// add reaction to scrolling:
// since the UsageViewTreeCellRenderer ignores invisible nodes (outside the viewport), their preferred size is incorrect
// and we need to recalculate them when the node scrolled into the visible rectangle
treePane.getViewport().addChangeListener(__ -> clearRendererCache());
myPreviewSplitter = new Splitter(false, 0.5f, 0.1f, 0.9f);
myPreviewSplitter.setFirstComponent(treePane);
myCentralPanel.add(myPreviewSplitter, BorderLayout.CENTER);
if (UsageViewSettings.getInstance().IS_PREVIEW_USAGES) {
myPreviewSplitter.setProportion(UsageViewSettings.getInstance().PREVIEW_USAGES_SPLITTER_PROPORTIONS);
treePane.putClientProperty(UIUtil.KEEP_BORDER_SIDES, SideBorder.RIGHT);
final JBTabbedPane tabbedPane = new JBTabbedPane(SwingConstants.BOTTOM) {
@NotNull
@Override
protected Insets getInsetsForTabComponent() {
return new Insets(0, 0, 0, 0);
}
};
UsageContextPanel.Provider[] extensions = Extensions.getExtensions(UsageContextPanel.Provider.EP_NAME, myProject);
myUsageContextPanelProviders = ContainerUtil.filter(extensions, provider -> provider.isAvailableFor(this));
for (UsageContextPanel.Provider provider : myUsageContextPanelProviders) {
JComponent component;
if (myCurrentUsageContextProvider == null || myCurrentUsageContextProvider == provider) {
myCurrentUsageContextProvider = provider;
myCurrentUsageContextPanel = provider.create(this);
component = myCurrentUsageContextPanel.createComponent();
} else {
component = new JLabel();
}
tabbedPane.addTab(provider.getTabTitle(), component);
}
int index = myUsageContextPanelProviders.indexOf(myCurrentUsageContextProvider);
tabbedPane.setSelectedIndex(index);
tabbedPane.addChangeListener(e -> {
int currentIndex = tabbedPane.getSelectedIndex();
UsageContextPanel.Provider selectedProvider = myUsageContextPanelProviders.get(currentIndex);
if (selectedProvider != myCurrentUsageContextProvider) {
tabSelected(selectedProvider);
}
});
tabbedPane.setBorder(IdeBorderFactory.createBorder(SideBorder.LEFT));
myPreviewSplitter.setSecondComponent(tabbedPane);
} else {
myPreviewSplitter.setProportion(1);
}
myCentralPanel.add(myAdditionalComponent, BorderLayout.SOUTH);
myAdditionalComponent.add(myButtonPanel, BorderLayout.SOUTH);
myRootPanel.revalidate();
myRootPanel.repaint();
}
use of com.intellij.openapi.ui.Splitter in project intellij-community by JetBrains.
the class ChangeListViewerDialog method createCenterPanel.
public JComponent createCenterPanel() {
final JPanel mainPanel = new JPanel();
mainPanel.setLayout(new BorderLayout());
final Splitter splitter = new Splitter(true, 0.8f);
myChangesBrowser = new RepositoryChangesBrowser(myProject, Collections.singletonList(myChangeList), new ArrayList<>(myChangeList.getChanges()), myChangeList, myToSelect) {
@Override
protected void buildToolBar(DefaultActionGroup toolBarGroup) {
super.buildToolBar(toolBarGroup);
toolBarGroup.add(ActionManager.getInstance().getAction(VcsActions.ACTION_COPY_REVISION_NUMBER));
}
};
Disposer.register(getDisposable(), myChangesBrowser);
myChangesBrowser.setUseCase(myInAir ? CommittedChangesBrowserUseCase.IN_AIR : null);
splitter.setFirstComponent(myChangesBrowser);
if (myCommitMessageArea != null) {
JPanel commitPanel = new JPanel(new BorderLayout());
JComponent separator = SeparatorFactory.createSeparator(VcsBundle.message("label.commit.comment"), myCommitMessageArea);
commitPanel.add(separator, BorderLayout.NORTH);
commitPanel.add(commitMessageScroll, BorderLayout.CENTER);
splitter.setSecondComponent(commitPanel);
}
mainPanel.add(splitter, BorderLayout.CENTER);
final String description = getDescription();
if (description != null) {
JPanel descPanel = new JPanel();
descPanel.add(new JLabel(XmlStringUtil.wrapInHtml(description)));
descPanel.setBorder(BorderFactory.createEtchedBorder());
mainPanel.add(descPanel, BorderLayout.NORTH);
}
return mainPanel;
}
use of com.intellij.openapi.ui.Splitter in project intellij-community by JetBrains.
the class CopyOptionsDialog method createUI.
private void createUI() {
myMainPanel = new JPanel(new BorderLayout());
myBrowser = new RepositoryBrowserComponent(SvnVcs.getInstance(myProject));
final DefaultActionGroup group = new DefaultActionGroup();
group.add(new RepositoryBrowserDialog.MkDirAction(myBrowser) {
@Override
public void update(AnActionEvent e) {
super.update(e);
e.getPresentation().setText("New Remote Folder...");
}
});
group.add(new RepositoryBrowserDialog.DeleteAction(myBrowser));
group.add(new RepositoryBrowserDialog.RefreshAction(myBrowser));
final ActionPopupMenu popupMenu = ActionManager.getInstance().createActionPopupMenu("", group);
final JPopupMenu component = popupMenu.getComponent();
myBrowser.getRepositoryTree().addMouseListener(new PopupHandler() {
@Override
public void invokePopup(Component comp, int x, int y) {
component.show(comp, x, y);
}
});
final Splitter splitter = new Splitter(true);
splitter.setProportion(0.7f);
final JPanel wrapper = createBrowserPartWrapper();
splitter.setFirstComponent(wrapper);
final JPanel commitMessageWrapper = createCommitMessageWrapper();
splitter.setSecondComponent(commitMessageWrapper);
myMainPanel.add(splitter, BorderLayout.CENTER);
final JPanel recentMessagesWrapper = new JPanel(new BorderLayout());
recentMessagesWrapper.add(new JLabel("Recent Messages:"), BorderLayout.NORTH);
myMessagesBox = new JComboBox();
recentMessagesWrapper.add(myMessagesBox, BorderLayout.SOUTH);
recentMessagesWrapper.setBorder(JBUI.Borders.emptyTop(4));
myMainPanel.add(recentMessagesWrapper, BorderLayout.SOUTH);
}
use of com.intellij.openapi.ui.Splitter in project intellij-community by JetBrains.
the class ReplaceDialog method createEditorContent.
@Override
protected JComponent createEditorContent() {
JPanel result = new JPanel(new BorderLayout());
Splitter p;
result.add(BorderLayout.CENTER, p = new Splitter(true, 0.5f));
p.setFirstComponent(super.createEditorContent());
replaceCriteriaEdit = createEditor(searchContext, mySavedEditorText != null ? mySavedEditorText : "");
JPanel replace = new JPanel(new BorderLayout());
replace.add(BorderLayout.NORTH, new JLabel(SSRBundle.message("replacement.template.label")));
replace.add(BorderLayout.CENTER, replaceCriteriaEdit.getComponent());
replaceCriteriaEdit.getComponent().setMinimumSize(new Dimension(150, 100));
p.setSecondComponent(replace);
return result;
}
Aggregations