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


Java EditorColorsScheme类代码示例

本文整理汇总了Java中com.intellij.openapi.editor.colors.EditorColorsScheme的典型用法代码示例。如果您正苦于以下问题:Java EditorColorsScheme类的具体用法?Java EditorColorsScheme怎么用?Java EditorColorsScheme使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


EditorColorsScheme类属于com.intellij.openapi.editor.colors包,在下文中一共展示了EditorColorsScheme类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: SoyLayeredHighlighter

import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入依赖的package包/类
public SoyLayeredHighlighter(
    @Nullable Project project,
    @Nullable VirtualFile virtualFile,
    @NotNull EditorColorsScheme colors) {
  // Creating main highlighter.
  super(new SoySyntaxHighlighter(), colors);

  // Highlighter for the outer language.
  FileType type = null;
  if (project == null || virtualFile == null) {
    type = StdFileTypes.PLAIN_TEXT;
  } else {
    Language language = TemplateDataLanguageMappings.getInstance(project).getMapping(virtualFile);
    if (language != null) type = language.getAssociatedFileType();
    if (type == null) type = SoyLanguage.getDefaultTemplateLang();
  }

  SyntaxHighlighter outerHighlighter =
      SyntaxHighlighterFactory.getSyntaxHighlighter(type, project, virtualFile);

  registerLayer(OTHER, new LayerDescriptor(outerHighlighter, ""));
}
 
开发者ID:google,项目名称:bamboo-soy,代码行数:23,代码来源:SoyLayeredHighlighter.java

示例2: createUIComponents

import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入依赖的package包/类
private void createUIComponents() {
    final EditorFactory editorFactory = EditorFactory.getInstance();
    jsonDocument = editorFactory.createDocument(EMPTY_TEXT);
    jsonEditor = editorFactory.createEditor(jsonDocument, project, JsonFileType.INSTANCE, false);

    final EditorSettings settings = jsonEditor.getSettings();
    settings.setWhitespacesShown(true);
    settings.setLineMarkerAreaShown(false);
    settings.setIndentGuidesShown(false);
    settings.setLineNumbersShown(true);
    settings.setFoldingOutlineShown(false);
    settings.setRightMarginShown(false);
    settings.setVirtualSpace(false);
    settings.setWheelFontChangeEnabled(false);
    settings.setUseSoftWraps(false);
    settings.setAdditionalColumnsCount(0);
    settings.setAdditionalLinesCount(1);

    final EditorColorsScheme colorsScheme = jsonEditor.getColorsScheme();
    colorsScheme.setColor(EditorColors.CARET_ROW_COLOR, null);

    jsonEditor.getContentComponent().setFocusable(true);
    jsonPanel = (JPanel) jsonEditor.getComponent();
}
 
开发者ID:t28hub,项目名称:json2java4idea,代码行数:25,代码来源:NewClassDialog.java

示例3: createTaskInfoPanel

