use of com.intellij.ui.components.JBCheckBox in project intellij-community by JetBrains.
the class HgBookmarkDialog method createCenterPanel.
@Override
@NotNull
protected JComponent createCenterPanel() {
JPanel contentPanel = new JPanel(new GridBagLayout());
GridBag g = new GridBag().setDefaultInsets(new Insets(0, 0, DEFAULT_VGAP, DEFAULT_HGAP)).setDefaultAnchor(GridBagConstraints.LINE_START).setDefaultFill(GridBagConstraints.HORIZONTAL);
JLabel icon = new JLabel(UIUtil.getQuestionIcon(), SwingConstants.LEFT);
myBookmarkName = new JBTextField(13);
myBookmarkName.getDocument().addDocumentListener(new DocumentAdapter() {
@Override
public void textChanged(DocumentEvent e) {
validateFields();
}
});
JBLabel bookmarkLabel = new JBLabel("Bookmark name:");
bookmarkLabel.setLabelFor(myBookmarkName);
myActiveCheckbox = new JBCheckBox("Inactive", false);
contentPanel.add(icon, g.nextLine().next().coverColumn(3).pady(DEFAULT_HGAP));
contentPanel.add(bookmarkLabel, g.next().fillCellNone().insets(new Insets(0, 6, DEFAULT_VGAP, DEFAULT_HGAP)));
contentPanel.add(myBookmarkName, g.next().coverLine().setDefaultWeightX(1));
contentPanel.add(myActiveCheckbox, g.nextLine().next().next().coverLine(2));
return contentPanel;
}
use of com.intellij.ui.components.JBCheckBox in project intellij-community by JetBrains.
the class TrelloRepositoryEditor method createCustomPanel.
@Nullable
@Override
protected JComponent createCustomPanel() {
myBoardComboBox = new ComboBox(300);
myBoardLabel = new JBLabel("Board:", SwingConstants.RIGHT);
myBoardLabel.setLabelFor(myBoardComboBox);
myListComboBox = new ComboBox(300);
myListLabel = new JBLabel("List:", SwingConstants.RIGHT);
myListLabel.setLabelFor(myListComboBox);
myAllCardsCheckBox = new JBCheckBox("Include cards not assigned to me");
return FormBuilder.createFormBuilder().addLabeledComponent(myBoardLabel, myBoardComboBox).addLabeledComponent(myListLabel, myListComboBox).addComponentToRightColumn(myAllCardsCheckBox).getPanel();
}
use of com.intellij.ui.components.JBCheckBox in project intellij-community by JetBrains.
the class CreateVirtualEnvDialog method layoutPanel.
protected void layoutPanel(final List<Sdk> allSdks) {
final GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.HORIZONTAL;
c.insets = new Insets(2, 2, 2, 2);
c.gridx = 0;
c.gridy = 0;
c.weightx = 0.0;
myMainPanel.add(new JBLabel(PyBundle.message("sdk.create.venv.dialog.label.name")), c);
c.gridx = 1;
c.gridy = 0;
c.gridwidth = 2;
c.weightx = 1.0;
myMainPanel.add(myName, c);
c.gridx = 0;
c.gridy = 1;
c.gridwidth = 1;
c.weightx = 0.0;
myMainPanel.add(new JBLabel(PyBundle.message("sdk.create.venv.dialog.label.location")), c);
c.gridx = 1;
c.gridy = 1;
c.gridwidth = 2;
c.weightx = 1.0;
myMainPanel.add(myDestination, c);
c.gridx = 0;
c.gridy = 2;
c.gridwidth = 1;
c.weightx = 0.0;
myMainPanel.add(new JBLabel(PyBundle.message("sdk.create.venv.dialog.label.base.interpreter")), c);
c.gridx = 1;
c.gridy = 2;
mySdkCombo = new ComboBox();
c.insets = new Insets(2, 2, 2, 2);
c.weightx = 1.0;
myMainPanel.add(mySdkCombo, c);
c.gridx = 2;
c.gridy = 2;
c.insets = new Insets(0, 0, 2, 2);
c.weightx = 0.0;
FixedSizeButton button = new FixedSizeButton();
button.setPreferredSize(myDestination.getButton().getPreferredSize());
myMainPanel.add(button, c);
c.gridx = 0;
c.gridy = 3;
c.gridwidth = 3;
c.insets = new Insets(2, 2, 2, 2);
mySitePackagesCheckBox = new JBCheckBox(PyBundle.message("sdk.create.venv.dialog.label.inherit.global.site.packages"));
myMainPanel.add(mySitePackagesCheckBox, c);
c.gridx = 0;
c.gridy = 4;
myMainPanel.add(myMakeAvailableToAllProjectsCheckbox, c);
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
final PythonSdkType sdkType = PythonSdkType.getInstance();
final FileChooserDescriptor descriptor = sdkType.getHomeChooserDescriptor();
String suggestedPath = sdkType.suggestHomePath();
VirtualFile suggestedDir = suggestedPath == null ? null : LocalFileSystem.getInstance().findFileByPath(FileUtil.toSystemIndependentName(suggestedPath));
final NullableConsumer<Sdk> consumer = sdk -> {
if (sdk == null)
return;
if (!allSdks.contains(sdk)) {
allSdks.add(sdk);
}
updateSdkList(allSdks, sdk);
};
FileChooser.chooseFiles(descriptor, myProject, suggestedDir, new FileChooser.FileChooserConsumer() {
@Override
public void consume(List<VirtualFile> selectedFiles) {
String path = selectedFiles.get(0).getPath();
if (sdkType.isValidSdkHome(path)) {
path = FileUtil.toSystemDependentName(path);
Sdk newSdk = null;
for (Sdk sdk : allSdks) {
if (path.equals(sdk.getHomePath())) {
newSdk = sdk;
}
}
if (newSdk == null) {
newSdk = new PyDetectedSdk(path);
}
consumer.consume(newSdk);
}
}
@Override
public void cancelled() {
}
});
}
});
}
use of com.intellij.ui.components.JBCheckBox in project intellij-community by JetBrains.
the class XmlEmmetConfigurable method createFiltersCheckboxes.
public void createFiltersCheckboxes() {
final List<ZenCodingFilter> filters = ZenCodingFilter.getInstances();
final GridBagLayout layoutManager = new GridBagLayout();
final GridBagConstraints constraints = new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, JBUI.emptyInsets(), 0, 0);
myFiltersListPanel.setLayout(layoutManager);
for (int i = 0; i < filters.size(); i++) {
ZenCodingFilter filter = filters.get(i);
final JBCheckBox checkBox = new JBCheckBox(filter.getDisplayName());
myFilterCheckboxes.put(filter.getSuffix(), checkBox);
constraints.gridy = i;
myFiltersListPanel.add(checkBox, constraints);
}
myFiltersListPanel.revalidate();
}
use of com.intellij.ui.components.JBCheckBox in project android by JetBrains.
the class NlIdPropertyItem method setValue.
@Override
public void setValue(Object value) {
String newId = value != null ? stripIdPrefix(value.toString()) : "";
String oldId = getValue();
XmlTag tag = getTag();
if (ourRefactoringChoice != REFACTOR_NO && oldId != null && !oldId.isEmpty() && !newId.isEmpty() && !oldId.equals(newId) && tag != null && tag.isValid()) {
// Offer rename refactoring?
XmlAttribute attribute = tag.getAttribute(SdkConstants.ATTR_ID, SdkConstants.ANDROID_URI);
if (attribute != null) {
Module module = getModel().getModule();
Project project = module.getProject();
XmlAttributeValue valueElement = attribute.getValueElement();
if (valueElement != null && valueElement.isValid()) {
// Exact replace only, no comment/text occurrence changes since it is non-interactive
ValueResourceElementWrapper wrapper = new ValueResourceElementWrapper(valueElement);
RenameProcessor processor = new RenameProcessor(project, wrapper, NEW_ID_PREFIX + newId, false, /*comments*/
false);
processor.setPreviewUsages(false);
// Do a quick usage search to see if we need to ask about renaming
UsageInfo[] usages = processor.findUsages();
if (usages.length > 0) {
int choice = ourRefactoringChoice;
if (choice == REFACTOR_ASK) {
DialogBuilder builder = createDialogBuilder(project);
builder.setTitle("Update Usages?");
// UGH!
JPanel panel = new JPanel(new BorderLayout());
JLabel label = new JLabel("<html>" + "Update usages as well?<br>" + "This will update all XML references and Java R field references.<br>" + "<br>" + "</html>");
panel.add(label, BorderLayout.CENTER);
JBCheckBox checkBox = new JBCheckBox("Don't ask again during this session");
panel.add(checkBox, BorderLayout.SOUTH);
builder.setCenterPanel(panel);
builder.setDimensionServiceKey("idPropertyDimension");
builder.removeAllActions();
DialogBuilder.CustomizableAction yesAction = builder.addOkAction();
yesAction.setText(Messages.YES_BUTTON);
builder.addActionDescriptor(dialogWrapper -> new AbstractAction(Messages.NO_BUTTON) {
@Override
public void actionPerformed(ActionEvent actionEvent) {
dialogWrapper.close(DialogWrapper.NEXT_USER_EXIT_CODE);
}
});
builder.addCancelAction();
int exitCode = builder.show();
choice = exitCode == DialogWrapper.OK_EXIT_CODE ? REFACTOR_YES : exitCode == DialogWrapper.NEXT_USER_EXIT_CODE ? REFACTOR_NO : ourRefactoringChoice;
//noinspection AssignmentToStaticFieldFromInstanceMethod
ourRefactoringChoice = checkBox.isSelected() ? choice : REFACTOR_ASK;
if (exitCode == DialogWrapper.CANCEL_EXIT_CODE) {
return;
}
}
if (choice == REFACTOR_YES) {
processor.run();
return;
}
}
}
}
}
super.setValue(!StringUtil.isEmpty(newId) ? NEW_ID_PREFIX + newId : null);
}
Aggregations