Java 类com.intellij.psi.search.TodoAttributesUtil 实例源码

项目:intellij-ce-playground    文件:IdCacheTest.java   
public void testUpdateOnTodoChange() throws Exception {
  TodoPattern pattern = new TodoPattern("newtodo", TodoAttributesUtil.createDefault(), true);
  TodoPattern[] oldPatterns = TodoConfiguration.getInstance().getTodoPatterns();
  TodoConfiguration.getInstance().setTodoPatterns(new TodoPattern[]{pattern});

  try{
    final TodoCacheManager todocache = TodoCacheManager.SERVICE.getInstance(myProject);
    checkResult(new String[]{"2.java"}, convert(todocache.getFilesWithTodoItems()));
    assertEquals(0, todocache.getTodoCount(myRootDir.findChild("1.java"), TodoIndexPatternProvider.getInstance()));
    assertEquals(1, todocache.getTodoCount(myRootDir.findChild("2.java"), TodoIndexPatternProvider.getInstance()));
    assertEquals(0, todocache.getTodoCount(myRootDir.findChild("3.java"), TodoIndexPatternProvider.getInstance()));
  }
  finally{
    TodoConfiguration.getInstance().setTodoPatterns(oldPatterns);
  }
}
项目:consulo-java    文件:IdCacheTest.java   
public void testUpdateOnTodoChange() throws Exception {
  TodoPattern pattern = new TodoPattern("newtodo", TodoAttributesUtil.createDefault(), true);
  TodoPattern[] oldPatterns = TodoConfiguration.getInstance().getTodoPatterns();
  TodoConfiguration.getInstance().setTodoPatterns(new TodoPattern[]{pattern});

  try{
    final TodoCacheManager todocache = TodoCacheManager.getInstance(myProject);
    checkResult(new String[]{"2.java"}, convert(todocache.getFilesWithTodoItems()));
    assertEquals(0, todocache.getTodoCount(myRootDir.findChild("1.java"), TodoIndexPatternProvider.getInstance()));
    assertEquals(1, todocache.getTodoCount(myRootDir.findChild("2.java"), TodoIndexPatternProvider.getInstance()));
    assertEquals(0, todocache.getTodoCount(myRootDir.findChild("3.java"), TodoIndexPatternProvider.getInstance()));
  }
  finally{
    TodoConfiguration.getInstance().setTodoPatterns(oldPatterns);
  }
}
项目:intellij-ce-playground    文件:PatternDialog.java   
@Override
protected void doOKAction(){
  myPattern.setPatternString(myPatternStringField.getText().trim());
  myPattern.setCaseSensitive(myCaseSensitiveCheckBox.isSelected());

  final TodoAttributes attrs = myPattern.getAttributes();
  attrs.setIcon((Icon)myIconComboBox.getSelectedItem());
  attrs.setUseCustomTodoColor(useCustomTodoColor(), TodoAttributesUtil.getDefaultColorSchemeTextAttributes());

  if (useCustomTodoColor()) {
    myColorAndFontDescriptionPanel.apply(myColorAndFontDescription, null);
  }
  super.doOKAction();
}
项目:consulo    文件:PatternDialog.java   
@Override
protected void doOKAction(){
  myPattern.setPatternString(myPatternStringField.getText().trim());
  myPattern.setCaseSensitive(myCaseSensitiveCheckBox.isSelected());

  final TodoAttributes attrs = myPattern.getAttributes();
  attrs.setIcon((Icon)myIconComboBox.getSelectedItem());
  attrs.setUseCustomTodoColor(useCustomTodoColor(), TodoAttributesUtil.getDefaultColorSchemeTextAttributes());

  if (useCustomTodoColor()) {
    myColorAndFontDescriptionPanel.apply(myColorAndFontDescription, null);
  }
  super.doOKAction();
}