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


Java EditorColorsManager.addColorsScheme方法代码示例

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


在下文中一共展示了EditorColorsManager.addColorsScheme方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testScopeBased

import com.intellij.openapi.editor.colors.EditorColorsManager; //导入方法依赖的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

示例2: testSharedScopeBased

import com.intellij.openapi.editor.colors.EditorColorsManager; //导入方法依赖的package包/类
public void testSharedScopeBased() throws Exception {
  NamedScope xScope = new NamedScope("xxx", new PatternPackageSet("x..*", PatternPackageSet.SCOPE_ANY, null));
  NamedScope utilScope = new NamedScope("util", new PatternPackageSet("java.util.*", PatternPackageSet.SCOPE_LIBRARY, null));
  NamedScopesHolder scopeManager = DependencyValidationManager.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, null, 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);

  NamedScope projectScope = PackagesScopesProvider.getInstance(myProject).getProjectProductionScope();
  TextAttributesKey projectKey = ScopeAttributesUtil.getScopeTextAttributeKey(projectScope.getName());
  TextAttributes projectAttributes = new TextAttributes(null, null, Color.blue, EffectType.BOXED, Font.ITALIC);
  scheme.setAttributes(projectKey, projectAttributes);

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

示例3: testYieldInNestedFunction

import com.intellij.openapi.editor.colors.EditorColorsManager; //导入方法依赖的package包/类
public void testYieldInNestedFunction() {
  // highlight func declaration first, lest we get an "Extra fragment highlighted" error.
  EditorColorsManager manager = EditorColorsManager.getInstance();
  EditorColorsScheme scheme = (EditorColorsScheme)manager.getGlobalScheme().clone();
  manager.addColorsScheme(scheme);
  EditorColorsManager.getInstance().setGlobalScheme(scheme);

  TextAttributesKey xKey = TextAttributesKey.find("PY.FUNC_DEFINITION");
  TextAttributes xAttributes = new TextAttributes(Color.red, Color.black, Color.white, EffectType.BOXED, Font.BOLD);
  scheme.setAttributes(xKey, xAttributes);

  doTest();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:PythonHighlightingTest.java


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