import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入依赖的package包/类
@Override
public JComponent createTaskInfoPanel(Project project) {
  myTaskTextPane = new JTextPane();
  final JBScrollPane scrollPane = new JBScrollPane(myTaskTextPane);
  myTaskTextPane.setContentType(new HTMLEditorKit().getContentType());
  final EditorColorsScheme editorColorsScheme = EditorColorsManager.getInstance().getGlobalScheme();
  int fontSize = editorColorsScheme.getEditorFontSize();
  final String fontName = editorColorsScheme.getEditorFontName();
  final Font font = new Font(fontName, Font.PLAIN, fontSize);
  String bodyRule = "body { font-family: " + font.getFamily() + "; " +
                    "font-size: " + font.getSize() + "pt; }" +
                    "pre {font-family: Courier; display: inline; ine-height: 50px; padding-top: 5px; padding-bottom: 5px; padding-left: 5px; background-color:"
                    + ColorUtil.toHex(ColorUtil.dimmer(UIUtil.getPanelBackground())) + ";}" +
                    "code {font-family: Courier; display: flex; float: left; background-color:"
                    + ColorUtil.toHex(ColorUtil.dimmer(UIUtil.getPanelBackground())) + ";}";
  ((HTMLDocument)myTaskTextPane.getDocument()).getStyleSheet().addRule(bodyRule);
  myTaskTextPane.setEditable(false);
  if (!UIUtil.isUnderDarcula()) {
    myTaskTextPane.setBackground(EditorColorsManager.getInstance().getGlobalScheme().getDefaultBackground());
  }
  myTaskTextPane.setBorder(new EmptyBorder(20, 20, 0, 10));
  myTaskTextPane.addHyperlinkListener(BrowserHyperlinkListener.INSTANCE);
  return scrollPane;
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:25,代码来源:StudySwingToolWindow.java

示例4: drawAnswerPlaceholder

import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入依赖的package包/类
public static void drawAnswerPlaceholder(@NotNull final Editor editor, @NotNull final AnswerPlaceholder placeholder,
                                         @NotNull final JBColor color) {
  EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme();
  final TextAttributes textAttributes = new TextAttributes(scheme.getDefaultForeground(), scheme.getDefaultBackground(), null,
                                                           EffectType.BOXED, Font.PLAIN);
  textAttributes.setEffectColor(color);
  int startOffset = placeholder.getOffset();
  if (startOffset == -1) {
    return;
  }
  final int length =
    placeholder.isActive() ? placeholder.getRealLength() : placeholder.getVisibleLength(placeholder.getActiveSubtaskIndex());
  Pair<Integer, Integer> offsets = StudyUtils.getPlaceholderOffsets(placeholder, editor.getDocument());
  startOffset = offsets.first;
  int endOffset = offsets.second;
  if (placeholder.isActive()) {
    drawAnswerPlaceholder(editor, startOffset, endOffset, textAttributes, PLACEHOLDERS_LAYER);
  }
  else if (!placeholder.getUseLength() && length != 0) {
    drawAnswerPlaceholderFromPrevStep(editor, startOffset, endOffset);
  }
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:23,代码来源:EduAnswerPlaceholderPainter.java

示例5: updateView

import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入依赖的package包/类
@Override
public void updateView() {
  EditorColorsScheme scheme = myOptions.getSelectedScheme();

  myEditor.setColorsScheme(scheme);

  EditorHighlighter highlighter = null;
  if (myPage instanceof EditorHighlightingProvidingColorSettingsPage) {

    highlighter = ((EditorHighlightingProvidingColorSettingsPage)myPage).createEditorHighlighter(scheme);
  }
  if (highlighter == null) {
    final SyntaxHighlighter pageHighlighter = myPage.getHighlighter();
    highlighter = HighlighterFactory.createHighlighter(pageHighlighter, scheme);
  }
  myEditor.setHighlighter(highlighter);
  updateHighlighters();

  myEditor.reinitSettings();

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

示例6: getTextAttributes

import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入依赖的package包/类
@Nullable
@Override
public TextAttributes getTextAttributes(@NotNull EditorColorsScheme scheme, @NotNull ArrangementSettingsToken token, boolean selected) {
  if (selected) {
    TextAttributes attributes = new TextAttributes();
    attributes.setForegroundColor(scheme.getColor(EditorColors.SELECTION_FOREGROUND_COLOR));
    attributes.setBackgroundColor(scheme.getColor(EditorColors.SELECTION_BACKGROUND_COLOR));
    return attributes;
  }
  else if (SUPPORTED_TYPES.contains(token)) {
    return getAttributes(scheme, JavaHighlightingColors.KEYWORD);
  }
  else if (SUPPORTED_MODIFIERS.contains(token)) {
    getAttributes(scheme, JavaHighlightingColors.KEYWORD);
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:JavaRearranger.java

示例7: testScopeBased

import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入依赖的package包/类
public void testScopeBased() throws Exception {
  NamedScope xScope = new NamedScope("xxx", new PatternPackageSet("x..*", PatternPackageSet.SCOPE_SOURCE, null));
  NamedScope utilScope = new NamedScope("util", new PatternPackageSet("java.util.*", PatternPackageSet.SCOPE_LIBRARY, null));
  NamedScopeManager scopeManager = NamedScopeManager.getInstance(getProject());
  scopeManager.addScope(xScope);
  scopeManager.addScope(utilScope);

  EditorColorsManager manager = EditorColorsManager.getInstance();
  EditorColorsScheme scheme = (EditorColorsScheme)manager.getGlobalScheme().clone();
  manager.addColorsScheme(scheme);
  EditorColorsManager.getInstance().setGlobalScheme(scheme);
  TextAttributesKey xKey = ScopeAttributesUtil.getScopeTextAttributeKey(xScope.getName());
  TextAttributes xAttributes = new TextAttributes(Color.cyan, Color.darkGray, Color.blue, EffectType.BOXED, Font.ITALIC);
  scheme.setAttributes(xKey, xAttributes);

  TextAttributesKey utilKey = ScopeAttributesUtil.getScopeTextAttributeKey(utilScope.getName());
  TextAttributes utilAttributes = new TextAttributes(Color.gray, Color.magenta, Color.orange, EffectType.STRIKEOUT, Font.BOLD);
  scheme.setAttributes(utilKey, utilAttributes);

  try {
    testFile(BASE_PATH + "/scopeBased/x/X.java").projectRoot(BASE_PATH + "/scopeBased").checkSymbolNames().test();
  }
  finally {
    scopeManager.removeAllSets();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:AdvHighlightingTest.java

示例8: update

import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入依赖的package包/类
@Override
public void update(PresentationData presentation) {
  String newName = getValue().getName();
  int nameEndOffset = newName.length();
  int todoItemCount = getTodoItemCount(getValue());
  int fileCount = getFileCount(getValue());
  newName = IdeBundle.message("node.todo.group", newName, todoItemCount, fileCount);
  myHighlightedRegions.clear();

  TextAttributes textAttributes = new TextAttributes();

  if (CopyPasteManager.getInstance().isCutElement(getValue())) {
    textAttributes.setForegroundColor(CopyPasteManager.CUT_COLOR);
  }
  myHighlightedRegions.add(new HighlightedRegion(0, nameEndOffset, textAttributes));

  EditorColorsScheme colorsScheme = UsageTreeColorsScheme.getInstance().getScheme();
  myHighlightedRegions.add(
    new HighlightedRegion(nameEndOffset, newName.length(), colorsScheme.getAttributes(UsageTreeColors.NUMBER_OF_USAGES)));
  presentation.setIcon(ModuleType.get(getValue()).getIcon());
  presentation.setPresentableText(newName);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:ModuleToDoNode.java

示例9: createMethodSeparatorLineMarker

import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入依赖的package包/类
@NotNull
public static LineMarkerInfo createMethodSeparatorLineMarker(@NotNull PsiElement startFrom, @NotNull EditorColorsManager colorsManager) {
  LineMarkerInfo info = new LineMarkerInfo<PsiElement>(
    startFrom, 
    startFrom.getTextRange(), 
    null, 
    Pass.UPDATE_ALL, 
    FunctionUtil.<Object, String>nullConstant(),
    null, 
    GutterIconRenderer.Alignment.RIGHT
  );
  EditorColorsScheme scheme = colorsManager.getGlobalScheme();
  info.separatorColor = scheme.getColor(CodeInsightColors.METHOD_SEPARATORS_COLOR);
  info.separatorPlacement = SeparatorPlacement.TOP;
  return info;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:LineMarkersPass.java

示例10: createEditor

import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入依赖的package包/类
protected static Editor createEditor(String text, int column, int line, int selectedLine) {
  EditorFactory editorFactory = EditorFactory.getInstance();
  Document editorDocument = editorFactory.createDocument(text);
  EditorEx editor = (EditorEx)editorFactory.createViewer(editorDocument);
  EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme();
  editor.setColorsScheme(scheme);
  EditorSettings settings = editor.getSettings();
  settings.setWhitespacesShown(true);
  settings.setLineMarkerAreaShown(false);
  settings.setIndentGuidesShown(false);
  settings.setFoldingOutlineShown(false);
  settings.setAdditionalColumnsCount(0);
  settings.setAdditionalLinesCount(0);
  settings.setRightMarginShown(true);
  settings.setRightMargin(60);

  LogicalPosition pos = new LogicalPosition(line, column);
  editor.getCaretModel().moveToLogicalPosition(pos);
  if (selectedLine >= 0) {
    editor.getSelectionModel().setSelection(editorDocument.getLineStartOffset(selectedLine),
                                            editorDocument.getLineEndOffset(selectedLine));
  }

  return editor;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:ActionUsagePanel.java

示例11: getAllSchemes

import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入依赖的package包/类
@NotNull
@Override
public EditorColorsScheme[] getAllSchemes() {
  List<EditorColorsScheme> schemes = mySchemeManager.getAllSchemes();
  EditorColorsScheme[] result = schemes.toArray(new EditorColorsScheme[schemes.size()]);
  Arrays.sort(result, new Comparator<EditorColorsScheme>() {
    @Override
    public int compare(@NotNull EditorColorsScheme s1, @NotNull EditorColorsScheme s2) {
      if (isDefaultScheme(s1) && !isDefaultScheme(s2)) return -1;
      if (!isDefaultScheme(s1) && isDefaultScheme(s2)) return 1;
      if (s1.getName().equals(DEFAULT_NAME)) return -1;
      if (s2.getName().equals(DEFAULT_NAME)) return 1;
      return s1.getName().compareToIgnoreCase(s2.getName());
    }
  });
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:EditorColorsManagerImpl.java

示例12: buildExtensions

import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入依赖的package包/类
@NotNull
@Override
protected List<EditorHighlighterProvider> buildExtensions(@NotNull String stringKey, @NotNull final FileType key) {
  List<EditorHighlighterProvider> fromEP = super.buildExtensions(stringKey, key);
  if (fromEP.isEmpty()) {
    EditorHighlighterProvider defaultProvider = new EditorHighlighterProvider() {
      @Override
      public EditorHighlighter getEditorHighlighter(@Nullable Project project,
                                                    @NotNull FileType fileType,
                                                    @Nullable VirtualFile virtualFile,
                                                    @NotNull EditorColorsScheme colors) {
        return EditorHighlighterFactory.getInstance().createEditorHighlighter(
          SyntaxHighlighterFactory.getSyntaxHighlighter(fileType, project, virtualFile), colors);
      }
    };
    return Collections.singletonList(defaultProvider);
  }
  return fromEP;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:FileTypeEditorHighlighterProviders.java

示例13: createPanel

import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入依赖的package包/类
@Override
@NotNull
public NewColorAndFontPanel createPanel(@NotNull ColorAndFontOptions options) {
  FontEditorPreview previewPanel = new FontEditorPreview(options, false) {
    @Override
    protected EditorColorsScheme updateOptionsScheme(EditorColorsScheme selectedScheme) {
      return ConsoleViewUtil.updateConsoleColorScheme(selectedScheme);
    }
  };
  return new NewColorAndFontPanel(new SchemesPanel(options), new ConsoleFontOptions(options), previewPanel, "Font", null, null){
    @Override
    public boolean containsFontOptions() {
      return true;
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ColorAndFontOptions.java

示例14: testInfoTestAttributes

import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入依赖的package包/类
public void testInfoTestAttributes() throws Exception {
  LanguageExtensionPoint<Annotator> extension = new LanguageExtensionPoint<Annotator>();
  extension.language="TEXT";
  extension.implementationClass = TestAnnotator.class.getName();
  PlatformTestUtil.registerExtension(ExtensionPointName.create(LanguageAnnotators.EP_NAME), extension, getTestRootDisposable());
  myFixture.configureByText(PlainTextFileType.INSTANCE, "foo");
  EditorColorsScheme scheme = new EditorColorsSchemeImpl(new DefaultColorsScheme()){{initFonts();}};
  scheme.setAttributes(HighlighterColors.TEXT, new TextAttributes(Color.black, Color.white, null, null, Font.PLAIN));
  ((EditorEx)myFixture.getEditor()).setColorsScheme(scheme);
  myFixture.doHighlighting();
  MarkupModel model = DocumentMarkupModel.forDocument(myFixture.getEditor().getDocument(), getProject(), false);
  RangeHighlighter[] highlighters = model.getAllHighlighters();
  assertEquals(1, highlighters.length);
  TextAttributes attributes = highlighters[0].getTextAttributes();
  assertNotNull(attributes);
  assertNull(attributes.getBackgroundColor());
  assertNull(attributes.getForegroundColor());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:DocumentMarkupModelTest.java

示例15: createTaskTextPane

import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入依赖的package包/类
@NotNull
private static JTextPane createTaskTextPane() {
  final JTextPane taskTextPane = new JTextPane();
  taskTextPane.setContentType(new HTMLEditorKit().getContentType());
  final EditorColorsScheme editorColorsScheme = EditorColorsManager.getInstance().getGlobalScheme();
  int fontSize = editorColorsScheme.getEditorFontSize();
  final String fontName = editorColorsScheme.getEditorFontName();
  final Font font = new Font(fontName, Font.PLAIN, fontSize);
  String bodyRule = "body { font-family: " + font.getFamily() + "; " +
                    "font-size: " + font.getSize() + "pt; }";
  ((HTMLDocument)taskTextPane.getDocument()).getStyleSheet().addRule(bodyRule);
  taskTextPane.setEditable(false);
  if (!UIUtil.isUnderDarcula()) {
    taskTextPane.setBackground(EditorColorsManager.getInstance().getGlobalScheme().getDefaultBackground());
  }
  taskTextPane.setBorder(new EmptyBorder(15, 20, 0, 100));
  return taskTextPane;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:StudyToolWindow.java


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