1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00
This commit is contained in:
Alena Laskavaia 2010-06-02 01:08:25 +00:00
parent fb8475e290
commit b16ac6b603
4 changed files with 38 additions and 39 deletions

View file

@ -37,6 +37,9 @@ import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.Platform;
import org.osgi.service.prefs.Preferences;
/**
* Implementation of checker registry interface
*/
public class CheckersRegistry implements Iterable<IChecker>, ICheckersRegistry {
private static final String NAME_ATTR = "name"; //$NON-NLS-1$
private static final String ID_ATTR = "id"; //$NON-NLS-1$

View file

@ -16,7 +16,6 @@ import org.eclipse.equinox.app.IApplicationContext;
import org.eclipse.osgi.util.NLS;
/**
*
* Application to support headless build
*
* @noextend This class is not intended to be extended by clients.

View file

@ -30,11 +30,17 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.SubProgressMonitor;
/**
* Implementation of {@link ICodanBuilder}
*/
public class CodanBuilder extends IncrementalProjectBuilder implements
ICodanBuilder {
/**
* codan builder id
*/
public static final String BUILDER_ID = "org.eclipse.cdt.codan.core.codanBuilder"; //$NON-NLS-1$
public class CodanDeltaVisitor implements IResourceDeltaVisitor {
private class CodanDeltaVisitor implements IResourceDeltaVisitor {
private IProgressMonitor monitor;
/**
@ -106,8 +112,8 @@ public class CodanBuilder extends IncrementalProjectBuilder implements
}
int tick = 1000;
// System.err.println("processing " + resource);
monitor.beginTask(Messages.CodanBuilder_Code_Analysis_On + resource, checkers + memsize
* tick);
monitor.beginTask(Messages.CodanBuilder_Code_Analysis_On + resource,
checkers + memsize * tick);
try {
IProblemReporter problemReporter = CodanRuntime.getInstance()
.getProblemReporter();
@ -172,6 +178,13 @@ public class CodanBuilder extends IncrementalProjectBuilder implements
delta.accept(new CodanDeltaVisitor(monitor));
}
/**
* Run all checkers that support "check as you type" mode
*
* @param model - model of given resource such as ast
* @param resource - resource to process
* @param monitor - progress monitor
*/
public void runInEditor(Object model, IResource resource,
IProgressMonitor monitor) {
if (model == null)

View file

@ -16,6 +16,9 @@ import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IProjectNature;
import org.eclipse.core.runtime.CoreException;
/**
* Code Analysis Nature for builder
*/
public class CodeAnlysisNature implements IProjectNature {
/**
* ID of this project nature
@ -23,16 +26,13 @@ public class CodeAnlysisNature implements IProjectNature {
public static final String NATURE_ID = "org.eclipse.cdt.codan.core.codanNature"; //$NON-NLS-1$
private IProject project;
/*
* (non-Javadoc)
*
* @see org.eclipse.core.resources.IProjectNature#configure()
*/
public void configure() throws CoreException {
IProjectDescription desc = project.getDescription();
ICommand[] commands = desc.getBuildSpec();
for (int i = 0; i < commands.length; ++i) {
if (commands[i].getBuilderName().equals(CodanBuilder.BUILDER_ID)) { return; }
if (commands[i].getBuilderName().equals(CodanBuilder.BUILDER_ID)) {
return;
}
}
ICommand[] newCommands = new ICommand[commands.length + 1];
System.arraycopy(commands, 0, newCommands, 0, commands.length);
@ -43,11 +43,6 @@ public class CodeAnlysisNature implements IProjectNature {
project.setDescription(desc, null);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.core.resources.IProjectNature#deconfigure()
*/
public void deconfigure() throws CoreException {
IProjectDescription description = getProject().getDescription();
ICommand[] commands = description.getBuildSpec();
@ -55,7 +50,8 @@ public class CodeAnlysisNature implements IProjectNature {
if (commands[i].getBuilderName().equals(CodanBuilder.BUILDER_ID)) {
ICommand[] newCommands = new ICommand[commands.length - 1];
System.arraycopy(commands, 0, newCommands, 0, i);
System.arraycopy(commands, i + 1, newCommands, i, commands.length - i - 1);
System.arraycopy(commands, i + 1, newCommands, i,
commands.length - i - 1);
description.setBuildSpec(newCommands);
project.setDescription(description, null);
return;
@ -63,22 +59,10 @@ public class CodeAnlysisNature implements IProjectNature {
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.core.resources.IProjectNature#getProject()
*/
public IProject getProject() {
return project;
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.core.resources.IProjectNature#setProject(org.eclipse.core
* .resources.IProject)
*/
public void setProject(IProject project) {
this.project = project;
}