本文整理匯總了Java中com.intellij.openapi.options.colors.ColorSettingsPage類的典型用法代碼示例。如果您正苦於以下問題:Java ColorSettingsPage類的具體用法?Java ColorSettingsPage怎麽用?Java ColorSettingsPage使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ColorSettingsPage類屬於com.intellij.openapi.options.colors包,在下文中一共展示了ColorSettingsPage類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getAttributeDescriptor
import com.intellij.openapi.options.colors.ColorSettingsPage; //導入依賴的package包/類
@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 = Pair.create(page, descriptor);
myKeyToDescriptorMap.put(key, result);
return result;
}
}
}
myKeyToDescriptorMap.put(key, null);
}
return null;
}
示例2: SimpleEditorPreview
import com.intellij.openapi.options.colors.ColorSettingsPage; //導入依賴的package包/類
public SimpleEditorPreview(final ColorAndFontOptions options, final ColorSettingsPage page, final boolean navigatable) {
myOptions = options;
myPage = page;
String text = page.getDemoText();
HighlightsExtractor extractant2 = new HighlightsExtractor(page.getAdditionalHighlightingTagToDescriptorMap());
myHighlightData = extractant2.extractHighlights(text);
int selectedLine = -1;
myEditor = (EditorEx)FontEditorPreview.createPreviewEditor(extractant2.cutDefinedTags(text), 10, 3, selectedLine, myOptions, false);
FontEditorPreview.installTrafficLights(myEditor);
myBlinkingAlarm = new Alarm().setActivationComponent(myEditor.getComponent());
if (navigatable) {
addMouseMotionListener(myEditor, page.getHighlighter(), myHighlightData, false);
CaretListener listener = new CaretListener() {
@Override
public void caretPositionChanged(CaretEvent e) {
navigate(myEditor, true, e.getNewPosition(), page.getHighlighter(), myHighlightData, false);
}
};
myEditor.getCaretModel().addCaretListener(listener);
}
}
示例3: getAttributeDescriptor
import com.intellij.openapi.options.colors.ColorSettingsPage; //導入依賴的package包/類
@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;
}
示例4: keyToDisplayTextMap
import com.intellij.openapi.options.colors.ColorSettingsPage; //導入依賴的package包/類
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;
}
示例5: isInspectionColorsPage
import com.intellij.openapi.options.colors.ColorSettingsPage; //導入依賴的package包/類
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;
}
示例6: SimpleEditorPreview
import com.intellij.openapi.options.colors.ColorSettingsPage; //導入依賴的package包/類
public SimpleEditorPreview(final ColorAndFontOptions options, final ColorSettingsPage page, final boolean navigatable) {
myOptions = options;
myPage = page;
String text = page.getDemoText();
HighlightsExtractor extractant2 = new HighlightsExtractor(page.getAdditionalHighlightingTagToDescriptorMap());
List<HighlightData> highlights = new ArrayList<HighlightData>();
String stripped = extractant2.extractHighlights(text, highlights);
myHighlightData = highlights.toArray(new HighlightData[highlights.size()]);
int selectedLine = -1;
myEditor = (EditorEx)FontEditorPreview.createPreviewEditor(stripped, 10, 3, selectedLine, myOptions, false);
FontEditorPreview.installTrafficLights(myEditor);
myBlinkingAlarm = new Alarm().setActivationComponent(myEditor.getComponent());
if (navigatable) {
addMouseMotionListener(myEditor, page.getHighlighter(), myHighlightData, false);
CaretListener listener = new CaretAdapter() {
@Override
public void caretPositionChanged(CaretEvent e) {
navigate(myEditor, true, e.getNewPosition(), page.getHighlighter(), myHighlightData, false);
}
};
myEditor.getCaretModel().addCaretListener(listener);
}
}
示例7: setInheritanceInfo
import com.intellij.openapi.options.colors.ColorSettingsPage; //導入依賴的package包/類
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);
}
}
示例8: getRegisteredPages
import com.intellij.openapi.options.colors.ColorSettingsPage; //導入依賴的package包/類
@Override
public ColorSettingsPage[] getRegisteredPages() {
if (!myExtensionsLoaded) {
myExtensionsLoaded = true;
Collections.addAll(myPages, Extensions.getExtensions(ColorSettingsPage.EP_NAME));
}
return myPages.toArray(new ColorSettingsPage[myPages.size()]);
}
示例9: setInheritanceLabel
import com.intellij.openapi.options.colors.ColorSettingsPage; //導入依賴的package包/類
private void setInheritanceLabel(ColorAndFontDescription description) {
Pair<ColorSettingsPage, AttributesDescriptor> baseDescriptor = description.getBaseAttributeDescriptor();
if (baseDescriptor != null && baseDescriptor.second.getDisplayName() != null) {
String attrName = baseDescriptor.second.getDisplayName();
ColorSettingsPage settingsPage = baseDescriptor.first;
String pageName = "?";
if (settingsPage != null) {
pageName = settingsPage.getDisplayName();
}
String tooltipText = attrName + " (" + pageName + ")";
String labelText = tooltipText;
if (labelText.length() > 30 && pageName.length() >= 4) {
labelText = attrName + " (" + pageName.substring(0, 4) + "...)";
}
if (description.isInherited()) {
myInheritanceLabel.setIcon(INHERITED_ICON);
}
else {
myInheritanceLabel.setDisabledIcon(INHERITED_ICON);
}
myInheritanceLabel.setText(labelText);
myInheritanceLabel.setToolTipText(tooltipText);
myInheritanceLabel.setForeground(myLabelFont.getForeground());
myInheritanceLabel.setEnabled(description.isInherited());
}
else {
myInheritanceLabel.setText("X");
myInheritanceLabel.setIcon(null);
myInheritanceLabel.setDisabledIcon(null);
myInheritanceLabel.setEnabled(true);
myInheritanceLabel.setForeground(myLabelFont.getBackground());
}
}
示例10: isInspectionColorsPage
import com.intellij.openapi.options.colors.ColorSettingsPage; //導入依賴的package包/類
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;
}
示例11: getBaseAttributeDescriptor
import com.intellij.openapi.options.colors.ColorSettingsPage; //導入依賴的package包/類
@Nullable
public Pair<ColorSettingsPage,AttributesDescriptor> getBaseAttributeDescriptor() {
return null;
}
示例12: NewColorAndFontPanel
import com.intellij.openapi.options.colors.ColorSettingsPage; //導入依賴的package包/類
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));
wrapper.add(new JButton(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();
}
}));
top.add(wrapper, BorderLayout.SOUTH);
}
// 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()))) {
add(top, BorderLayout.NORTH);
add(myPreviewPanel.getPanel(), BorderLayout.CENTER);
}
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();
}
});
}
示例13: getSettingsPage
import com.intellij.openapi.options.colors.ColorSettingsPage; //導入依賴的package包/類
public ColorSettingsPage getSettingsPage() {
return mySettingsPage;
}
示例14: registerPage
import com.intellij.openapi.options.colors.ColorSettingsPage; //導入依賴的package包/類
@Override
public void registerPage(ColorSettingsPage page) {
myPages.add(page);
}
示例15: NewColorAndFontPanel
import com.intellij.openapi.options.colors.ColorSettingsPage; //導入依賴的package包/類
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);
// 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()))) {
add(top, BorderLayout.NORTH);
add(myPreviewPanel.getPanel(), BorderLayout.CENTER);
}
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();
}
});
}