当前位置: 首页>>代码示例>>Java>>正文


Java ColorSettingsPage类代码示例

本文整理汇总了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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ColorSettingsPagesImpl.java

示例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);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:27,代码来源:SimpleEditorPreview.java

示例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;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:ColorSettingsPagesImpl.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:ColorSettingsUtil.java

示例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;        
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:ColorSettingsUtil.java

示例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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:SimpleEditorPreview.java

示例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>&nbsp;";
    }

    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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:36,代码来源:ColorAndFontDescriptionPanel.java

示例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()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:ColorSettingsPagesImpl.java

示例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());
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:34,代码来源:ColorAndFontDescriptionPanel.java

示例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;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:11,代码来源:ColorSettingsUtil.java

示例11: getBaseAttributeDescriptor

import com.intellij.openapi.options.colors.ColorSettingsPage; //导入依赖的package包/类
@Nullable
public Pair<ColorSettingsPage,AttributesDescriptor> getBaseAttributeDescriptor() {
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:ColorAndFontDescription.java

示例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();
    }
  });

}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:76,代码来源:NewColorAndFontPanel.java

示例13: getSettingsPage

import com.intellij.openapi.options.colors.ColorSettingsPage; //导入依赖的package包/类
public ColorSettingsPage getSettingsPage() {
  return mySettingsPage;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:NewColorAndFontPanel.java

示例14: registerPage

import com.intellij.openapi.options.colors.ColorSettingsPage; //导入依赖的package包/类
@Override
public void registerPage(ColorSettingsPage page) {
  myPages.add(page);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:ColorSettingsPagesImpl.java

示例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();
    }
  });

}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:60,代码来源:NewColorAndFontPanel.java


注:本文中的com.intellij.openapi.options.colors.ColorSettingsPage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。