1
/*******************************************************************************
2
* Copyright (c) 2009, 2010 Alena Laskavaia
3
* All rights reserved. This program and the accompanying materials
4
* are made available under the terms of the Eclipse Public License v1.0
5
* which accompanies this distribution, and is available at
6
* http://www.eclipse.org/legal/epl-v10.html
9
* Alena Laskavaia - initial API and implementation
10
*******************************************************************************/
11
package org.eclipse.cdt.codan.core;
13
import org.eclipse.cdt.codan.core.model.ICheckersRegistry;
14
import org.eclipse.cdt.codan.core.model.ICodanBuilder;
15
import org.eclipse.cdt.codan.core.model.IProblemLocationFactory;
16
import org.eclipse.cdt.codan.core.model.IProblemReporter;
17
import org.eclipse.cdt.codan.internal.core.CheckersRegistry;
18
import org.eclipse.cdt.codan.internal.core.CodanBuilder;
19
import org.eclipse.cdt.codan.internal.core.model.CodanMarkerProblemReporter;
20
import org.eclipse.cdt.codan.internal.core.model.ProblemLocationFactory;
23
* Runtime singleton class to get access to Codan framework parts
25
* Clients may extend this class to override default framework parts.
28
* <strong>EXPERIMENTAL</strong>. This class or interface has been added as part
29
* of a work in progress. There is no guarantee that this API will work or that
30
* it will remain the same.
33
public class CodanRuntime {
34
private static CodanRuntime instance = new CodanRuntime();
35
private IProblemReporter problemReporter = new CodanMarkerProblemReporter();
36
private ICodanBuilder builder = new CodanBuilder();
37
private CheckersRegistry checkers = CheckersRegistry.getInstance();
38
private IProblemLocationFactory locFactory = new ProblemLocationFactory();
41
* CodanRuntime - only can be called by subclasses to override default
44
protected CodanRuntime() {
49
* Get runtime problem reporter. Default reported generated problem markers.
53
public IProblemReporter getProblemReporter() {
54
return problemReporter;
58
* Set different problem reporter.
62
public void setProblemReporter(IProblemReporter reporter) {
63
problemReporter = reporter;
67
* Get instance of of Codan Runtime
71
public static CodanRuntime getInstance() {
76
* Get builder. Builder can used to run code analysis on given resource
81
public ICodanBuilder getBuilder() {
86
* Get checkers registry.
91
public ICheckersRegistry getCheckersRegistry() {
96
* Get problem location factory.
100
public IProblemLocationFactory getProblemLocationFactory() {
105
* Set another problem location factory - only need if default is not
106
* sufficient, i.e IProblemLocation is implemented differently
110
public void setProblemLocationFactory(IProblemLocationFactory factory) {
111
locFactory = factory;