public EmojiCheckinHandler(CheckinProjectPanel checkinProjectPanel) { JPanel emojiPanel = new JPanel(); emojiPanel.setLayout(new VerticalFlowLayout()); VirtualFile emojirc = checkinProjectPanel.getProject().getBaseDir().findChild(".emojirc"); if (emojirc == null) return; PsiFile psiFile = PsiManager.getInstance(checkinProjectPanel.getProject()).findFile(emojirc); if (psiFile == null) return; for (PsiElement psiElement : psiFile.getChildren()) { if (!(psiElement instanceof EmojiResourceProperty)) continue; emojiPanel.add(createEmojiButton(psiElement.getFirstChild().getText(), psiElement.getLastChild().getText(), false, buttonGroup)); } emojiPanel.add(createEmojiButton(null, NO_EMOJI, true, buttonGroup)); Splitter splitter = (Splitter) checkinProjectPanel.getComponent(); CommitMessage commitMessage = (CommitMessage) splitter.getSecondComponent(); JComponent component = (JComponent) commitMessage.getComponent(1); JBScrollPane scrollPane = new JBScrollPane(emojiPanel); scrollPane.setBorder(null); Splitter commitSplitter = new Splitter(); commitSplitter.setFirstComponent(scrollPane); commitSplitter.setSecondComponent((JComponent) commitMessage.getComponent(0)); commitMessage.add(commitSplitter, 0); for (EmojiPanelFactory factory : factories) { factory.createPanel(commitMessage); } this.checkinProjectPanel = checkinProjectPanel; }
public void run() { try { ToolWindowAnchor anchor = myInfo.getAnchor(); JComponent c = getComponentAt(anchor); if (c instanceof Splitter) { Splitter splitter = (Splitter)c; final InternalDecorator component = myInfo.isSplit() ? (InternalDecorator)splitter.getFirstComponent() : (InternalDecorator)splitter.getSecondComponent(); if (myInfo.isSplit() && component != null) { myId2SplitProportion.put(component.getWindowInfo().getId(), splitter.getProportion()); } setComponent(component, anchor, component != null ? component.getWindowInfo().getWeight() : 0); } else { setComponent(null, anchor, 0); } if (!myDirtyMode) { myLayeredPane.validate(); myLayeredPane.repaint(); } } finally { finish(); } }
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; }
private void initSplitters() { final Splitter filterSplitter = new Splitter(false, 0.5f); filterSplitter.setSecondComponent(ScrollPaneFactory.createScrollPane(myChangesTree)); myLeftPanel.add(filterSplitter, BorderLayout.CENTER); final Splitter mainSplitter = new Splitter(false, 0.7f); mainSplitter.setFirstComponent(myLeftPanel); mainSplitter.setSecondComponent(myDetailsView); add(mainSplitter, BorderLayout.CENTER); myInnerSplitter = new WiseSplitter(new Runnable() { public void run() { filterSplitter.doLayout(); updateModel(); } }, filterSplitter); Disposer.register(this, myInnerSplitter); mySplitterProportionsData.externalizeFromDimensionService("CommittedChanges.SplitterProportions"); mySplitterProportionsData.restoreSplitterProportions(this); }
private JComponent createBottomPanel(final JComponent addComp) { Splitter splitter = new Splitter(true, getVcsConfiguration() .FILE_HISTORY_DIALOG_COMMENTS_SPLITTER_PROPORTION); splitter.setDividerWidth(4); splitter.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { if (Splitter.PROP_PROPORTION.equals(evt.getPropertyName())) { getVcsConfiguration().FILE_HISTORY_DIALOG_COMMENTS_SPLITTER_PROPORTION = ((Float)evt.getNewValue()).floatValue(); } } }); JPanel tablePanel = new JPanel(new BorderLayout()); tablePanel.add(createTablePanel(), BorderLayout.CENTER); tablePanel.add(myChangesOnlyCheckBox, BorderLayout.NORTH); splitter.setFirstComponent(tablePanel); splitter.setSecondComponent(createComments(addComp)); return splitter; }
private JComponent createComments(final JComponent addComp) { final Splitter splitter = new Splitter(false); final JLabel label = new JLabel("Commit Message:") { @Override public Dimension getPreferredSize() { return new Dimension(getWidth(), 21); } }; JPanel panel = new JPanel(new BorderLayout(4, 4)); panel.add(label, BorderLayout.NORTH); panel.add(ScrollPaneFactory.createScrollPane(myComments), BorderLayout.CENTER); myComments.setRows(5); myComments.setEditable(false); myComments.setLineWrap(true); splitter.setFirstComponent(panel); splitter.setSecondComponent(addComp); return splitter; }
public ModulesDependenciesPanel(final Project project, final Module[] modules) { super(new BorderLayout()); myProject = project; myModules = modules; //noinspection HardCodedStringLiteral myRightTreeModel = new DefaultTreeModel(new DefaultMutableTreeNode("Root")); myRightTree = new Tree(myRightTreeModel); initTree(myRightTree, true); initLeftTree(); mySplitter = new Splitter(); mySplitter.setFirstComponent(new MyTreePanel(myLeftTree, myProject)); mySplitter.setSecondComponent(new MyTreePanel(myRightTree, myProject)); setSplitterProportion(); add(mySplitter, BorderLayout.CENTER); add(createNorthPanel(), BorderLayout.NORTH); project.getMessageBus().connect(this).subscribe(ProjectTopics.PROJECT_ROOTS, this); }
private void initUi() { myComponent = new JPanel(); myTreeTabs = new JBTabsImpl(null, null, this); final Splitter splitter = new Splitter(true); final JBTabsImpl bottom = new JBTabsImpl(null, null, this); final AllocationPanel allocations = new AllocationPanel(myTreeTabs); bottom.addTab(new TabInfo(allocations).setText("Allocation")).setActions(allocations.getActions(), ActionPlaces.UNKNOWN); splitter.setFirstComponent(myTreeTabs); splitter.setSecondComponent(bottom); myComponent.setLayout(new BorderLayout()); myComponent.add(splitter, BorderLayout.CENTER); JLabel countLabel = new JLabel("Total disposable count: " + Disposer.getTree().size()); myComponent.add(countLabel, BorderLayout.SOUTH); addTree(new DisposerTree(this), "All", false); addTree(new DisposerTree(this), "Watch", true); }
private void createUIComponents() { Splitter splitter = new Splitter(false, 0.5f, 0.2f, 0.8f); myBody = splitter; myComponentsTable = new JBTable(); myComponentDescription = new JTextPane(); splitter.setShowDividerIcon(false); splitter.setShowDividerControls(false); splitter.setFirstComponent(ScrollPaneFactory.createScrollPane(myComponentsTable, false)); splitter.setSecondComponent(ScrollPaneFactory.createScrollPane(myComponentDescription, false)); myComponentDescription.setFont(UIUtil.getLabelFont()); myComponentDescription.setEditable(false); myComponentDescription.setBorder(BorderFactory.createEmptyBorder(WizardConstants.STUDIO_WIZARD_INSET_SIZE, WizardConstants.STUDIO_WIZARD_INSET_SIZE, WizardConstants.STUDIO_WIZARD_INSET_SIZE, WizardConstants.STUDIO_WIZARD_INSET_SIZE)); }
public ProjectProfileSelectionDialog(@NotNull Project project, @NotNull List<Conflict> conflicts) { super(project); myProject = project; myConflicts = conflicts; for (Conflict conflict : conflicts) { conflict.refreshStatus(); } myPanel = new JPanel(new BorderLayout()); Splitter splitter = new Splitter(false, .35f); splitter.setHonorComponentsMinimumSize(true); myPanel.add(splitter, BorderLayout.CENTER); splitter.setFirstComponent(createProjectStructurePanel()); splitter.setSecondComponent(createConflictsPanel()); init(); myProjectStructureTree.expandAll(); }
@Override public void reset() { super.reset(); myProjectJdksModel.reset(myProject); myRoot.removeAllChildren(); final Map<Sdk, Sdk> sdks = myProjectJdksModel.getProjectSdks(); for (Sdk sdk : sdks.keySet()) { final JdkConfigurable configurable = new JdkConfigurable((ProjectJdkImpl)sdks.get(sdk), myProjectJdksModel, TREE_UPDATER, myHistory, myProject); addNode(new MyNode(configurable), myRoot); } selectJdk(myProjectJdksModel.getProjectSdk()); //restore selection final String value = PropertiesComponent.getInstance().getValue(SPLITTER_PROPORTION); if (value != null) { try { final Splitter splitter = extractSplitter(); if (splitter != null) { (splitter).setProportion(Float.parseFloat(value)); } } catch (NumberFormatException e) { //do not set proportion } } }
public TemplateListPanel() { super(new BorderLayout()); myDetailsPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); JLabel label = new JLabel("No live template is selected"); label.setHorizontalAlignment(SwingConstants.CENTER); myDetailsPanel.add(label, NO_SELECTION); createTemplateEditor(MOCK_TEMPLATE, "Tab", MOCK_TEMPLATE.createOptions(), MOCK_TEMPLATE.createContext()); add(createExpandByPanel(), BorderLayout.NORTH); Splitter splitter = new Splitter(true, 0.9f); splitter.setFirstComponent(createTable()); splitter.setSecondComponent(myDetailsPanel); add(splitter, BorderLayout.CENTER); }
@Override public JComponent createComponent() { if (myMainComponent == null) { myMainComponent = new JPanel(new BorderLayout()); Splitter splitter = new Splitter(true); myMainComponent.add(splitter); 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; }
public void createMe() { mySplitter = new Splitter(false, 0.7f); final JPanel wrapper = createMainTable(); mySplitter.setFirstComponent(wrapper); final JComponent component = createRepositoryBrowserDetails(); mySplitter.setSecondComponent(component); Disposer.register(this, new Disposable() { @Override public void dispose() { if (myMyChangeListener != null) { myMyChangeListener.stop(); } } }); createDetailLoaders(); }
public CommentField(String label, String value, String userName, String fullName) { super(label, false, value); this.userName = userName; this.fullName = fullName; addedComment = new JTextPane(); addedComment.getDocument().addDocumentListener(new MyDocumentListener(this)); UndoAction.installUndoRedoSupport(addedComment); HTMLAreaField.installNavigationShortCuts(addedComment); commentPanel = new JPanel(new BorderLayout()); if(!value.isEmpty()) { Splitter splitter = new Splitter(true, 0.75f); splitter.setHonorComponentsMinimumSize(true); splitter.setShowDividerControls(true); splitter.setFirstComponent(createPane(HTMLAreaField.createTextPane(value))); splitter.setSecondComponent(createPane(addedComment)); commentPanel.add(splitter, BorderLayout.CENTER); } else { commentPanel.add(createPane(addedComment), BorderLayout.CENTER); } }
public DetailsPanel(@NotNull final Project project, @NotNull final Review review) { super(false); myProject = project; myReview = review; final Splitter splitter = new Splitter(false, 0.7f); final JPanel mainTable = createMainTable(); splitter.setFirstComponent(mainTable); final JComponent repoBrowser = createRepositoryBrowserDetails(); splitter.setSecondComponent(repoBrowser); setContent(splitter); myChangesBrowser.getDiffAction().registerCustomShortcutSet(CommonShortcuts.getDiff(), myCommitsTable); myCommentsPane.setVisible(PropertiesComponent.getInstance().getBoolean(GENERAL_COMMENTS_VISIBILITY_PROPERTY, false)); }
@Override public void reset() { super.reset(); myProjectSdksModel.reset(myProject); myRoot.removeAllChildren(); final Map<Sdk, Sdk> sdks = myProjectSdksModel.getProjectSdks(); for (Sdk sdk : sdks.keySet()) { final SdkConfigurable configurable = new SdkConfigurable((SdkImpl)sdks.get(sdk), myProjectSdksModel, TREE_UPDATER, myHistory, myProject); addNode(new MyNode(configurable), myRoot); } final String value = PropertiesComponent.getInstance().getValue(SPLITTER_PROPORTION); if (value != null) { try { final Splitter splitter = extractSplitter(); if (splitter != null) { (splitter).setProportion(Float.parseFloat(value)); } } catch (NumberFormatException e) { //do not set proportion } } }
private void initUi() { myComponent = new JPanel(); myTreeTabs = new JBEditorTabs(null, ActionManager.getInstance(), null, this); final Splitter splitter = new Splitter(true); final JBTabsImpl bottom = new JBEditorTabs(null, ActionManager.getInstance(), null, this); final AllocationPanel allocations = new AllocationPanel(myTreeTabs); bottom.addTab(new TabInfo(allocations).setText("Allocation")).setActions(allocations.getActions(), ActionPlaces.UNKNOWN); splitter.setFirstComponent(myTreeTabs); splitter.setSecondComponent(bottom); myComponent.setLayout(new BorderLayout()); myComponent.add(splitter, BorderLayout.CENTER); JLabel countLabel = new JLabel("Total disposable count: " + Disposer.getTree().size()); myComponent.add(countLabel, BorderLayout.SOUTH); addTree(new DisposerTree(this), "All", false); addTree(new DisposerTree(this), "Watch", true); }
@Override public void run() { try { ToolWindowAnchor anchor = myInfo.getAnchor(); JComponent c = getComponentAt(anchor); if (c instanceof Splitter) { Splitter splitter = (Splitter)c; final DesktopInternalDecorator component = myInfo.isSplit() ? (DesktopInternalDecorator)splitter.getFirstComponent() : (DesktopInternalDecorator)splitter.getSecondComponent(); if (myInfo.isSplit() && component != null) { myId2SplitProportion.put(component.getWindowInfo().getId(), splitter.getProportion()); } setComponent(component, anchor, component != null ? component.getWindowInfo().getWeight() : 0); } else { setComponent(null, anchor, 0); } if (!myDirtyMode) { myLayeredPane.validate(); myLayeredPane.repaint(); } } finally { finish(); } }
public UserRenderersConfigurable() { super(new BorderLayout(4, 0)); myRendererChooser = new ElementsChooser<NodeRenderer>(true); setupRenderersList(); ToolbarDecorator decorator = ToolbarDecorator.createDecorator((JTable)myRendererChooser.getComponent()); decorator.setToolbarPosition(ActionToolbarPosition.TOP); decorator.setAddAction(new AddAction()); decorator.setRemoveAction(new RemoveAction()); decorator.setMoveUpAction(new MoveAction(true)); decorator.setMoveDownAction(new MoveAction(false)); decorator.addExtraAction(new CopyAction()); myNameField = new JTextField(); myNameFieldPanel = new JPanel(new BorderLayout()); myNameFieldPanel.add(new JLabel(DebuggerBundle.message("label.user.renderers.configurable.renderer.name")), BorderLayout.WEST); myNameFieldPanel.add(myNameField, BorderLayout.CENTER); myNameFieldPanel.setVisible(false); final JPanel center = new JPanel(new BorderLayout(0, 4)); center.add(myNameFieldPanel, BorderLayout.NORTH); center.add(myRendererDataConfigurable, BorderLayout.CENTER); myNameField.getDocument().addDocumentListener(new DocumentAdapter() { @Override protected void textChanged(DocumentEvent e) { if (myCurrentRenderer != null) { myCurrentRenderer.setName(myNameField.getText()); myRendererChooser.refresh(myCurrentRenderer); } } }); Splitter splitter = new Splitter(false); splitter.setProportion(0.3f); splitter.setFirstComponent(decorator.createPanel()); splitter.setSecondComponent(center); add(splitter, BorderLayout.CENTER); }
@Override protected JComponent createCenterPanel() { final NullableNotNullManager manager = NullableNotNullManager.getInstance(myProject); final Splitter splitter = new Splitter(true); myNullablePanel = new AnnotationsPanel("Nullable", manager.getDefaultNullable(), manager.getNullables(), NullableNotNullManager.DEFAULT_NULLABLES); splitter.setFirstComponent(myNullablePanel.getComponent()); myNotNullPanel = new AnnotationsPanel("NotNull", manager.getDefaultNotNull(), manager.getNotNulls(), NullableNotNullManager.DEFAULT_NOT_NULLS); splitter.setSecondComponent(myNotNullPanel.getComponent()); splitter.setHonorComponentsMinimumSize(true); splitter.setPreferredSize(JBUI.size(300, 400)); return splitter; }
protected JComponent createCenterPanel() { myCenterPanel = new JPanel(new BorderLayout()); createParametersPanel(); final Splitter splitter = new Splitter(true); splitter.setShowDividerIcon(false); splitter.setFirstComponent(myCenterPanel); splitter.setSecondComponent(createSignaturePanel()); return splitter; }
private void doSaveSplitterProportions(Component root) { if (root instanceof Splitter) { Float prop = ((Splitter)root).getProportion(); proportions.add(prop); } if (root instanceof Container) { Component[] children = ((Container)root).getComponents(); for (Component child : children) { doSaveSplitterProportions(child); } } }
private int restoreSplitterProportions(Component root, int index) { if (root instanceof Splitter) { if (proportions.size() <= index) return index; ((Splitter)root).setProportion(proportions.get(index++).floatValue()); } if (root instanceof Container) { Component[] children = ((Container)root).getComponents(); for (Component child : children) { index = restoreSplitterProportions(child, index); } } return index; }
@Override public Insets getBorderInsets(final Component c) { if (myProject == null) return new Insets(0, 0, 0, 0); ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(myProject); if (!(toolWindowManager instanceof ToolWindowManagerImpl) || !((ToolWindowManagerImpl)toolWindowManager).isToolWindowRegistered(myInfo.getId()) || myWindow.getType() == ToolWindowType.FLOATING) { return new Insets(0, 0, 0, 0); } ToolWindowAnchor anchor = myWindow.getAnchor(); Component component = myWindow.getComponent(); Container parent = component.getParent(); while(parent != null) { if (parent instanceof Splitter) { Splitter splitter = (Splitter)parent; boolean isFirst = splitter.getFirstComponent() == component; boolean isVertical = splitter.isVertical(); return new Insets(0, anchor == ToolWindowAnchor.RIGHT || (!isVertical && !isFirst) ? 1 : 0, (isVertical && isFirst) ? 1 : 0, anchor == ToolWindowAnchor.LEFT || (!isVertical && isFirst) ? 1 : 0); } component = parent; parent = component.getParent(); } return new Insets(0, anchor == ToolWindowAnchor.RIGHT ? 1 : 0, anchor == ToolWindowAnchor.TOP ? 1 : 0, anchor == ToolWindowAnchor.LEFT ? 1 : 0); }
private void removeFromSplitter() { if (!inSplitter()) return; if (myOwner.getCurrentWindow() == this) { EditorWindow[] siblings = findSiblings(); myOwner.setCurrentWindow(siblings[0], false); } Splitter splitter = (Splitter)myPanel.getParent(); JComponent otherComponent = splitter.getOtherComponent(myPanel); Container parent = splitter.getParent().getParent(); if (parent instanceof Splitter) { Splitter parentSplitter = (Splitter)parent; if (parentSplitter.getFirstComponent() == splitter.getParent()) { parentSplitter.setFirstComponent(otherComponent); } else { parentSplitter.setSecondComponent(otherComponent); } } else if (parent instanceof EditorsSplitters) { parent.removeAll(); parent.add(otherComponent, BorderLayout.CENTER); ((JComponent)parent).revalidate(); } else { throw new IllegalStateException("Unknown container: " + parent); } dispose(); }
public EditorWindow[] findSiblings() { checkConsistency(); final ArrayList<EditorWindow> res = new ArrayList<EditorWindow>(); 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()]); }
public void changeOrientation() { checkConsistency(); final Container parent = myPanel.getParent(); if (parent instanceof Splitter) { final Splitter splitter = (Splitter)parent; splitter.setOrientation(!splitter.getOrientation()); } }
private static int getSplitCount(JComponent component) { if (component.getComponentCount() > 0) { final JComponent firstChild = (JComponent)component.getComponent(0); if (firstChild instanceof Splitter) { final Splitter splitter = (Splitter)firstChild; return getSplitCount(splitter.getFirstComponent()) + getSplitCount(splitter.getSecondComponent()); } return 1; } return 0; }
private ContentWrapper() { setLayout(new BorderLayout()); myErrorLabel = new JLabel(); myErrorLabel.setOpaque(true); myErrorLabel.setBackground(LightColors.RED); myLeft = new JPanel(new BorderLayout()); mySplitter.addPropertyChangeListener(Splitter.PROP_PROPORTION, new PropertyChangeListener() { @Override public void propertyChange(final PropertyChangeEvent evt) { myLastSplitterProportion = ((Float)evt.getNewValue()).floatValue(); } }); }
public WiseSplitter(final Runnable refresher, final Splitter parentSplitter) { myRefresher = refresher; myParentSplitter = parentSplitter; myInnerSplitter = new ThreeComponentsSplitter(false); Disposer.register(this, myInnerSplitter); myInnerSplitter.setHonorComponentsMinimumSize(true); myInnerSplitterContents = new HashMap<CommittedChangesFilterKey, Integer>(); updateBorders(); }