mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-05 00:36:16 +02:00
added on deman launch profile instead of on inc build
This commit is contained in:
parent
f3bb6aa2dd
commit
e01c3cc7c3
5 changed files with 41 additions and 13 deletions
|
@ -7,7 +7,7 @@ package org.eclipse.cdt.codan.core.model;
|
||||||
* part of a work in progress. There is no guarantee that this API will
|
* part of a work in progress. There is no guarantee that this API will
|
||||||
* work or that it will remain the same.
|
* work or that it will remain the same.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
public enum CheckerLaunchMode {
|
public enum CheckerLaunchMode {
|
||||||
|
@ -27,4 +27,8 @@ public enum CheckerLaunchMode {
|
||||||
* checker run in editor as you type
|
* checker run in editor as you type
|
||||||
*/
|
*/
|
||||||
RUN_AS_YOU_TYPE,
|
RUN_AS_YOU_TYPE,
|
||||||
|
/**
|
||||||
|
* checker run when explicit command is given
|
||||||
|
*/
|
||||||
|
RUN_ON_DEMAND,
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2009, 2010 Alena Laskavaia
|
* Copyright (c) 2009, 2010 Alena Laskavaia
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -18,16 +18,26 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
* traverse the resource tree. It will be calling all the checkers (this
|
* traverse the resource tree. It will be calling all the checkers (this
|
||||||
* interface allows to call framework without using UI). You can obtain instance
|
* interface allows to call framework without using UI). You can obtain instance
|
||||||
* of this class as CodanRuntime.getInstance().getBuilder()
|
* of this class as CodanRuntime.getInstance().getBuilder()
|
||||||
*
|
*
|
||||||
* @noextend This interface is not intended to be extended by clients.
|
* @noextend This interface is not intended to be extended by clients.
|
||||||
* @noimplement This interface is not intended to be implemented by clients.
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
*/
|
*/
|
||||||
public interface ICodanBuilder {
|
public interface ICodanBuilder {
|
||||||
/**
|
/**
|
||||||
* Run code analysis on given resource
|
* Run code analysis on given resource in {@link CheckerLaunchMode#RUN_ON_FULL_BUILD} mode
|
||||||
*
|
*
|
||||||
* @param resource - resource to process
|
* @param resource - resource to process
|
||||||
* @param monitor - progress monitor
|
* @param monitor - progress monitor
|
||||||
*/
|
*/
|
||||||
public void processResource(IResource resource, IProgressMonitor monitor);
|
public void processResource(IResource resource, IProgressMonitor monitor);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run code analysis on given resource in a given mode
|
||||||
|
*
|
||||||
|
* @param resource - resource to process
|
||||||
|
* @param monitor - progress monitor
|
||||||
|
* @param mode - launch mode, @see {@link CheckerLaunchMode}
|
||||||
|
* @since 2.0
|
||||||
|
*/
|
||||||
|
public void processResource(IResource resource, IProgressMonitor monitor, CheckerLaunchMode mode);
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2009, 2010 Alena Laskavaia
|
* Copyright (c) 2009, 2010 Alena Laskavaia
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -69,7 +69,7 @@ public class CodanBuilder extends IncrementalProjectBuilder implements ICodanBui
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
* @see org.eclipse.core.internal.events.InternalBuilder#build(int,
|
* @see org.eclipse.core.internal.events.InternalBuilder#build(int,
|
||||||
* java.util.Map, org.eclipse.core.runtime.IProgressMonitor)
|
* java.util.Map, org.eclipse.core.runtime.IProgressMonitor)
|
||||||
*/
|
*/
|
||||||
|
@ -93,8 +93,20 @@ public class CodanBuilder extends IncrementalProjectBuilder implements ICodanBui
|
||||||
processResource(resource, monitor, null, CheckerLaunchMode.RUN_ON_FULL_BUILD);
|
processResource(resource, monitor, null, CheckerLaunchMode.RUN_ON_FULL_BUILD);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void processResourceDelta(IResource resource, IProgressMonitor monitor) {
|
/**
|
||||||
processResource(resource, monitor, null, CheckerLaunchMode.RUN_ON_INC_BUILD);
|
* Run code analysis on given resource in a given mode
|
||||||
|
*
|
||||||
|
* @param resource - resource to process
|
||||||
|
* @param monitor - progress monitor
|
||||||
|
* @param mode - launch mode, @see {@link CheckerLaunchMode}
|
||||||
|
* @since 2.0
|
||||||
|
*/
|
||||||
|
public void processResource(IResource resource, IProgressMonitor monitor, CheckerLaunchMode mode) {
|
||||||
|
processResource(resource, monitor, null, mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void processResourceDelta(IResource resource, IProgressMonitor monitor) {
|
||||||
|
processResource(resource, monitor, CheckerLaunchMode.RUN_ON_INC_BUILD);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void processResource(IResource resource, IProgressMonitor monitor, Object model, CheckerLaunchMode checkerLaunchMode) {
|
protected void processResource(IResource resource, IProgressMonitor monitor, Object model, CheckerLaunchMode checkerLaunchMode) {
|
||||||
|
@ -147,7 +159,8 @@ public class CodanBuilder extends IncrementalProjectBuilder implements ICodanBui
|
||||||
CodanCorePlugin.log(e);
|
CodanCorePlugin.log(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (resource instanceof IContainer && (checkerLaunchMode == CheckerLaunchMode.RUN_ON_FULL_BUILD)) {
|
if (resource instanceof IContainer
|
||||||
|
&& (checkerLaunchMode == CheckerLaunchMode.RUN_ON_FULL_BUILD || checkerLaunchMode == CheckerLaunchMode.RUN_ON_DEMAND)) {
|
||||||
try {
|
try {
|
||||||
IResource[] members = ((IContainer) resource).members();
|
IResource[] members = ((IContainer) resource).members();
|
||||||
for (int i = 0; i < members.length; i++) {
|
for (int i = 0; i < members.length; i++) {
|
||||||
|
@ -185,7 +198,7 @@ public class CodanBuilder extends IncrementalProjectBuilder implements ICodanBui
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run all checkers that support "check as you type" mode
|
* Run all checkers that support "check as you type" mode
|
||||||
*
|
*
|
||||||
* @param model - model of given resource such as ast
|
* @param model - model of given resource such as ast
|
||||||
* @param resource - resource to process
|
* @param resource - resource to process
|
||||||
* @param monitor - progress monitor
|
* @param monitor - progress monitor
|
||||||
|
|
|
@ -13,6 +13,7 @@ package org.eclipse.cdt.codan.internal.ui.actions;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
import org.eclipse.cdt.codan.core.CodanRuntime;
|
import org.eclipse.cdt.codan.core.CodanRuntime;
|
||||||
|
import org.eclipse.cdt.codan.core.model.CheckerLaunchMode;
|
||||||
import org.eclipse.cdt.codan.internal.ui.CodanUIMessages;
|
import org.eclipse.cdt.codan.internal.ui.CodanUIMessages;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.IAdaptable;
|
import org.eclipse.core.runtime.IAdaptable;
|
||||||
|
@ -52,7 +53,7 @@ public class RunCodeAnalysis implements IObjectActionDelegate {
|
||||||
if (o instanceof IResource) {
|
if (o instanceof IResource) {
|
||||||
IResource res = (IResource) o;
|
IResource res = (IResource) o;
|
||||||
SubProgressMonitor subMon = new SubProgressMonitor(monitor, 100);
|
SubProgressMonitor subMon = new SubProgressMonitor(monitor, 100);
|
||||||
CodanRuntime.getInstance().getBuilder().processResource(res, subMon);
|
CodanRuntime.getInstance().getBuilder().processResource(res, subMon, CheckerLaunchMode.RUN_ON_DEMAND);
|
||||||
if (subMon.isCanceled())
|
if (subMon.isCanceled())
|
||||||
return Status.CANCEL_STATUS;
|
return Status.CANCEL_STATUS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class LaunchModesPropertyPage extends FieldEditorPreferencePage {
|
||||||
protected void createFieldEditors() {
|
protected void createFieldEditors() {
|
||||||
createSelectionGroup(getFieldEditorParent());
|
createSelectionGroup(getFieldEditorParent());
|
||||||
addField(new BooleanFieldEditor(CheckerLaunchMode.RUN_ON_FULL_BUILD.name(), "Run on full build", useLocalGroup));
|
addField(new BooleanFieldEditor(CheckerLaunchMode.RUN_ON_FULL_BUILD.name(), "Run on full build", useLocalGroup));
|
||||||
addField(new BooleanFieldEditor(CheckerLaunchMode.RUN_ON_INC_BUILD.name(), "Run on incremental build", useLocalGroup));
|
addField(new BooleanFieldEditor(CheckerLaunchMode.RUN_ON_DEMAND.name(), "Run on demand", useLocalGroup));
|
||||||
addField(new BooleanFieldEditor(CheckerLaunchMode.RUN_AS_YOU_TYPE.name(), "Run as you type", useLocalGroup));
|
addField(new BooleanFieldEditor(CheckerLaunchMode.RUN_AS_YOU_TYPE.name(), "Run as you type", useLocalGroup));
|
||||||
updateFieldEditors();
|
updateFieldEditors();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue