com.intellij.ui.NonFocusableCheckBox Java Examples
The following examples show how to use
com.intellij.ui.NonFocusableCheckBox.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: InnerBuilderOptionSelector.java From innerbuilder with Apache License 2.0 | 6 votes |
private static JCheckBox buildOptionCheckBox(final PropertiesComponent propertiesComponent, final SelectorOption selectorOption) { final InnerBuilderOption option = selectorOption.getOption(); final JCheckBox optionCheckBox = new NonFocusableCheckBox(selectorOption.getCaption()); optionCheckBox.setMnemonic(selectorOption.getMnemonic()); optionCheckBox.setToolTipText(selectorOption.getToolTip()); final String optionProperty = option.getProperty(); optionCheckBox.setSelected(propertiesComponent.isTrueValue(optionProperty)); optionCheckBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(final ItemEvent event) { propertiesComponent.setValue(optionProperty, Boolean.toString(optionCheckBox.isSelected())); } }); return optionCheckBox; }
Example #2
Source File: CodeCleanupCheckinHandlerFactory.java From consulo with Apache License 2.0 | 5 votes |
@Override public RefreshableOnComponent getBeforeCheckinConfigurationPanel() { final JCheckBox cleanupCodeCb = new NonFocusableCheckBox(VcsBundle.message("before.checkin.cleanup.code")); return new RefreshableOnComponent() { @Override public JComponent getComponent() { final JPanel cbPanel = new JPanel(new BorderLayout()); cbPanel.add(cleanupCodeCb, BorderLayout.WEST); CheckinHandlerUtil .disableWhenDumb(myProject, cleanupCodeCb, "Code analysis is impossible until indices are up-to-date"); return cbPanel; } @Override public void refresh() { } @Override public void saveState() { VcsConfiguration.getInstance(myProject).CHECK_CODE_CLEANUP_BEFORE_PROJECT_COMMIT = cleanupCodeCb.isSelected(); } @Override public void restoreState() { cleanupCodeCb.setSelected(VcsConfiguration.getInstance(myProject).CHECK_CODE_CLEANUP_BEFORE_PROJECT_COMMIT); } }; }
Example #3
Source File: RearrangeBeforeCheckinHandler.java From consulo with Apache License 2.0 | 5 votes |
@Override @Nullable public RefreshableOnComponent getBeforeCheckinConfigurationPanel() { final JCheckBox rearrangeBox = new NonFocusableCheckBox(VcsBundle.message("checkbox.checkin.options.rearrange.code")); CheckinHandlerUtil.disableWhenDumb(myProject, rearrangeBox, "Impossible until indices are up-to-date"); return new RefreshableOnComponent() { @Override public JComponent getComponent() { final JPanel panel = new JPanel(new GridLayout(1, 0)); panel.add(rearrangeBox); return panel; } @Override public void refresh() { } @Override public void saveState() { getSettings().REARRANGE_BEFORE_PROJECT_COMMIT = rearrangeBox.isSelected(); } @Override public void restoreState() { rearrangeBox.setSelected(getSettings().REARRANGE_BEFORE_PROJECT_COMMIT); } }; }
Example #4
Source File: RenameWithOptionalReferencesDialog.java From consulo with Apache License 2.0 | 5 votes |
@Override protected void createCheckboxes(JPanel panel, GridBagConstraints gbConstraints) { gbConstraints.insets = new Insets(0, 0, 4, 0); gbConstraints.gridwidth = 1; gbConstraints.gridx = 0; gbConstraints.weighty = 0; gbConstraints.weightx = 1; gbConstraints.fill = GridBagConstraints.BOTH; myCbSearchForReferences = new NonFocusableCheckBox(RefactoringBundle.message("search.for.references")); myCbSearchForReferences.setSelected(getSearchForReferences()); panel.add(myCbSearchForReferences, gbConstraints); super.createCheckboxes(panel, gbConstraints); }
Example #5
Source File: InplaceChangeSignature.java From consulo with Apache License 2.0 | 5 votes |
protected void showBalloon() { NonFocusableCheckBox checkBox = new NonFocusableCheckBox(RefactoringBundle.message("delegation.panel.delegate.via.overloading.method")); checkBox.addActionListener(e -> { myDelegate = checkBox.isSelected(); updateCurrentInfo(); }); JPanel content = new JPanel(new BorderLayout()); content.add(new JBLabel("Performed signature modifications:"), BorderLayout.NORTH); content.add(myPreview.getComponent(), BorderLayout.CENTER); updateMethodSignature(myStableChange); content.add(checkBox, BorderLayout.SOUTH); final BalloonBuilder balloonBuilder = JBPopupFactory.getInstance().createDialogBalloonBuilder(content, null).setSmallVariant(true); myBalloon = balloonBuilder.createBalloon(); myEditor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE); myBalloon.show(new PositionTracker<Balloon>(myEditor.getContentComponent()) { @Override public RelativePoint recalculateLocation(Balloon object) { int offset = myStableChange.getMethod().getTextOffset(); VisualPosition visualPosition = myEditor.offsetToVisualPosition(offset); Point point = myEditor.visualPositionToXY(new VisualPosition(visualPosition.line, visualPosition.column)); return new RelativePoint(myEditor.getContentComponent(), point); } }, Balloon.Position.above); Disposer.register(myBalloon, () -> { EditorFactory.getInstance().releaseEditor(myPreview); myPreview = null; }); }
Example #6
Source File: RenameDialog.java From consulo with Apache License 2.0 | 4 votes |
protected void createCheckboxes(JPanel panel, GridBagConstraints gbConstraints) { gbConstraints.insets = new Insets(0, 0, 4, 0); gbConstraints.gridwidth = 1; gbConstraints.gridx = 0; gbConstraints.weighty = 0; gbConstraints.weightx = 1; gbConstraints.fill = GridBagConstraints.BOTH; myCbSearchInComments = new NonFocusableCheckBox(); myCbSearchInComments.setText(RefactoringBundle.getSearchInCommentsAndStringsText()); myCbSearchInComments.setSelected(true); panel.add(myCbSearchInComments, gbConstraints); gbConstraints.insets = new Insets(0, 0, 4, 0); gbConstraints.gridwidth = GridBagConstraints.REMAINDER; gbConstraints.gridx = 1; gbConstraints.weightx = 1; gbConstraints.fill = GridBagConstraints.BOTH; myCbSearchTextOccurences = new NonFocusableCheckBox(); myCbSearchTextOccurences.setText(RefactoringBundle.getSearchForTextOccurrencesText()); myCbSearchTextOccurences.setSelected(true); panel.add(myCbSearchTextOccurences, gbConstraints); if (!TextOccurrencesUtil.isSearchTextOccurencesEnabled(myPsiElement)) { myCbSearchTextOccurences.setEnabled(false); myCbSearchTextOccurences.setSelected(false); myCbSearchTextOccurences.setVisible(false); } for(AutomaticRenamerFactory factory: Extensions.getExtensions(AutomaticRenamerFactory.EP_NAME)) { if (factory.isApplicable(myPsiElement) && factory.getOptionName() != null) { gbConstraints.insets = new Insets(0, 0, 4, 0); gbConstraints.gridwidth = myAutomaticRenamers.size() % 2 == 0 ? 1 : GridBagConstraints.REMAINDER; gbConstraints.gridx = myAutomaticRenamers.size() % 2; gbConstraints.weightx = 1; gbConstraints.fill = GridBagConstraints.BOTH; JCheckBox checkBox = new NonFocusableCheckBox(); checkBox.setText(factory.getOptionName()); checkBox.setSelected(factory.isEnabled()); panel.add(checkBox, gbConstraints); myAutomaticRenamers.put(factory, checkBox); } } }
Example #7
Source File: MoveFilesOrDirectoriesDialog.java From consulo with Apache License 2.0 | 4 votes |
@Override protected JComponent createNorthPanel() { myNameLabel = JBLabelDecorator.createJBLabelDecorator().setBold(true); myTargetDirectoryField = new TextFieldWithHistoryWithBrowseButton(); final List<String> recentEntries = RecentsManager.getInstance(myProject).getRecentEntries(RECENT_KEYS); if (recentEntries != null) { myTargetDirectoryField.getChildComponent().setHistory(recentEntries); } final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor(); myTargetDirectoryField.addBrowseFolderListener(RefactoringBundle.message("select.target.directory"), RefactoringBundle.message("the.file.will.be.moved.to.this.directory"), myProject, descriptor, TextComponentAccessor.TEXT_FIELD_WITH_HISTORY_WHOLE_TEXT); final JTextField textField = myTargetDirectoryField.getChildComponent().getTextEditor(); FileChooserFactory.getInstance().installFileCompletion(textField, descriptor, true, getDisposable()); textField.getDocument().addDocumentListener(new DocumentAdapter() { @Override protected void textChanged(DocumentEvent e) { validateOKButton(); } }); myTargetDirectoryField.setTextFieldPreferredWidth(CopyFilesOrDirectoriesDialog.MAX_PATH_LENGTH); Disposer.register(getDisposable(), myTargetDirectoryField); String shortcutText = KeymapUtil.getFirstKeyboardShortcutText(ActionManager.getInstance().getAction(IdeActions.ACTION_CODE_COMPLETION)); myCbSearchForReferences = new NonFocusableCheckBox(RefactoringBundle.message("search.for.references")); myCbSearchForReferences.setSelected(RefactoringSettings.getInstance().MOVE_SEARCH_FOR_REFERENCES_FOR_FILE); myOpenInEditorCb = new NonFocusableCheckBox("Open moved files in editor"); myOpenInEditorCb.setSelected(isOpenInEditor()); return FormBuilder.createFormBuilder().addComponent(myNameLabel) .addLabeledComponent(RefactoringBundle.message("move.files.to.directory.label"), myTargetDirectoryField, UIUtil.LARGE_VGAP) .addTooltip(RefactoringBundle.message("path.completion.shortcut", shortcutText)) .addComponentToRightColumn(myCbSearchForReferences, UIUtil.LARGE_VGAP) .addComponentToRightColumn(myOpenInEditorCb, UIUtil.LARGE_VGAP) .getPanel(); }