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