use of com.intellij.ui.NonFocusableCheckBox in project intellij-community by JetBrains.
the class RenameDialog method createCheckboxes.
protected void createCheckboxes(JPanel panel, GridBagConstraints gbConstraints) {
gbConstraints.insets = JBUI.insetsBottom(4);
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 = JBUI.insetsBottom(4);
gbConstraints.gridwidth = GridBagConstraints.REMAINDER;
gbConstraints.gridx = 1;
gbConstraints.weightx = 1;
gbConstraints.fill = GridBagConstraints.BOTH;
myCbSearchTextOccurrences = new NonFocusableCheckBox();
myCbSearchTextOccurrences.setText(RefactoringBundle.getSearchForTextOccurrencesText());
myCbSearchTextOccurrences.setSelected(true);
panel.add(myCbSearchTextOccurrences, gbConstraints);
if (!TextOccurrencesUtil.isSearchTextOccurencesEnabled(myPsiElement)) {
myCbSearchTextOccurrences.setEnabled(false);
myCbSearchTextOccurrences.setSelected(false);
myCbSearchTextOccurrences.setVisible(false);
}
for (AutomaticRenamerFactory factory : Extensions.getExtensions(AutomaticRenamerFactory.EP_NAME)) {
if (factory.isApplicable(myPsiElement) && factory.getOptionName() != null) {
gbConstraints.insets = JBUI.insetsBottom(4);
gbConstraints.gridwidth = myAutoRenamerFactories.size() % 2 == 0 ? 1 : GridBagConstraints.REMAINDER;
gbConstraints.gridx = myAutoRenamerFactories.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);
myAutoRenamerFactories.put(factory, checkBox);
}
}
}
use of com.intellij.ui.NonFocusableCheckBox in project intellij-community by JetBrains.
the class MoveFilesOrDirectoriesDialog method createNorthPanel.
@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();
}
use of com.intellij.ui.NonFocusableCheckBox in project intellij-community by JetBrains.
the class RenameWithOptionalReferencesDialog method createCheckboxes.
@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);
}
use of com.intellij.ui.NonFocusableCheckBox in project intellij-community by JetBrains.
the class GrInplaceVariableIntroducer method getComponent.
@Override
protected JComponent getComponent() {
myCanBeFinalCb = new NonFocusableCheckBox("Declare final");
myCanBeFinalCb.setSelected(false);
myCanBeFinalCb.setMnemonic('f');
final GrFinalListener finalListener = new GrFinalListener(myEditor);
myCanBeFinalCb.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
new WriteCommandAction(myProject, getCommandName(), getCommandName()) {
@Override
protected void run(@NotNull Result result) throws Throwable {
PsiDocumentManager.getInstance(myProject).commitDocument(myEditor.getDocument());
final GrVariable variable = getVariable();
if (variable != null) {
finalListener.perform(myCanBeFinalCb.isSelected(), variable);
}
}
}.execute();
}
});
final JPanel panel = new JPanel(new GridBagLayout());
panel.setBorder(null);
if (myCanBeFinalCb != null) {
panel.add(myCanBeFinalCb, new GridBagConstraints(0, 1, 1, 1, 1, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
}
panel.add(Box.createVerticalBox(), new GridBagConstraints(0, 2, 1, 1, 1, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
return panel;
}
use of com.intellij.ui.NonFocusableCheckBox in project kotlin by JetBrains.
the class KotlinInplaceVariableIntroducer method getCreateExplicitTypeCheckBox.
@Nullable
protected final Function0<JComponent> getCreateExplicitTypeCheckBox() {
if (myExprType == null || noTypeInference)
return null;
return new Function0<JComponent>() {
@Override
public JComponent invoke() {
final JCheckBox exprTypeCheckbox = new NonFocusableCheckBox("Specify type explicitly");
exprTypeCheckbox.setSelected(false);
exprTypeCheckbox.setMnemonic('t');
exprTypeCheckbox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(@NotNull ActionEvent e) {
runWriteActionAndRestartRefactoring(new Runnable() {
@Override
public void run() {
if (exprTypeCheckbox.isSelected()) {
String renderedType = IdeDescriptorRenderers.SOURCE_CODE_SHORT_NAMES_IN_TYPES.renderType(myExprType);
myDeclaration.setTypeReference(new KtPsiFactory(myProject).createType(renderedType));
} else {
myDeclaration.setTypeReference(null);
}
}
});
}
});
return exprTypeCheckbox;
}
};
}
Aggregations