@Override public void updateOptionsList() { myIsInSchemeChange = true; myLineSpacingField.setText(Float.toString(getLineSpacing())); FontPreferences fontPreferences = getFontPreferences(); List<String> fontFamilies = fontPreferences.getEffectiveFontFamilies(); myPrimaryCombo.setFontName(fontPreferences.getFontFamily()); boolean isThereSecondaryFont = fontFamilies.size() > 1; myUseSecondaryFontCheckbox.setSelected(isThereSecondaryFont); mySecondaryCombo.setFontName(isThereSecondaryFont ? fontFamilies.get(1) : null); myEditorFontSizeField.setText( String.valueOf(fontPreferences.getSize(fontPreferences.getFontFamily()))); boolean readOnly = ColorAndFontOptions.isReadOnly(myOptions.getSelectedScheme()); myPrimaryCombo.setEnabled(!readOnly); mySecondaryCombo.setEnabled(isThereSecondaryFont && !readOnly); myOnlyMonospacedCheckBox.setEnabled(!readOnly); myLineSpacingField.setEnabled(!readOnly); myEditorFontSizeField.setEnabled(!readOnly); myUseSecondaryFontCheckbox.setEnabled(!readOnly); myEnableLigaturesCheckbox.setEnabled(!readOnly); myLigaturesInfoLinkLabel.setEnabled(!readOnly); myEnableLigaturesCheckbox.setSelected(fontPreferences.useLigatures()); myIsInSchemeChange = false; }
public boolean updateDescription(boolean modified) { EditorColorsScheme scheme = myOptions.getSelectedScheme(); if (modified && (ColorAndFontOptions.isReadOnly(scheme) || ColorSettingsUtil.isSharedScheme(scheme))) { showReadOnlyMessage(this, ColorSettingsUtil.isSharedScheme(scheme)); return false; } myDispatcher.getMulticaster().fontChanged(); return true; }
private Collection<EditorSchemeAttributeDescriptor> getOrderedDescriptors( @NotNull ColorAndFontOptions options) { ArrayList<EditorSchemeAttributeDescriptor> list = ContainerUtil.newArrayList(); for (EditorSchemeAttributeDescriptor description : options.getCurrentDescriptions()) { if (!description.getGroup().equals(myCategoryName)) continue; list.add(description); } Collections.sort(list, ATTR_COMPARATOR); return list; }
private void editColorsAndFonts() { final String toConfigure = getSelectedType().getSeverity(null).myName; doOKAction(); myOptionsList.clearSelection(); final DataContext dataContext = DataManager.getInstance().getDataContext(myPanel); final OptionsEditor optionsEditor = OptionsEditor.KEY.getData(dataContext); if (optionsEditor != null) { final ColorAndFontOptions colorAndFontOptions = optionsEditor.findConfigurable(ColorAndFontOptions.class); assert colorAndFontOptions != null; final SearchableConfigurable javaPage = colorAndFontOptions.findSubConfigurable(InspectionColorSettingsPage.class); LOG.assertTrue(javaPage != null); optionsEditor .clearSearchAndSelect(javaPage) .doWhenDone( new Runnable() { @Override public void run() { final Runnable runnable = javaPage.enableSearch(toConfigure); if (runnable != null) { SwingUtilities.invokeLater(runnable); } } }); } else { ColorAndFontOptions colorAndFontOptions = new ColorAndFontOptions(); final Configurable[] configurables = colorAndFontOptions.buildConfigurables(); try { final SearchableConfigurable javaPage = colorAndFontOptions.findSubConfigurable(InspectionColorSettingsPage.class); LOG.assertTrue(javaPage != null); ShowSettingsUtil.getInstance() .editConfigurable(CommonDataKeys.PROJECT.getData(dataContext), javaPage); } finally { for (Configurable configurable : configurables) { configurable.disposeUIResources(); } colorAndFontOptions.disposeUIResources(); } } }
protected EditorColorsScheme getCurrentScheme() { return myOptions.getSelectedScheme(); }