當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。