public void reset(CodeStyleSettings settings) { myCbUseFQClassNames.setSelected(settings.USE_FQ_CLASS_NAMES); myCbUseSingleClassImports.setSelected(settings.USE_SINGLE_CLASS_IMPORTS); myCbInsertInnerClassImports.setSelected(settings.INSERT_INNER_CLASS_IMPORTS); myClassCountField.setText(Integer.toString(settings.CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND)); myNamesCountField.setText(Integer.toString(settings.NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND)); myImportLayoutPanel.getImportLayoutList().copyFrom(settings.IMPORT_LAYOUT_TABLE); myPackageList.copyFrom(settings.PACKAGES_TO_USE_IMPORT_ON_DEMAND); myFqnInJavadocOption.reset(settings); myImportLayoutPanel .getCbLayoutStaticImportsSeparately() .setSelected(settings.LAYOUT_STATIC_IMPORTS_SEPARATELY); final JBTable importLayoutTable = myImportLayoutPanel.getImportLayoutTable(); AbstractTableModel model = (AbstractTableModel) importLayoutTable.getModel(); model.fireTableDataChanged(); model = (AbstractTableModel) myPackageTable.getModel(); model.fireTableDataChanged(); if (importLayoutTable.getRowCount() > 0) { importLayoutTable.getSelectionModel().setSelectionInterval(0, 0); } if (myPackageTable.getRowCount() > 0) { myPackageTable.getSelectionModel().setSelectionInterval(0, 0); } }
private void updateFields() { int index = myRulesList.getSelectedIndex(); if (index >= 0 && index != myLastSelected) { final LibraryBundlificationRule rule = myRulesModel.getElementAt(index); myLibraryRegex.setText(rule.getRuleRegex()); UIUtil.invokeLaterIfNeeded(() -> myManifestEditor.setText(rule.getAdditionalProperties())); myNeverBundle.setSelected(rule.isDoNotBundle()); myStopAfterThisRule.setSelected(rule.isStopAfterThisRule()); myLastSelected = index; } myLibraryRegex.setEnabled(index >= 0); myManifestEditor.setEnabled(index >= 0); myNeverBundle.setEnabled(index >= 0); myStopAfterThisRule.setEnabled(index >= 0); }
@Nullable public Component getTableCellEditorComponent( JTable table, Object value, boolean isSelected, int row, int column) { myValue = ((MyTableModel) table.getModel()).getRegistryValue(row); if (myValue.asColor(null) != null) { final Color color = ColorChooser.chooseColor( table, "Choose color", ((RegistryValue) value).asColor(Color.WHITE)); if (color != null) { myValue.setValue(color.getRed() + "," + color.getGreen() + "," + color.getBlue()); } return null; } else if (myValue.isBoolean()) { myCheckBox.setSelected(myValue.asBoolean()); myCheckBox.setBackground(table.getBackground()); return myCheckBox; } else { myField.setText(myValue.asString()); myField.setBorder(null); myField.selectAll(); return myField; } }
public CreateXmlResourceDialog( @NotNull Module module, @NotNull ResourceType resourceType, @Nullable String predefinedName, @Nullable String predefinedValue, boolean chooseName, @Nullable VirtualFile defaultFile) { super(module.getProject()); myResourceType = resourceType; if (predefinedName != null && predefinedName.length() > 0) { if (!chooseName) { myNameLabel.setVisible(false); myNameField.setVisible(false); } myNameField.setText(predefinedName); } if (predefinedValue != null && predefinedValue.length() > 0) { myValueLabel.setVisible(false); myValueField.setVisible(false); myValueField.setText(predefinedValue); } final Set<Module> modulesSet = new HashSet<Module>(); modulesSet.add(module); for (AndroidFacet depFacet : AndroidUtils.getAllAndroidDependencies(module, true)) { modulesSet.add(depFacet.getModule()); } assert modulesSet.size() > 0; if (modulesSet.size() == 1) { myModule = module; myModuleLabel.setVisible(false); myModuleCombo.setVisible(false); } else { myModule = null; final Module[] modules = modulesSet.toArray(new Module[modulesSet.size()]); Arrays.sort( modules, new Comparator<Module>() { @Override public int compare(Module m1, Module m2) { return m1.getName().compareTo(m2.getName()); } }); myModuleCombo.setModel(new DefaultComboBoxModel(modules)); myModuleCombo.setSelectedItem(module); myModuleCombo.setRenderer(new ModuleListCellRendererWrapper(myModuleCombo.getRenderer())); } if (defaultFile == null) { final String defaultFileName = AndroidResourceUtil.getDefaultResourceFileName(resourceType); if (defaultFileName != null) { myFileNameCombo.getEditor().setItem(defaultFileName); } } myDirectoriesList = new CheckBoxList(); myDirectoriesLabel.setLabelFor(myDirectoriesList); final ToolbarDecorator decorator = ToolbarDecorator.createDecorator(myDirectoriesList); decorator.setEditAction(null); decorator.disableUpDownActions(); decorator.setAddAction( new AnActionButtonRunnable() { @Override public void run(AnActionButton button) { doAddNewDirectory(); } }); decorator.setRemoveAction( new AnActionButtonRunnable() { @Override public void run(AnActionButton button) { doDeleteDirectory(); } }); final AnActionButton selectAll = new AnActionButton("Select All", null, PlatformIcons.SELECT_ALL_ICON) { @Override public void actionPerformed(AnActionEvent e) { doSelectAllDirs(); } }; decorator.addExtraAction(selectAll); final AnActionButton unselectAll = new AnActionButton("Unselect All", null, PlatformIcons.UNSELECT_ALL_ICON) { @Override public void actionPerformed(AnActionEvent e) { doUnselectAllDirs(); } }; decorator.addExtraAction(unselectAll); myDirectoriesPanel.add(decorator.createPanel()); updateDirectories(true); myModuleCombo.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { updateDirectories(true); } }); final JCheckBox valuesCheckBox = myCheckBoxes.get(SdkConstants.FD_RES_VALUES); if (valuesCheckBox != null) { valuesCheckBox.setSelected(true); } if (defaultFile != null) { resetFromFile(defaultFile, module.getProject()); } init(); }