com.intellij.openapi.options.colors.ColorSettingsPage Java Examples
The following examples show how to use
com.intellij.openapi.options.colors.ColorSettingsPage.
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: ColorSettingsPagesImpl.java From consulo with Apache License 2.0 | 6 votes |
@Override @Nullable public Pair<ColorSettingsPage,AttributesDescriptor> getAttributeDescriptor(TextAttributesKey key) { if (myKeyToDescriptorMap.containsKey(key)) { return myKeyToDescriptorMap.get(key); } else { for (ColorSettingsPage page : getRegisteredPages()) { for (AttributesDescriptor descriptor : page.getAttributeDescriptors()) { if (descriptor.getKey() == key) { Pair<ColorSettingsPage,AttributesDescriptor> result = new Pair<ColorSettingsPage, AttributesDescriptor>(page, descriptor); myKeyToDescriptorMap.put(key, result); return result; } } } myKeyToDescriptorMap.put(key, null); } return null; }
Example #2
Source File: ColorSettingsUtil.java From consulo with Apache License 2.0 | 5 votes |
public static Map<TextAttributesKey, String> keyToDisplayTextMap(final ColorSettingsPage page) { final List<AttributesDescriptor> attributeDescriptors = getAllAttributeDescriptors(page); final Map<TextAttributesKey, String> displayText = new HashMap<TextAttributesKey, String>(); for (AttributesDescriptor attributeDescriptor : attributeDescriptors) { final TextAttributesKey key = attributeDescriptor.getKey(); displayText.put(key, attributeDescriptor.getDisplayName()); } return displayText; }
Example #3
Source File: ColorSettingsUtil.java From consulo with Apache License 2.0 | 5 votes |
private static boolean isInspectionColorsPage(ColorAndFontDescriptorsProvider provider) { // the first registered page implementing InspectionColorSettingsPage // gets the inspection attribute descriptors added to its list if (!(provider instanceof InspectionColorSettingsPage)) return false; for(ColorSettingsPage settingsPage: Extensions.getExtensions(ColorSettingsPage.EP_NAME)) { if (settingsPage == provider) break; if (settingsPage instanceof InspectionColorSettingsPage) return false; } return true; }
Example #4
Source File: ColorAndFontDescriptionPanel.java From consulo with Apache License 2.0 | 5 votes |
private void setInheritanceInfo(ColorAndFontDescription description) { Pair<ColorSettingsPage, AttributesDescriptor> baseDescriptor = description.getBaseAttributeDescriptor(); if (baseDescriptor != null && baseDescriptor.second.getDisplayName() != null) { String attrName = baseDescriptor.second.getDisplayName(); String attrLabel = attrName.replaceAll(ColorOptionsTree.NAME_SEPARATOR, FontUtil.rightArrow(UIUtil.getLabelFont())); ColorSettingsPage settingsPage = baseDescriptor.first; String style = "<div style=\"text-align:right\" vertical-align=\"top\">"; String tooltipText; String labelText; if (settingsPage != null) { String pageName = settingsPage.getDisplayName(); tooltipText = "'" + attrLabel + "' from<br>'" + pageName + "' section"; labelText = style + "'" + attrLabel + "'<br>of <a href=\"" + attrName + "\">" + pageName; } else { tooltipText = attrLabel; labelText = style + attrLabel + "<br> "; } myInheritanceLabel.setVisible(true); myInheritanceLabel.setText(labelText); myInheritanceLabel.setToolTipText(tooltipText); myInheritanceLabel.setEnabled(true); myInheritAttributesBox.setVisible(true); myInheritAttributesBox.setEnabled(true); myInheritAttributesBox.setSelected(description.isInherited()); setEditEnabled(!description.isInherited(), description); } else { myInheritanceLabel.setVisible(false); myInheritAttributesBox.setSelected(false); myInheritAttributesBox.setVisible(false); setEditEnabled(true, description); } }
Example #5
Source File: ColorSettingsPagesImpl.java From consulo with Apache License 2.0 | 5 votes |
@Override public ColorSettingsPage[] getRegisteredPages() { if (!myExtensionsLoaded) { myExtensionsLoaded = true; Collections.addAll(myPages, Extensions.getExtensions(ColorSettingsPage.EP_NAME)); } return myPages.toArray(new ColorSettingsPage[myPages.size()]); }
Example #6
Source File: SimpleEditorPreview.java From consulo with Apache License 2.0 | 4 votes |
public SimpleEditorPreview(final ColorAndFontOptions options, final ColorSettingsPage page) { this(options, page, true); }
Example #7
Source File: ColorAndFontDescription.java From consulo with Apache License 2.0 | 4 votes |
@Nullable public Pair<ColorSettingsPage,AttributesDescriptor> getBaseAttributeDescriptor() { return null; }
Example #8
Source File: NewColorAndFontPanel.java From consulo with Apache License 2.0 | 4 votes |
public NewColorAndFontPanel(final SchemesPanel schemesPanel, final OptionsPanel optionsPanel, final PreviewPanel previewPanel, final String category, final Collection<String> optionList, final ColorSettingsPage page) { super(new BorderLayout(0, 10)); mySchemesPanel = schemesPanel; myOptionsPanel = optionsPanel; myPreviewPanel = previewPanel; myCategory = category; myOptionList = optionList; mySettingsPage = page; JPanel top = new JPanel(new BorderLayout()); top.add(mySchemesPanel, BorderLayout.NORTH); top.add(myOptionsPanel.getPanel(), BorderLayout.CENTER); if (optionsPanel instanceof ConsoleFontOptions) { JPanel wrapper = new JPanel(new FlowLayout(FlowLayout.TRAILING)); myCopyAction = new AbstractAction(ApplicationBundle.message("action.apply.editor.font.settings")) { @Override public void actionPerformed(ActionEvent e) { EditorColorsScheme scheme = ((ConsoleFontOptions)myOptionsPanel).getCurrentScheme(); scheme.setConsoleFontName(scheme.getEditorFontName()); scheme.setConsoleFontPreferences(scheme.getFontPreferences()); scheme.setConsoleFontSize(scheme.getEditorFontSize()); scheme.setConsoleLineSpacing(scheme.getLineSpacing()); myOptionsPanel.updateOptionsList(); myPreviewPanel.updateView(); } }; wrapper.add(new JButton(myCopyAction)); top.add(wrapper, BorderLayout.SOUTH); } else { myCopyAction = null; } // We don't want to show non-used preview panel (it's considered to be not in use if it doesn't contain text). if (myPreviewPanel.getPanel() != null && (page == null || !StringUtil.isEmptyOrSpaces(page.getDemoText()))) { @SuppressWarnings("SuspiciousNameCombination") JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, top, myPreviewPanel.getPanel()); splitPane.setBorder(BorderFactory.createEmptyBorder()); splitPane.setContinuousLayout(true); add(splitPane); GuiUtils.replaceJSplitPaneWithIDEASplitter(splitPane); } else { add(top, BorderLayout.CENTER); } previewPanel.addListener(new ColorAndFontSettingsListener.Abstract() { @Override public void selectionInPreviewChanged(final String typeToSelect) { optionsPanel.selectOption(typeToSelect); } }); optionsPanel.addListener(new ColorAndFontSettingsListener.Abstract() { @Override public void settingsChanged() { if (schemesPanel.updateDescription(true)) { optionsPanel.applyChangesToScheme(); previewPanel.updateView(); } } @Override public void selectedOptionChanged(final Object selected) { if (ApplicationManager.getApplication().isDispatchThread()) { myPreviewPanel.blinkSelectedHighlightType(selected); } } }); mySchemesPanel.addListener(new ColorAndFontSettingsListener.Abstract() { @Override public void schemeChanged(final Object source) { myOptionsPanel.updateOptionsList(); myPreviewPanel.updateView(); if (optionsPanel instanceof ConsoleFontOptions) { ConsoleFontOptions options = (ConsoleFontOptions)optionsPanel; boolean readOnly = ColorAndFontOptions.isReadOnly(options.getCurrentScheme()); myCopyAction.setEnabled(!readOnly); } } }); }
Example #9
Source File: NewColorAndFontPanel.java From consulo with Apache License 2.0 | 4 votes |
public ColorSettingsPage getSettingsPage() { return mySettingsPage; }
Example #10
Source File: ColorSettingsPagesImpl.java From consulo with Apache License 2.0 | 4 votes |
@Override public void registerPage(ColorSettingsPage page) { myPages.add(page); }
Example #11
Source File: NewColorAndFontPanel.java From consulo with Apache License 2.0 | 3 votes |
public static NewColorAndFontPanel create(final PreviewPanel previewPanel, String category, final ColorAndFontOptions options, Collection<String> optionList, ColorSettingsPage page) { final SchemesPanel schemesPanel = new SchemesPanel(options); final OptionsPanel optionsPanel = new OptionsPanelImpl(options, schemesPanel, category); return new NewColorAndFontPanel(schemesPanel, optionsPanel, previewPanel, category, optionList, page); }