public void testUpdateOnTodoChange() throws Exception { TodoPattern pattern = new TodoPattern("newtodo", TodoAttributes.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); } }
@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(); }
public void resetToDefaultTodoPatterns() { myTodoPatterns = new TodoPattern[]{ new TodoPattern("\\btodo\\b.*", TodoAttributes.createDefault(), false), new TodoPattern("\\bfixme\\b.*", TodoAttributes.createDefault(), false), }; myTodoFilters = new TodoFilter[]{}; buildIndexPatterns(); }
@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()); if (useCustomTodoColor()) { myColorAndFontDescriptionPanel.apply(myColorAndFontDescription, null); } super.doOKAction(); }
public PatternDialog(Component parent, TodoPattern pattern){ super(parent, true); final TodoAttributes attrs = pattern.getAttributes(); myPattern=pattern; myIconComboBox=new JComboBox( new Icon[]{AllIcons.General.TodoDefault, AllIcons.General.TodoQuestion, AllIcons.General.TodoImportant} ); myIconComboBox.setSelectedItem(attrs.getIcon()); myIconComboBox.setRenderer(new TodoTypeListCellRenderer()); myCaseSensitiveCheckBox=new JCheckBox(IdeBundle.message("checkbox.case.sensitive"),pattern.isCaseSensitive()); myPatternStringField=new JTextField(pattern.getPatternString()); // use default colors check box myUsedDefaultColorsCeckBox = new JCheckBox(IdeBundle.message("checkbox.todo.use.default.colors")); myUsedDefaultColorsCeckBox.setSelected(!attrs.shouldUseCustomTodoColor()); myColorAndFontDescriptionPanel = new ColorAndFontDescriptionPanel(); TextAttributes attributes = myPattern.getAttributes().getCustomizedTextAttributes(); myColorAndFontDescription = new TextAttributesDescription("null", null, attributes, null, EditorColorsManager.getInstance().getGlobalScheme(), null, null) { @Override public void apply(EditorColorsScheme scheme) { } @Override public boolean isErrorStripeEnabled() { return true; } }; myColorAndFontDescriptionPanel.reset(myColorAndFontDescription); updateCustomColorsPanel(); myUsedDefaultColorsCeckBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { updateCustomColorsPanel(); } }); init(); }
public PatternDialog(Component parent, TodoPattern pattern){ super(parent, true); final TodoAttributes attrs = pattern.getAttributes(); myPattern=pattern; myIconComboBox=new JComboBox( new Icon[]{AllIcons.General.TodoDefault, AllIcons.General.TodoQuestion, AllIcons.General.TodoImportant} ); myIconComboBox.setSelectedItem(attrs.getIcon()); myIconComboBox.setRenderer(new TodoTypeListCellRenderer()); myCaseSensitiveCheckBox=new JCheckBox(IdeBundle.message("checkbox.case.sensitive"),pattern.isCaseSensitive()); myPatternStringField=new JTextField(pattern.getPatternString()); // use default colors check box myUsedDefaultColorsCeckBox = new JCheckBox(IdeBundle.message("checkbox.todo.use.default.colors")); myUsedDefaultColorsCeckBox.setSelected(!attrs.shouldUseCustomTodoColor()); myColorAndFontDescriptionPanel = new ColorAndFontDescriptionPanel(); TextAttributes attributes = myPattern.getAttributes().getCustomizedTextAttributes(); myColorAndFontDescription = new TextAttributesDescription(null, null, attributes, null, EditorColorsManager.getInstance().getGlobalScheme(), null, null) { @Override public void apply(EditorColorsScheme scheme) { } @Override public boolean isErrorStripeEnabled() { return true; } }; myColorAndFontDescriptionPanel.reset(myColorAndFontDescription); updateCustomColorsPanel(); myUsedDefaultColorsCeckBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { updateCustomColorsPanel(); } }); init(); }