summaryrefslogtreecommitdiffstats
path: root/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ICheckersRegistry.java
blob: 04189aed4be7abe65a2cb8673ed3cee9181ab865 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/*******************************************************************************
 * Copyright (c) 2009, 2010 Alena Laskavaia 
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Alena Laskavaia  - initial API and implementation
 *******************************************************************************/
package org.eclipse.cdt.codan.core.model;

import java.util.Collection;
import java.util.Iterator;

import org.eclipse.core.resources.IResource;

/**
 * This interface an API to add/remove checker and problems programmatically,
 * get problem profiles and change problem default settings
 * 
 * @noextend This interface is not intended to be extended by clients.
 * @noimplement This interface is not intended to be implemented by clients.
 * 
 */
public interface ICheckersRegistry extends Iterable<IChecker> {
	/**
	 * Iterator for registered checkers
	 * 
	 * @return iterator for registered checkers
	 */
	public Iterator<IChecker> iterator();

	/**
	 * Add a checker
	 * 
	 * @param checker instance
	 */
	public void addChecker(IChecker checker);

	/**
	 * Add problem p into a category defined by a category id into default
	 * profile, category must exists in default profile
	 * 
	 * @param p
	 *        - problem
	 * @param categoryId
	 *        - category id
	 */
	public void addProblem(IProblem p, String categoryId);

	/**
	 * Add subcategory category into parent category with the id of
	 * parentCategoryId, if parent does not exist in the default profile or it
	 * is a null - it will be added to the root
	 * 
	 * @param category
	 *        - new category
	 * @param parentCategoryId
	 *        - parent category id
	 */
	public abstract void addCategory(IProblemCategory category,
			String parentCategoryId);

	/**
	 * Add problem reference to a checker, i.e. claim that checker can produce
	 * this problem. If checker does not claim any problems it cannot be
	 * enabled.
	 * 
	 * @param c
	 *        - checker
	 * @param p
	 *        - problem
	 */
	public void addRefProblem(IChecker c, IProblem p);

	/**
	 * Return collection of problem that this checker can produce
	 * 
	 * @param checker
	 * @return collection of problems
	 */
	public Collection<IProblem> getRefProblems(IChecker checker);

	/**
	 * Default profile is kind of "Installation Default".
	 * Always the same, comes from defaults in checker extensions or APIs added
	 * 
	 * @return default profile
	 */
	public IProblemProfile getDefaultProfile();

	/**
	 * Get workspace profile. User can change setting for workspace profile.
	 * 
	 * @return workspace profile
	 */
	public IProblemProfile getWorkspaceProfile();

	/**
	 * Get resource profile. For example given project can have different
	 * profile than a workspace.
	 * 
	 * @param element
	 *        - resource
	 * @return resource profile
	 */
	public IProblemProfile getResourceProfile(IResource element);

	/**
	 * Returns profile working copy for given resource element. (If profile is
	 * not specified for given element it will search for parent resource and so
	 * on). If you planning on editing it this method should be used instead of
	 * getResourceProfile. You have to save your changes after updating a
	 * working copy, using {@link #updateProfile(IResource, IProblemProfile)}
	 * method.
	 * 
	 * @noreference This method is not intended to be referenced by clients.
	 * @param element
	 * @return resource profile
	 */
	public IProblemProfile getResourceProfileWorkingCopy(IResource element);

	/**
	 * Set profile for resource.
	 * 
	 * @noreference This method is not intended to be referenced by clients.
	 * @param resource
	 *        - resource
	 * @param profile
	 *        - problems profile
	 */
	public void updateProfile(IResource resource, IProblemProfile profile);
}