Search in sources :

Example 41 with Splitter

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()]);
}
Also used : ThreeComponentsSplitter(com.intellij.openapi.ui.ThreeComponentsSplitter) Splitter(com.intellij.openapi.ui.Splitter) OnePixelSplitter(com.intellij.ui.OnePixelSplitter)

Example 42 with Splitter

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();
}
Also used : EdtExecutorService(com.intellij.util.concurrency.EdtExecutorService) UIUtil(com.intellij.util.ui.UIUtil) AllIcons(com.intellij.icons.AllIcons) ScheduledFuture(java.util.concurrent.ScheduledFuture) VirtualFile(com.intellij.openapi.vfs.VirtualFile) THashSet(gnu.trove.THashSet) Disposer(com.intellij.openapi.util.Disposer) Messages(com.intellij.openapi.ui.Messages) MultiMap(com.intellij.util.containers.MultiMap) TIntArrayList(gnu.trove.TIntArrayList) UsageViewManager(com.intellij.usageView.UsageViewManager) Extensions(com.intellij.openapi.extensions.Extensions) DumbService(com.intellij.openapi.project.DumbService) ReflectionUtil(com.intellij.util.ReflectionUtil) IndexNotReadyException(com.intellij.openapi.project.IndexNotReadyException) com.intellij.ide(com.intellij.ide) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Content(com.intellij.ui.content.Content) ExclusionHandler(com.intellij.ide.actions.exclusion.ExclusionHandler) com.intellij.ui(com.intellij.ui) FindManager(com.intellij.find.FindManager) Nullable(org.jetbrains.annotations.Nullable) ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator) SimpleToolWindowPanel(com.intellij.openapi.ui.SimpleToolWindowPanel) List(java.util.List) SmartPsiElementPointer(com.intellij.psi.SmartPsiElementPointer) PsiDocumentManagerBase(com.intellij.psi.impl.PsiDocumentManagerBase) java.awt.event(java.awt.event) ApplicationManager(com.intellij.openapi.application.ApplicationManager) javax.swing.tree(javax.swing.tree) NotNull(org.jetbrains.annotations.NotNull) Factory(com.intellij.openapi.util.Factory) TreeExpansionListener(javax.swing.event.TreeExpansionListener) Consumer(com.intellij.util.Consumer) JBTabbedPane(com.intellij.ui.components.JBTabbedPane) com.intellij.usages.rules(com.intellij.usages.rules) NavigationItem(com.intellij.navigation.NavigationItem) java.util(java.util) TreeExpansionEvent(javax.swing.event.TreeExpansionEvent) ReadonlyStatusHandler(com.intellij.openapi.vfs.ReadonlyStatusHandler) NonNls(org.jetbrains.annotations.NonNls) UsageInfo(com.intellij.usageView.UsageInfo) ContainerUtil(com.intellij.util.containers.ContainerUtil) TreeSelectionEvent(javax.swing.event.TreeSelectionEvent) EditSourceOnDoubleClickHandler(com.intellij.util.EditSourceOnDoubleClickHandler) MessageBusConnection(com.intellij.util.messages.MessageBusConnection) TreeSelectionListener(javax.swing.event.TreeSelectionListener) Comparing(com.intellij.openapi.util.Comparing) ProgressWrapper(com.intellij.openapi.progress.util.ProgressWrapper) Project(com.intellij.openapi.project.Project) Tree(com.intellij.ui.treeStructure.Tree) PsiDocumentManager(com.intellij.psi.PsiDocumentManager) Splitter(com.intellij.openapi.ui.Splitter) PsiInvalidElementAccessException(com.intellij.psi.PsiInvalidElementAccessException) TreeUtil(com.intellij.util.ui.tree.TreeUtil) VfsUtilCore(com.intellij.openapi.vfs.VfsUtilCore) BasicTreeUI(javax.swing.plaf.basic.BasicTreeUI) EmptyEnumeration(com.intellij.util.enumeration.EmptyEnumeration) CloseTabToolbarAction(com.intellij.ide.actions.CloseTabToolbarAction) com.intellij.usages(com.intellij.usages) Disposable(com.intellij.openapi.Disposable) SystemInfo(com.intellij.openapi.util.SystemInfo) DialogUtil(com.intellij.util.ui.DialogUtil) SmartPointerManager(com.intellij.psi.SmartPointerManager) java.awt(java.awt) TimeUnit(java.util.concurrent.TimeUnit) com.intellij.openapi.actionSystem(com.intellij.openapi.actionSystem) CommandProcessor(com.intellij.openapi.command.CommandProcessor) TreeUI(javax.swing.plaf.TreeUI) LinkedMultiMap(com.intellij.util.containers.LinkedMultiMap) UsageViewBundle(com.intellij.usageView.UsageViewBundle) Navigatable(com.intellij.pom.Navigatable) Alarm(com.intellij.util.Alarm) javax.swing(javax.swing) JBTabbedPane(com.intellij.ui.components.JBTabbedPane) Splitter(com.intellij.openapi.ui.Splitter)

Example 43 with Splitter

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;
}
Also used : Splitter(com.intellij.openapi.ui.Splitter) RepositoryChangesBrowser(com.intellij.openapi.vcs.changes.committed.RepositoryChangesBrowser) ArrayList(java.util.ArrayList) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup)

Example 44 with Splitter

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);
}
Also used : PopupHandler(com.intellij.ui.PopupHandler) Splitter(com.intellij.openapi.ui.Splitter) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) RepositoryBrowserDialog(org.jetbrains.idea.svn.dialogs.RepositoryBrowserDialog) ActionPopupMenu(com.intellij.openapi.actionSystem.ActionPopupMenu) RepositoryBrowserComponent(org.jetbrains.idea.svn.dialogs.RepositoryBrowserComponent) RepositoryBrowserComponent(org.jetbrains.idea.svn.dialogs.RepositoryBrowserComponent)

Example 45 with Splitter

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;
}
Also used : Splitter(com.intellij.openapi.ui.Splitter)

Aggregations

Splitter (com.intellij.openapi.ui.Splitter)47 OnePixelSplitter (com.intellij.ui.OnePixelSplitter)7 NotNull (org.jetbrains.annotations.NotNull)7 ThreeComponentsSplitter (com.intellij.openapi.ui.ThreeComponentsSplitter)6 ListSelectionEvent (javax.swing.event.ListSelectionEvent)6 ListSelectionListener (javax.swing.event.ListSelectionListener)6 Nullable (org.jetbrains.annotations.Nullable)6 AllIcons (com.intellij.icons.AllIcons)4 Disposable (com.intellij.openapi.Disposable)4 Project (com.intellij.openapi.project.Project)4 com.intellij.openapi.actionSystem (com.intellij.openapi.actionSystem)3 ApplicationManager (com.intellij.openapi.application.ApplicationManager)3 UsageInfo (com.intellij.usageView.UsageInfo)3 ContainerUtil (com.intellij.util.containers.ContainerUtil)3 java.awt (java.awt)3 ActionEvent (java.awt.event.ActionEvent)3 List (java.util.List)3 javax.swing (javax.swing)3 PropertiesComponent (com.intellij.ide.util.PropertiesComponent)2 DefaultActionGroup (com.intellij.openapi.actionSystem.DefaultActionGroup)2