Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public interface IPreferenceConstants {
public static final String P_FOLLOW_SYSTEM_INCLUDES = "followSystemIncludes";
public static final String P_FOLLOW_USER_INCLUDES = "followUserIncludes";
public static final String P_NUMBER_OF_THREADS = "numberOfThreads";
public static final String P_PROJECT_FILE = "projectFile";
public static final String P_AUTOMATIC_UPDATE_CHECK_INTERVAL = "automaticUpdateCheckInterval";
public static final String P_USE_AUTOMATIC_UPDATE_CHECK = "automaticUpdateCheck";
public static final String P_LAST_UPDATE_CHECK = "lastUpdateCheck";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ private static void initializeSettingsDefault(IPreferenceStore store) {
store.setDefault(IPreferenceConstants.P_FOLLOW_SYSTEM_INCLUDES, false);
store.setDefault(IPreferenceConstants.P_FOLLOW_USER_INCLUDES, false);
store.setDefault(IPreferenceConstants.P_NUMBER_OF_THREADS, 1);
store.setDefault(IPreferenceConstants.P_PROJECT_FILE, "");
}

private static void initializeProblemsDefault(IPreferenceStore store) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,14 @@ public CppcheckCommand(IConsole console, String binaryPath,
}
}

String projectFile = settingsStore.getString(IPreferenceConstants.P_PROJECT_FILE);
if (!projectFile.isEmpty()) {
arguments.add("--project=" + projectFile);
arguments.add("--file-filter=-");
} else {
arguments.add("--file-list=-");
}

if (settingsStore.getBoolean(IPreferenceConstants.P_CHECK_VERBOSE)) {
arguments.add("--verbose");
}
Expand Down Expand Up @@ -227,10 +235,9 @@ public void run(Checker checker, IProgressReporter progressReporter,
console.println("=== Input stream for following process ===");
console.println(input);
console.println("=== End of input stream for process ==");

setProcessInputStream(new ByteArrayInputStream(input.getBytes(DEFAULT_CHARSET)));
arguments.add("--file-list=-");


setWorkingDirectory(projectFolder);
CppcheckProcessResultHandler resultHandler = runInternal(
arguments.toArray(new String[0]), advancedArguments,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ public class Messages extends NLS {
public static String SettingsPreferencePage_FollowSystemIncludes;
public static String SettingsPreferencePage_Force;
public static String SettingsPreferencePage_NumberOfThreads;
public static String SettingsPreferencePage_ProjectFile;
public static String SettingsPreferencePage_ProjectFileDialogButton;
public static String SettingsPreferencePage_UnusedFunctions;
public static String SettingsPreferencePage_Verbose;
public static String SuppressFileResolution_Label;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ SettingsPreferencePage_FollowUserIncludes=Follow user-defined includes (taken fr
SettingsPreferencePage_FollowSystemIncludes=Follow system-defined includes (taken from CDT settings)
SettingsPreferencePage_Force=Force all configurations (--force)
SettingsPreferencePage_NumberOfThreads=Number of threads to use
SettingsPreferencePage_ProjectFile=Project file
SettingsPreferencePage_ProjectFileDialogButton=Browse
SettingsPreferencePage_UnusedFunctions=Check unused functions (disables multiple thread processing)
SettingsPreferencePage_Verbose=Verbose (--verbose)
SettingsPreferencePage_Inconclusive=Enable inconclusive checks. Might lead to false positives (--inconclusive)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,18 @@
import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.ComboFieldEditor;
import org.eclipse.jface.preference.IntegerFieldEditor;
import org.eclipse.jface.preference.StringButtonFieldEditor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;

import com.googlecode.cppcheclipse.core.CppcheclipsePlugin;
import com.googlecode.cppcheclipse.core.IPreferenceConstants;
import com.googlecode.cppcheclipse.ui.Console;
import com.googlecode.cppcheclipse.ui.Messages;

public class SettingsPreferencePage extends FieldEditorOverlayPage implements
Expand All @@ -23,6 +26,7 @@ public class SettingsPreferencePage extends FieldEditorOverlayPage implements
private BooleanFieldEditor allCheck;
private BooleanFieldEditor unusedFunctionsCheck;
private IntegerFieldEditor numberOfThreads;
private StringButtonFieldEditor projectFile;
private List<BooleanFieldEditor> checkEditors;
private Group checkGroup;

Expand Down Expand Up @@ -120,6 +124,21 @@ protected void valueChanged(boolean oldValue, boolean newValue) {

@Override
protected void createFieldEditors() {

final FileDialog projectFileDialog = new FileDialog(getShell(), SWT.OPEN);
projectFile = new StringButtonFieldEditor(IPreferenceConstants.P_PROJECT_FILE,
Messages.SettingsPreferencePage_ProjectFile, getFieldEditorParent()) {

@Override
protected String changePressed() {
return projectFileDialog.open();
}

};
projectFile.setChangeButtonText(Messages.SettingsPreferencePage_ProjectFileDialogButton);
projectFile.setEmptyStringAllowed(true);
addField(projectFile);

numberOfThreads = new IntegerFieldEditor(
IPreferenceConstants.P_NUMBER_OF_THREADS,
Messages.SettingsPreferencePage_NumberOfThreads,
Expand Down