~ubuntu-branches/debian/sid/eclipse-cdt/sid

« back to all changes in this revision

Viewing changes to codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CodanRuntime.java

  • Committer: Package Import Robot
  • Author(s): Jakub Adam
  • Date: 2011-10-06 21:15:04 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20111006211504-8dutmljjih0zikfv
Tags: 8.0.1-1
* New upstream release.
* Split the JNI packages into a separate architecture dependent
  package and made eclipse-cdt architecture independent.
* Install JNI libraries into multiarch aware location
* Bumped Standards-Version to 3.9.2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
7
 *
 
8
 * Contributors:
 
9
 *    Alena Laskavaia  - initial API and implementation
 
10
 *******************************************************************************/
 
11
package org.eclipse.cdt.codan.core;
 
12
 
 
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;
 
21
 
 
22
/**
 
23
 * Runtime singleton class to get access to Codan framework parts
 
24
 * 
 
25
 * Clients may extend this class to override default framework parts.
 
26
 * 
 
27
 * <p>
 
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.
 
31
 * </p>
 
32
 */
 
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();
 
39
 
 
40
        /**
 
41
         * CodanRuntime - only can be called by subclasses to override default
 
42
         * constructor
 
43
         */
 
44
        protected CodanRuntime() {
 
45
                // nothing here
 
46
        }
 
47
 
 
48
        /**
 
49
         * Get runtime problem reporter. Default reported generated problem markers.
 
50
         * 
 
51
         * @return
 
52
         */
 
53
        public IProblemReporter getProblemReporter() {
 
54
                return problemReporter;
 
55
        }
 
56
 
 
57
        /**
 
58
         * Set different problem reporter.
 
59
         * 
 
60
         * @param reporter
 
61
         */
 
62
        public void setProblemReporter(IProblemReporter reporter) {
 
63
                problemReporter = reporter;
 
64
        }
 
65
 
 
66
        /**
 
67
         * Get instance of of Codan Runtime
 
68
         * 
 
69
         * @return
 
70
         */
 
71
        public static CodanRuntime getInstance() {
 
72
                return instance;
 
73
        }
 
74
 
 
75
        /**
 
76
         * Get builder. Builder can used to run code analysis on given resource
 
77
         * using API.
 
78
         * 
 
79
         * @return
 
80
         */
 
81
        public ICodanBuilder getBuilder() {
 
82
                return builder;
 
83
        }
 
84
 
 
85
        /**
 
86
         * Get checkers registry.
 
87
         * 
 
88
         * @return
 
89
         * @since 2.0
 
90
         */
 
91
        public ICheckersRegistry getCheckersRegistry() {
 
92
                return checkers;
 
93
        }
 
94
 
 
95
        /**
 
96
         * Get problem location factory.
 
97
         * 
 
98
         * @return
 
99
         */
 
100
        public IProblemLocationFactory getProblemLocationFactory() {
 
101
                return locFactory;
 
102
        }
 
103
 
 
104
        /**
 
105
         * Set another problem location factory - only need if default is not
 
106
         * sufficient, i.e IProblemLocation is implemented differently
 
107
         * 
 
108
         * @param factory
 
109
         */
 
110
        public void setProblemLocationFactory(IProblemLocationFactory factory) {
 
111
                locFactory = factory;
 
112
        }
 
113
}