mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-09 01:05:38 +02:00
Further SCD profile work.
Definition of 'per file' profile and profile options page and initial implementation.
This commit is contained in:
parent
f33bcba3fa
commit
1ba71c339b
18 changed files with 961 additions and 422 deletions
|
@ -63,14 +63,8 @@ public interface IScannerConfigBuilderInfo2 {
|
||||||
String getProviderOpenFilePath(String providerId);
|
String getProviderOpenFilePath(String providerId);
|
||||||
void setProviderOpenFilePath(String providerId, String filePath);
|
void setProviderOpenFilePath(String providerId, String filePath);
|
||||||
|
|
||||||
/**
|
|
||||||
* Store the buildInfo.
|
|
||||||
* @throws CoreException
|
|
||||||
*/
|
|
||||||
void store() throws CoreException;
|
|
||||||
/**
|
/**
|
||||||
* Persist the buildInfo.
|
* Persist the buildInfo.
|
||||||
* It is expected that buildInfo was previously stored.
|
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
void save() throws CoreException;
|
void save() throws CoreException;
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
/***********************************************************************
|
||||||
|
* Copyright (c) 2004 IBM Corporation and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* IBM - Initial API and implementation
|
||||||
|
***********************************************************************/
|
||||||
|
package org.eclipse.cdt.make.core.scannerconfig;
|
||||||
|
|
||||||
|
import org.eclipse.core.resources.IResource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO Provide description
|
||||||
|
*
|
||||||
|
* @author vhirsl
|
||||||
|
*/
|
||||||
|
public interface IScannerInfoCollectorUtil {
|
||||||
|
/**
|
||||||
|
* Delete all discovered paths for a resource
|
||||||
|
*
|
||||||
|
* @param project
|
||||||
|
*/
|
||||||
|
public void deleteAllPaths(IResource resource);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete all discovered symbols for a resource
|
||||||
|
*
|
||||||
|
* @param project
|
||||||
|
*/
|
||||||
|
public void deleteAllSymbols(IResource resource);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete a specific include path
|
||||||
|
*
|
||||||
|
* @param resource
|
||||||
|
* @param path
|
||||||
|
*/
|
||||||
|
public void deletePath(IResource resource, String path);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete a specific symbol definition
|
||||||
|
*
|
||||||
|
* @param resource
|
||||||
|
* @param path
|
||||||
|
*/
|
||||||
|
public void deleteSymbol(IResource resource, String symbol);
|
||||||
|
|
||||||
|
}
|
|
@ -78,7 +78,7 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer {
|
||||||
scInfo2.setProviderOutputParserEnabled(providerId, true);
|
scInfo2.setProviderOutputParserEnabled(providerId, true);
|
||||||
scInfo2.setProblemReportingEnabled(true);
|
scInfo2.setProblemReportingEnabled(true);
|
||||||
try {
|
try {
|
||||||
scInfo2.store();
|
scInfo2.save();
|
||||||
}
|
}
|
||||||
catch (CoreException e) {
|
catch (CoreException e) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,12 +10,18 @@
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
package org.eclipse.cdt.make.internal.core.scannerconfig.gnu;
|
package org.eclipse.cdt.make.internal.core.scannerconfig.gnu;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.IMarkerGenerator;
|
import org.eclipse.cdt.core.IMarkerGenerator;
|
||||||
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector;
|
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector;
|
||||||
|
import org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes;
|
||||||
|
import org.eclipse.cdt.make.internal.core.scannerconfig.util.CCommandDSC;
|
||||||
import org.eclipse.cdt.make.internal.core.scannerconfig.util.TraceUtil;
|
import org.eclipse.cdt.make.internal.core.scannerconfig.util.TraceUtil;
|
||||||
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
|
||||||
|
@ -115,15 +121,21 @@ public class GCCPerFileBOPConsoleParser extends AbstractGCCBOPConsoleParser {
|
||||||
TraceUtil.outputTrace("Error identifying file name :2", line, TraceUtil.EOL);
|
TraceUtil.outputTrace("Error identifying file name :2", line, TraceUtil.EOL);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
if (getUtility() != null) {
|
if (fUtil != null) {
|
||||||
IPath pFilePath = ((GCCPerFileBOPConsoleParserUtility) getUtility()).getAbsolutePath(filePath);
|
IPath pFilePath = fUtil.getAbsolutePath(filePath);
|
||||||
String longFileName = pFilePath.toString();
|
String longFileName = pFilePath.toString();
|
||||||
String shortFileName = pFilePath.removeFileExtension().lastSegment();
|
String shortFileName = pFilePath.removeFileExtension().lastSegment();
|
||||||
String genericLine = line.replaceAll(filePath, "LONG_NAME");
|
String genericLine = line.replaceAll(filePath, "LONG_NAME");
|
||||||
genericLine = genericLine.replaceAll(shortFileName+"\\.", "SHORT_NAME\\.");
|
genericLine = genericLine.replaceAll(shortFileName+"\\.", "SHORT_NAME\\.");
|
||||||
// getUtility().addGenericCommandForFile(longFileName, genericLine);
|
|
||||||
// alternative
|
CCommandDSC cmd = fUtil.getNewCCommandDSC(genericLine);
|
||||||
((GCCPerFileBOPConsoleParserUtility) getUtility()).addGenericCommandForFile2(longFileName, genericLine);
|
List cmdList = new ArrayList();
|
||||||
|
cmdList.add(cmd);
|
||||||
|
Map sc = new HashMap(1);
|
||||||
|
sc.put(ScannerInfoTypes.COMPILER_COMMAND, cmdList);
|
||||||
|
IFile file = getProject().getFile(pFilePath);
|
||||||
|
getCollector().contributeToScannerConfig(file, sc);
|
||||||
|
// fUtil.addGenericCommandForFile2(longFileName, genericLine);
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
package org.eclipse.cdt.make.internal.core.scannerconfig.gnu;
|
package org.eclipse.cdt.make.internal.core.scannerconfig.gnu;
|
||||||
|
|
||||||
import java.io.PrintWriter;
|
|
||||||
import java.io.StringWriter;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
@ -112,7 +110,7 @@ public class GCCPerFileBOPConsoleParserUtility extends AbstractGCCBOPConsolePars
|
||||||
return;
|
return;
|
||||||
compiledFileList.add(longFileName);
|
compiledFileList.add(longFileName);
|
||||||
|
|
||||||
CCommandDSC command = getDSCCommand(genericLine);
|
CCommandDSC command = getNewCCommandDSC(genericLine);
|
||||||
int index = commandsList2.indexOf(command);
|
int index = commandsList2.indexOf(command);
|
||||||
if (index == -1) {
|
if (index == -1) {
|
||||||
commandsList2.add(command);
|
commandsList2.add(command);
|
||||||
|
@ -121,15 +119,15 @@ public class GCCPerFileBOPConsoleParserUtility extends AbstractGCCBOPConsolePars
|
||||||
else {
|
else {
|
||||||
command = (CCommandDSC) commandsList2.get(index);
|
command = (CCommandDSC) commandsList2.get(index);
|
||||||
}
|
}
|
||||||
// add a file
|
// // add a file
|
||||||
command.addFile(longFileName);
|
// command.addFile(longFileName);
|
||||||
++filesN;
|
// ++filesN;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param genericLine
|
* @param genericLine
|
||||||
*/
|
*/
|
||||||
private CCommandDSC getDSCCommand(String genericLine) {
|
public CCommandDSC getNewCCommandDSC(String genericLine) {
|
||||||
CCommandDSC command = new CCommandDSC();
|
CCommandDSC command = new CCommandDSC();
|
||||||
String[] tokens = genericLine.split("\\s+");
|
String[] tokens = genericLine.split("\\s+");
|
||||||
command.addSCOption(new KVPair(SCDOptionsEnum.COMMAND, tokens[0]));
|
command.addSCOption(new KVPair(SCDOptionsEnum.COMMAND, tokens[0]));
|
||||||
|
@ -189,24 +187,32 @@ public class GCCPerFileBOPConsoleParserUtility extends AbstractGCCBOPConsolePars
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void generateReport2() {
|
// void generateReport2() {
|
||||||
StringWriter buffer = new StringWriter();
|
// StringWriter buffer = new StringWriter();
|
||||||
PrintWriter writer = new PrintWriter(buffer);
|
// PrintWriter writer = new PrintWriter(buffer);
|
||||||
for (Iterator i = commandsList2.iterator(); i.hasNext(); ) {
|
// for (Iterator i = commandsList2.iterator(); i.hasNext(); ) {
|
||||||
CCommandDSC cmd = (CCommandDSC)i.next();
|
// CCommandDSC cmd = (CCommandDSC)i.next();
|
||||||
writer.println("Stats for generic command: '" + cmd.getCommandAsString() + "' applicable for " +
|
// writer.println("Stats for generic command: '" + cmd.getCommandAsString() + "' applicable for " +
|
||||||
Integer.toString(cmd.getNumberOfFiles()) + " files: ");
|
// Integer.toString(cmd.getNumberOfFiles()) + " files: ");
|
||||||
List filesList = cmd.getFilesList();
|
// List filesList = cmd.getFilesList();
|
||||||
if (filesList != null) {
|
// if (filesList != null) {
|
||||||
for (Iterator j = filesList.iterator(); j.hasNext(); ) {
|
// for (Iterator j = filesList.iterator(); j.hasNext(); ) {
|
||||||
writer.println(" " + (String)j.next());
|
// writer.println(" " + (String)j.next());
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
writer.close();
|
// writer.close();
|
||||||
|
//
|
||||||
|
// TraceUtil.metricsTrace(buffer.toString());
|
||||||
|
// TraceUtil.summaryTrace("Discovery summary", workingDirsN, commandsN, filesN);
|
||||||
|
// }
|
||||||
|
|
||||||
TraceUtil.metricsTrace(buffer.toString());
|
/**
|
||||||
TraceUtil.summaryTrace("Discovery summary", workingDirsN, commandsN, filesN);
|
* Returns all CCommandDSC collected so far
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List getCCommandDSCList() {
|
||||||
|
return new ArrayList(commandsList2);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,12 +20,13 @@ import java.util.List;
|
||||||
* @author vhirsl
|
* @author vhirsl
|
||||||
*/
|
*/
|
||||||
public class CCommandDSC {
|
public class CCommandDSC {
|
||||||
|
private final static String SINGLE_SPACE = " "; //$NON-NLS-1$
|
||||||
|
|
||||||
private static int ids = 0;
|
private static int ids = 0;
|
||||||
private int commandId;
|
private int commandId;
|
||||||
private List compilerCommand; // members are KVPair objects
|
private List compilerCommand; // members are KVPair objects
|
||||||
private boolean discovered;
|
private boolean discovered;
|
||||||
private List files; // list of files this command applies to
|
// private List files; // list of files this command applies to
|
||||||
private boolean cppFileType; // C or C++ file type
|
private boolean cppFileType; // C or C++ file type
|
||||||
// TODO add discovered scanner config
|
// TODO add discovered scanner config
|
||||||
/**
|
/**
|
||||||
|
@ -34,7 +35,7 @@ public class CCommandDSC {
|
||||||
public CCommandDSC() {
|
public CCommandDSC() {
|
||||||
compilerCommand = new ArrayList();
|
compilerCommand = new ArrayList();
|
||||||
discovered = false;
|
discovered = false;
|
||||||
files = null;
|
// files = null;
|
||||||
cppFileType = false; // assume C file type
|
cppFileType = false; // assume C file type
|
||||||
commandId = ++ids;
|
commandId = ++ids;
|
||||||
}
|
}
|
||||||
|
@ -43,28 +44,48 @@ public class CCommandDSC {
|
||||||
compilerCommand.add(option);
|
compilerCommand.add(option);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addFile(String fileName) {
|
/**
|
||||||
if (files == null) {
|
* @return
|
||||||
files = new ArrayList();
|
*/
|
||||||
}
|
public Integer getCommandIdAsInteger() {
|
||||||
if (!files.contains(fileName)) {
|
return new Integer(getCommandId());
|
||||||
files.add(fileName);
|
}
|
||||||
if (!cppFileType && !fileName.endsWith(".c")) {
|
/**
|
||||||
cppFileType = true;
|
* @return Returns the commandId.
|
||||||
}
|
*/
|
||||||
}
|
public int getCommandId() {
|
||||||
}
|
return commandId;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param commandId The commandId to set.
|
||||||
|
*/
|
||||||
|
public void setCommandId(int commandId) {
|
||||||
|
this.commandId = commandId;
|
||||||
|
}
|
||||||
|
|
||||||
public int getNumberOfFiles() {
|
// public void addFile(String fileName) {
|
||||||
if (files == null) return 0;
|
// if (files == null) {
|
||||||
return files.size();
|
// files = new ArrayList();
|
||||||
}
|
// }
|
||||||
|
// if (!files.contains(fileName)) {
|
||||||
|
// files.add(fileName);
|
||||||
|
// if (!cppFileType && !fileName.endsWith(".c")) { //$NON-NLS-1$
|
||||||
|
// cppFileType = true;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
public String getCommandAsString() {
|
// public int getNumberOfFiles() {
|
||||||
|
// if (files == null) return 0;
|
||||||
|
// return files.size();
|
||||||
|
// }
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
String commandAsString = new String();
|
String commandAsString = new String();
|
||||||
for (Iterator i = compilerCommand.iterator(); i.hasNext(); ) {
|
for (Iterator i = compilerCommand.iterator(); i.hasNext(); ) {
|
||||||
KVPair optionPair = (KVPair)i.next();
|
KVPair optionPair = (KVPair)i.next();
|
||||||
commandAsString += optionPair.getKey().toString() + " " + optionPair.getValue() + " ";
|
commandAsString += optionPair.getKey().toString() + SINGLE_SPACE +
|
||||||
|
optionPair.getValue() + SINGLE_SPACE;
|
||||||
}
|
}
|
||||||
return commandAsString.trim();
|
return commandAsString.trim();
|
||||||
}
|
}
|
||||||
|
@ -84,7 +105,8 @@ public class CCommandDSC {
|
||||||
if (optionPair.getKey().equals(SCDOptionsEnum.IMACROS_FILE) ||
|
if (optionPair.getKey().equals(SCDOptionsEnum.IMACROS_FILE) ||
|
||||||
optionPair.getKey().equals(SCDOptionsEnum.INCLUDE_FILE))
|
optionPair.getKey().equals(SCDOptionsEnum.INCLUDE_FILE))
|
||||||
continue;
|
continue;
|
||||||
commandAsString += optionPair.getKey().toString() + " " + optionPair.getValue() + " ";
|
commandAsString += optionPair.getKey().toString() + SINGLE_SPACE +
|
||||||
|
optionPair.getValue() + SINGLE_SPACE;
|
||||||
}
|
}
|
||||||
return commandAsString.trim();
|
return commandAsString.trim();
|
||||||
}
|
}
|
||||||
|
@ -111,9 +133,9 @@ public class CCommandDSC {
|
||||||
return (String[]) includeFiles.toArray(new String[includeFiles.size()]);
|
return (String[]) includeFiles.toArray(new String[includeFiles.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List getFilesList() {
|
// public List getFilesList() {
|
||||||
return files;
|
// return files;
|
||||||
}
|
// }
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see java.lang.Object#equals(java.lang.Object)
|
* @see java.lang.Object#equals(java.lang.Object)
|
||||||
|
@ -130,4 +152,5 @@ public class CCommandDSC {
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return compilerCommand.hashCode();
|
return compilerCommand.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,11 +10,19 @@
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
package org.eclipse.cdt.make.internal.core.scannerconfig2;
|
package org.eclipse.cdt.make.internal.core.scannerconfig2;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2;
|
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2;
|
||||||
import org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes;
|
import org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes;
|
||||||
|
import org.eclipse.cdt.make.internal.core.scannerconfig.util.CCommandDSC;
|
||||||
|
import org.eclipse.cdt.make.internal.core.scannerconfig.util.TraceUtil;
|
||||||
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
@ -25,19 +33,107 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
* @author vhirsl
|
* @author vhirsl
|
||||||
*/
|
*/
|
||||||
public class PerFileSICollector implements IScannerInfoCollector2 {
|
public class PerFileSICollector implements IScannerInfoCollector2 {
|
||||||
|
private IProject project;
|
||||||
|
|
||||||
|
private Map commandIdToFilesMap; // command id and list of files it applies to
|
||||||
|
private Map fileToCommandIdsMap; // maps each file to the list of corresponding command ids
|
||||||
|
|
||||||
|
private Map commandIdCommandMap; // map of all commands
|
||||||
|
private int commandIdCounter = 0;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public PerFileSICollector() {
|
public PerFileSICollector() {
|
||||||
super();
|
commandIdToFilesMap = new HashMap();
|
||||||
// TODO Auto-generated constructor stub
|
fileToCommandIdsMap = new HashMap();
|
||||||
|
commandIdCommandMap = new HashMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2#setProject(org.eclipse.core.resources.IProject)
|
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2#setProject(org.eclipse.core.resources.IProject)
|
||||||
*/
|
*/
|
||||||
public void setProject(IProject project) {
|
public void setProject(IProject project) {
|
||||||
|
this.project = project;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector#contributeToScannerConfig(java.lang.Object, java.util.Map)
|
||||||
|
*/
|
||||||
|
public synchronized void contributeToScannerConfig(Object resource, Map scannerInfo) {
|
||||||
|
// check the resource
|
||||||
|
String errorMessage = null;
|
||||||
|
if (resource == null) {
|
||||||
|
errorMessage = "resource is null";//$NON-NLS-1$
|
||||||
|
}
|
||||||
|
else if (!(resource instanceof IFile)) {
|
||||||
|
errorMessage = "resource is not an IFile";//$NON-NLS-1$
|
||||||
|
}
|
||||||
|
else if (((IFile) resource).getProject() == null) {
|
||||||
|
errorMessage = "project is null";//$NON-NLS-1$
|
||||||
|
}
|
||||||
|
else if (((IFile) resource).getProject() != project) {
|
||||||
|
errorMessage = "wrong project";//$NON-NLS-1$
|
||||||
|
}
|
||||||
|
if (errorMessage != null) {
|
||||||
|
TraceUtil.outputError("PerProjectSICollector.contributeToScannerConfig : ", errorMessage); //$NON-NLS-1$
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
IFile file = (IFile) resource;
|
||||||
|
|
||||||
|
for (Iterator i = scannerInfo.keySet().iterator(); i.hasNext(); ) {
|
||||||
|
ScannerInfoTypes type = (ScannerInfoTypes) i.next();
|
||||||
|
if (type.equals(ScannerInfoTypes.COMPILER_COMMAND)) {
|
||||||
|
addCompilerCommands(file, (List) scannerInfo.get(type));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
addScannerInfo(type, scannerInfo.get(type));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param file
|
||||||
|
* @param object
|
||||||
|
*/
|
||||||
|
private void addCompilerCommands(IFile file, List commandList) {
|
||||||
|
if (commandList != null) {
|
||||||
|
List existingCommands = new ArrayList(commandIdCommandMap.values());
|
||||||
|
for (Iterator i = commandList.iterator(); i.hasNext(); ) {
|
||||||
|
CCommandDSC cmd = (CCommandDSC) i.next();
|
||||||
|
int index = existingCommands.indexOf(cmd);
|
||||||
|
if (index != -1) {
|
||||||
|
cmd = (CCommandDSC) existingCommands.get(index);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
cmd.setCommandId(++commandIdCounter);
|
||||||
|
commandIdCommandMap.put(cmd.getCommandIdAsInteger(), cmd);
|
||||||
|
}
|
||||||
|
Integer commandId = cmd.getCommandIdAsInteger();
|
||||||
|
// update commandIdToFilesMap
|
||||||
|
Set fileSet = (Set) commandIdToFilesMap.get(commandId);
|
||||||
|
if (fileSet == null) {
|
||||||
|
fileSet = new HashSet();
|
||||||
|
commandIdToFilesMap.put(commandId, fileSet);
|
||||||
|
}
|
||||||
|
fileSet.add(file);
|
||||||
|
// update fileToCommandIdsMap
|
||||||
|
List commandIds = (List) fileToCommandIdsMap.get(file);
|
||||||
|
if (commandIds == null) {
|
||||||
|
commandIds = new ArrayList();
|
||||||
|
fileToCommandIdsMap.put(file, commandIds);
|
||||||
|
}
|
||||||
|
if (!commandIds.contains(commandId)) {
|
||||||
|
commandIds.add(commandId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param type
|
||||||
|
* @param object
|
||||||
|
*/
|
||||||
|
private void addScannerInfo(ScannerInfoTypes type, Object object) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -51,14 +147,6 @@ public class PerFileSICollector implements IScannerInfoCollector2 {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector#contributeToScannerConfig(java.lang.Object, java.util.Map)
|
|
||||||
*/
|
|
||||||
public void contributeToScannerConfig(Object resource, Map scannerInfo) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector#getCollectedScannerInfo(java.lang.Object, org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes)
|
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector#getCollectedScannerInfo(java.lang.Object, org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -22,6 +22,7 @@ import org.eclipse.cdt.core.CProjectNature;
|
||||||
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
||||||
import org.eclipse.cdt.make.core.MakeProjectNature;
|
import org.eclipse.cdt.make.core.MakeProjectNature;
|
||||||
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2;
|
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2;
|
||||||
|
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil;
|
||||||
import org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes;
|
import org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes;
|
||||||
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo;
|
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo;
|
||||||
import org.eclipse.cdt.make.internal.core.MakeMessages;
|
import org.eclipse.cdt.make.internal.core.MakeMessages;
|
||||||
|
@ -43,7 +44,7 @@ import org.eclipse.core.runtime.Platform;
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
* @author vhirsl
|
* @author vhirsl
|
||||||
*/
|
*/
|
||||||
public class PerProjectSICollector implements IScannerInfoCollector2 {
|
public class PerProjectSICollector implements IScannerInfoCollector2, IScannerInfoCollectorUtil {
|
||||||
private IProject project;
|
private IProject project;
|
||||||
|
|
||||||
private Map discoveredSI;
|
private Map discoveredSI;
|
||||||
|
@ -390,47 +391,41 @@ public class PerProjectSICollector implements IScannerInfoCollector2 {
|
||||||
return sumDiscoveredIncludes;
|
return sumDiscoveredIncludes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/* (non-Javadoc)
|
||||||
* Delete all discovered paths for the project
|
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil#deleteAllPaths(org.eclipse.core.resources.IResource)
|
||||||
*
|
|
||||||
* @param project
|
|
||||||
*/
|
*/
|
||||||
public void deleteAllPaths(IProject project) {
|
public void deleteAllPaths(IResource resource) {
|
||||||
|
IProject project = resource.getProject();
|
||||||
if (project != null && project.equals(this.project)) {
|
if (project != null && project.equals(this.project)) {
|
||||||
sumDiscoveredIncludes.clear();
|
sumDiscoveredIncludes.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/* (non-Javadoc)
|
||||||
* Delete all discovered symbols for the project
|
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil#deleteAllSymbols(org.eclipse.core.resources.IResource)
|
||||||
*
|
|
||||||
* @param project
|
|
||||||
*/
|
*/
|
||||||
public void deleteAllSymbols(IProject project) {
|
public void deleteAllSymbols(IResource resource) {
|
||||||
|
IProject project = resource.getProject();
|
||||||
if (project != null && project.equals(this.project)) {
|
if (project != null && project.equals(this.project)) {
|
||||||
sumDiscoveredSymbols.clear();
|
sumDiscoveredSymbols.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/* (non-Javadoc)
|
||||||
* Delete a specific include path
|
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil#deletePath(org.eclipse.core.resources.IResource, java.lang.String)
|
||||||
*
|
|
||||||
* @param project
|
|
||||||
* @param path
|
|
||||||
*/
|
*/
|
||||||
public void deletePath(IProject project, String path) {
|
public void deletePath(IResource resource, String path) {
|
||||||
|
IProject project = resource.getProject();
|
||||||
if (project != null && project.equals(this.project)) {
|
if (project != null && project.equals(this.project)) {
|
||||||
sumDiscoveredIncludes.remove(path);
|
sumDiscoveredIncludes.remove(path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/* (non-Javadoc)
|
||||||
* Delete a specific symbol definition
|
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil#deleteSymbol(org.eclipse.core.resources.IResource, java.lang.String)
|
||||||
*
|
|
||||||
* @param project
|
|
||||||
* @param path
|
|
||||||
*/
|
*/
|
||||||
public void deleteSymbol(IProject project, String symbol) {
|
public void deleteSymbol(IResource resource, String symbol) {
|
||||||
|
IProject project = resource.getProject();
|
||||||
if (project != null && project.equals(this.project)) {
|
if (project != null && project.equals(this.project)) {
|
||||||
// remove it from the Map of SymbolEntries
|
// remove it from the Map of SymbolEntries
|
||||||
ScannerConfigUtil.removeSymbolEntryValue(symbol, sumDiscoveredSymbols);
|
ScannerConfigUtil.removeSymbolEntryValue(symbol, sumDiscoveredSymbols);
|
||||||
|
|
|
@ -18,12 +18,15 @@ import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.ICDescriptor;
|
import org.eclipse.cdt.core.ICDescriptor;
|
||||||
|
import org.eclipse.cdt.core.ICDescriptorOperation;
|
||||||
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
||||||
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo;
|
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo;
|
||||||
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2;
|
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2;
|
||||||
import org.eclipse.cdt.make.core.scannerconfig.ScannerConfigBuilder;
|
import org.eclipse.cdt.make.core.scannerconfig.ScannerConfigBuilder;
|
||||||
|
import org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigProfile.ScannerInfoProvider;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.Preferences;
|
import org.eclipse.core.runtime.Preferences;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
@ -420,7 +423,6 @@ public class ScannerConfigInfoFactory2 {
|
||||||
* @author vhirsl
|
* @author vhirsl
|
||||||
*/
|
*/
|
||||||
private static class BuildProperty extends Store {
|
private static class BuildProperty extends Store {
|
||||||
private static boolean sIsDirty = false;
|
|
||||||
private IProject project;
|
private IProject project;
|
||||||
private String profileId;
|
private String profileId;
|
||||||
|
|
||||||
|
@ -436,7 +438,8 @@ public class ScannerConfigInfoFactory2 {
|
||||||
*/
|
*/
|
||||||
protected void load() {
|
protected void load() {
|
||||||
ICDescriptor descriptor;
|
ICDescriptor descriptor;
|
||||||
int loaded = 0; // if everything is successfully loaded the value should be at least 2
|
List profileIds = ScannerConfigProfileManager.getInstance().getProfileIds();
|
||||||
|
List loadedProfiles = new ArrayList();
|
||||||
try {
|
try {
|
||||||
descriptor = CCorePlugin.getDefault().getCProjectDescription(project, false);
|
descriptor = CCorePlugin.getDefault().getCProjectDescription(project, false);
|
||||||
for (Node sc = descriptor.getProjectData(SCANNER_CONFIG).getFirstChild();
|
for (Node sc = descriptor.getProjectData(SCANNER_CONFIG).getFirstChild();
|
||||||
|
@ -449,28 +452,82 @@ public class ScannerConfigInfoFactory2 {
|
||||||
: profileId;
|
: profileId;
|
||||||
problemReportingEnabled = Boolean.valueOf(
|
problemReportingEnabled = Boolean.valueOf(
|
||||||
((Element)sc).getAttribute(PROBLEM_REPORTING_ENABLED)).booleanValue();
|
((Element)sc).getAttribute(PROBLEM_REPORTING_ENABLED)).booleanValue();
|
||||||
++loaded;
|
|
||||||
}
|
}
|
||||||
else if (sc.getNodeName().equals(PROFILE)) {
|
else if (sc.getNodeName().equals(PROFILE)) {
|
||||||
//if (selectedProfile.equals(((Element)sc).getAttribute(ID))) {
|
//if (selectedProfile.equals(((Element)sc).getAttribute(ID))) {
|
||||||
load(sc);
|
load(sc);
|
||||||
++loaded;
|
loadedProfiles.add(((Element)sc).getAttribute(ID));
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (loaded < 2) {
|
if (loadedProfiles.size() < 1) {
|
||||||
// No ScannerConfigDiscovery entry, try old project location - .project
|
// No ScannerConfigDiscovery entry, try old project location - .project
|
||||||
if (!migrateScannerConfigBuildInfo(ScannerConfigProfileManager.PER_PROJECT_PROFILE_ID)) {
|
if (migrateScannerConfigBuildInfo(ScannerConfigProfileManager.PER_PROJECT_PROFILE_ID)) {
|
||||||
// disable autodiscovery
|
loadedProfiles.add(ScannerConfigProfileManager.PER_PROJECT_PROFILE_ID);
|
||||||
autoDiscoveryEnabled = false;
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
// disable autodiscovery
|
||||||
|
autoDiscoveryEnabled = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (loadedProfiles.size() < profileIds.size()) {
|
||||||
|
// initialize remaining profiles with default values
|
||||||
|
for (Iterator i = profileIds.iterator(); i.hasNext(); ) {
|
||||||
|
String profileId = (String) i.next();
|
||||||
|
if (!loadedProfiles.contains(profileId)) {
|
||||||
|
loadDefaults(profileId);
|
||||||
|
loadedProfiles.add(profileId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// // store migrated data
|
||||||
|
// isDirty = true;
|
||||||
|
// store();
|
||||||
|
// save();
|
||||||
|
}
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
MakeCorePlugin.log(e);
|
MakeCorePlugin.log(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Load profile defaults
|
||||||
|
* @param profileId
|
||||||
|
*/
|
||||||
|
private void loadDefaults(String profileId) {
|
||||||
|
ProfileOptions po = new ProfileOptions();
|
||||||
|
po.buildOutputFileActionEnabled = false;
|
||||||
|
po.buildOutputParserEnabled = false;
|
||||||
|
|
||||||
|
ScannerConfigProfile configuredProfile = ScannerConfigProfileManager.getInstance().
|
||||||
|
getSCProfileConfiguration(profileId);
|
||||||
|
|
||||||
|
po.providerOptionsMap = new LinkedHashMap();
|
||||||
|
for (Iterator i = configuredProfile.getSIProviderIds().iterator(); i.hasNext(); ) {
|
||||||
|
String providerId = (String) i.next();
|
||||||
|
ProfileOptions.ProviderOptions ppo = new ProfileOptions.ProviderOptions();
|
||||||
|
ScannerInfoProvider configuredProvider = configuredProfile.
|
||||||
|
getScannerInfoProviderElement(providerId);
|
||||||
|
ppo.providerKind = configuredProvider.getProviderKind();
|
||||||
|
ppo.providerOutputParserEnabled = false;
|
||||||
|
if (ppo.providerKind.equals(ScannerConfigProfile.ScannerInfoProvider.RUN)) {
|
||||||
|
ppo.providerRunUseDefault = true;
|
||||||
|
ppo.providerRunCommand = configuredProvider.getAction().getAttribute(COMMAND);
|
||||||
|
ppo.providerRunArguments = configuredProvider.getAction().getAttribute(ARGUMENTS);
|
||||||
|
}
|
||||||
|
else if (ppo.providerKind.equals(ScannerConfigProfile.ScannerInfoProvider.OPEN)) {
|
||||||
|
ppo.providerOpenFilePath = configuredProvider.getAction().getAttribute("file");//$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
po.providerOptionsMap.put(providerId, ppo);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (profileOptionsMap == null) {
|
||||||
|
profileOptionsMap = new LinkedHashMap();
|
||||||
|
}
|
||||||
|
profileOptionsMap.put(profileId, po);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
* @param profileId
|
* @param profileId
|
||||||
*/
|
*/
|
||||||
private boolean migrateScannerConfigBuildInfo(String profileId) {
|
private boolean migrateScannerConfigBuildInfo(String profileId) {
|
||||||
|
@ -506,7 +563,6 @@ public class ScannerConfigInfoFactory2 {
|
||||||
|
|
||||||
// store migrated data
|
// store migrated data
|
||||||
isDirty = true;
|
isDirty = true;
|
||||||
store();
|
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
catch (CoreException e) {
|
catch (CoreException e) {
|
||||||
|
@ -591,41 +647,37 @@ public class ScannerConfigInfoFactory2 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
private boolean store() throws CoreException {
|
||||||
* @see org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigInfoFactory2.Store#store()
|
|
||||||
*/
|
|
||||||
public void store() throws CoreException {
|
|
||||||
if (isDirty) {
|
if (isDirty) {
|
||||||
synchronized (BuildProperty.class) {
|
ICDescriptor descriptor = CCorePlugin.getDefault().getCProjectDescription(project, true);
|
||||||
ICDescriptor descriptor = CCorePlugin.getDefault().getCProjectDescription(project, true);
|
Element sc = descriptor.getProjectData(SCANNER_CONFIG);
|
||||||
Element sc = descriptor.getProjectData(SCANNER_CONFIG);
|
Document doc = sc.getOwnerDocument();
|
||||||
Document doc = sc.getOwnerDocument();
|
|
||||||
|
|
||||||
// Clear out all current children
|
// Clear out all current children
|
||||||
Node child = sc.getFirstChild();
|
Node child = sc.getFirstChild();
|
||||||
while (child != null) {
|
while (child != null) {
|
||||||
sc.removeChild(child);
|
sc.removeChild(child);
|
||||||
child = sc.getFirstChild();
|
child = sc.getFirstChild();
|
||||||
}
|
|
||||||
|
|
||||||
Element autod = doc.createElement(SC_AUTODISCOVERY);
|
|
||||||
sc.appendChild(autod);
|
|
||||||
autod.setAttribute(ENABLED, Boolean.toString(autoDiscoveryEnabled));
|
|
||||||
autod.setAttribute(SELECTED_PROFILE_ID, selectedProfile);
|
|
||||||
autod.setAttribute(PROBLEM_REPORTING_ENABLED, Boolean.toString(problemReportingEnabled));
|
|
||||||
|
|
||||||
for (Iterator i = profileOptionsMap.keySet().iterator(); i.hasNext();) {
|
|
||||||
String profileId = (String) i.next();
|
|
||||||
Element profile = doc.createElement(PROFILE);
|
|
||||||
profile.setAttribute(ID, profileId);
|
|
||||||
store(profile, (ProfileOptions) profileOptionsMap.get(profileId));
|
|
||||||
sc.appendChild(profile);
|
|
||||||
}
|
|
||||||
|
|
||||||
isDirty = false;
|
|
||||||
sIsDirty = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Element autod = doc.createElement(SC_AUTODISCOVERY);
|
||||||
|
sc.appendChild(autod);
|
||||||
|
autod.setAttribute(ENABLED, Boolean.toString(autoDiscoveryEnabled));
|
||||||
|
autod.setAttribute(SELECTED_PROFILE_ID, selectedProfile);
|
||||||
|
autod.setAttribute(PROBLEM_REPORTING_ENABLED, Boolean.toString(problemReportingEnabled));
|
||||||
|
|
||||||
|
for (Iterator i = profileOptionsMap.keySet().iterator(); i.hasNext();) {
|
||||||
|
String profileId = (String) i.next();
|
||||||
|
Element profile = doc.createElement(PROFILE);
|
||||||
|
profile.setAttribute(ID, profileId);
|
||||||
|
store(profile, (ProfileOptions) profileOptionsMap.get(profileId));
|
||||||
|
sc.appendChild(profile);
|
||||||
|
}
|
||||||
|
|
||||||
|
isDirty = false;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -691,13 +743,17 @@ public class ScannerConfigInfoFactory2 {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#save()
|
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#save()
|
||||||
*/
|
*/
|
||||||
public void save() throws CoreException {
|
public synchronized void save() throws CoreException {
|
||||||
synchronized (BuildProperty.class) {
|
if (store()) {
|
||||||
if (sIsDirty) {
|
ICDescriptorOperation op = new ICDescriptorOperation() {
|
||||||
ICDescriptor descriptor = CCorePlugin.getDefault().getCProjectDescription(project, true);
|
|
||||||
descriptor.saveProjectData();
|
public void execute(ICDescriptor descriptor, IProgressMonitor monitor) throws CoreException {
|
||||||
sIsDirty = false;
|
descriptor.saveProjectData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
CCorePlugin.getDefault().getCDescriptorManager().
|
||||||
|
runDescriptorOperation(project, op, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -785,10 +841,7 @@ public class ScannerConfigInfoFactory2 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
private void store() {
|
||||||
* @see org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigInfoFactory2.Store#store()
|
|
||||||
*/
|
|
||||||
public void store() {
|
|
||||||
if (isDirty) {
|
if (isDirty) {
|
||||||
set(SCANNER_CONFIG_AUTODISCOVERY_ENABLED, autoDiscoveryEnabled);
|
set(SCANNER_CONFIG_AUTODISCOVERY_ENABLED, autoDiscoveryEnabled);
|
||||||
set(SCANNER_CONFIG_SELECTED_PROFILE_ID, selectedProfile);
|
set(SCANNER_CONFIG_SELECTED_PROFILE_ID, selectedProfile);
|
||||||
|
@ -871,7 +924,7 @@ public class ScannerConfigInfoFactory2 {
|
||||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#save()
|
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#save()
|
||||||
*/
|
*/
|
||||||
public void save() throws CoreException {
|
public void save() throws CoreException {
|
||||||
// Nothing to do here
|
store();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,3 +69,4 @@ ProjectPathProperties.name=C/C++ Project Paths
|
||||||
DiscoveredScannerInfoContainer.name=Discovered scanner configuration container
|
DiscoveredScannerInfoContainer.name=Discovered scanner configuration container
|
||||||
|
|
||||||
GCCPerProjectProfile.name=GCC per project scanner info profile
|
GCCPerProjectProfile.name=GCC per project scanner info profile
|
||||||
|
GCCPerFileProfile.name=GCC per file scanner info profile
|
||||||
|
|
|
@ -534,4 +534,11 @@
|
||||||
class="org.eclipse.cdt.make.ui.dialogs.GCCPerProjectSCDProfilePage"
|
class="org.eclipse.cdt.make.ui.dialogs.GCCPerProjectSCDProfilePage"
|
||||||
name="%GCCPerProjectProfile.name"
|
name="%GCCPerProjectProfile.name"
|
||||||
profileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
|
profileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
|
||||||
|
</extension>
|
||||||
|
<extension
|
||||||
|
point="org.eclipse.cdt.make.ui.DiscoveryProfilePage">
|
||||||
|
<profilePage
|
||||||
|
class="org.eclipse.cdt.make.ui.dialogs.GCCPerFileSCDProfilePage"
|
||||||
|
name="%GCCPerFileProfile.name"
|
||||||
|
profileId="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"/>
|
||||||
</extension></plugin>
|
</extension></plugin>
|
||||||
|
|
|
@ -215,31 +215,13 @@ ManageDefinedSymbolsDialog.userGroup.title=User specified symbol definitions
|
||||||
ManageDefinedSymbolsDialog.discoveredGroup.title=Discovered symbol definitions
|
ManageDefinedSymbolsDialog.discoveredGroup.title=Discovered symbol definitions
|
||||||
|
|
||||||
# --- ScannerConfigOptionsDialog ---
|
# --- ScannerConfigOptionsDialog ---
|
||||||
ScannerConfigOptionsDialog.title=Discovery Options
|
|
||||||
ScannerConfigOptionsDialog.description=Set the scanner configuration discovery options for this project
|
|
||||||
ScannerConfigOptionsDialog.label.missingBuilderInformation=Builder is missing or disabled on project.
|
|
||||||
ScannerConfigOptionsDialog.scGroup.label=Automated discovery of paths and symbols
|
|
||||||
ScannerConfigOptionsDialog.scGroup.enabled.label=Automate discovery of paths and symbols
|
|
||||||
ScannerConfigOptionsDialog.scGroup.selectedProfile.label=Discovery profile:
|
|
||||||
ScannerConfigOptionsDialog.siBuilder.parser.group_label=Build output parser options
|
|
||||||
ScannerConfigOptionsDialog.siBuilder.parser.enable.label=Enable build output parser
|
|
||||||
ScannerConfigOptionsDialog.siBuilder.parser.label=Make build output parser:
|
|
||||||
ScannerConfigOptionsDialog.siProvider.cmd.group_label=Generate scanner info command options
|
|
||||||
ScannerConfigOptionsDialog.siProvider.cmd.enable.label=Enable generate scanner info command
|
|
||||||
ScannerConfigOptionsDialog.siProvider.cmd.use_default=Use default
|
|
||||||
ScannerConfigOptionsDialog.siProvider.cmd.label=Generate scanner info command:
|
|
||||||
ScannerConfigOptionsDialog.siProvider.parser.label=Command output parser:
|
|
||||||
ScannerConfigOptionsDialog.siProvider.cmd.error_message=Must enter a 'generate scanner info' command
|
|
||||||
ScannerConfigOptionsDialog.siProblem.group.label=Discovery problem reporting
|
|
||||||
ScannerConfigOptionsDialog.siProblem.generation.enable.label=Report path detection problems
|
|
||||||
|
|
||||||
ScannerConfigOptionsDialog.title=Discovery Options
|
ScannerConfigOptionsDialog.title=Discovery Options
|
||||||
ScannerConfigOptionsDialog.description=Set the scanner configuration discovery options for this project
|
ScannerConfigOptionsDialog.description=Set the scanner configuration discovery options for this project
|
||||||
ScannerConfigOptionsDialog.scGroup.label=Automated discovery of paths and symbols
|
ScannerConfigOptionsDialog.scGroup.label=Automated discovery of paths and symbols
|
||||||
ScannerConfigOptionsDialog.scGroup.enabled.button=Automate discovery of paths and symbols
|
ScannerConfigOptionsDialog.scGroup.enabled.button=Automate discovery of paths and symbols
|
||||||
ScannerConfigOptionsDialog.scGroup.problemReporting.enabled.button=Report path detection problems
|
ScannerConfigOptionsDialog.scGroup.problemReporting.enabled.button=Report path detection problems
|
||||||
ScannerConfigOptionsDialog.scGroup.selectedProfile.combo=Discovery profile:
|
ScannerConfigOptionsDialog.scGroup.selectedProfile.combo=Discovery profile:
|
||||||
ScannerConfigOptionsDialog.boProvider.group.label=Discovery profile options
|
ScannerConfigOptionsDialog.profile.group.label=Discovery profile options
|
||||||
ScannerConfigOptionsDialog.boProvider.parser.enabled.button=Enable build output scanner info discovery
|
ScannerConfigOptionsDialog.boProvider.parser.enabled.button=Enable build output scanner info discovery
|
||||||
ScannerConfigOptionsDialog.boProvider.open.label=Load build output from file
|
ScannerConfigOptionsDialog.boProvider.open.label=Load build output from file
|
||||||
ScannerConfigOptionsDialog.boProvider.browse.button=Browse...
|
ScannerConfigOptionsDialog.boProvider.browse.button=Browse...
|
||||||
|
|
|
@ -16,12 +16,18 @@ import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2;
|
||||||
|
import org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigProfileManager;
|
||||||
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
|
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
|
||||||
import org.eclipse.cdt.ui.dialogs.ICOptionPage;
|
import org.eclipse.cdt.make.internal.ui.preferences.TabFolderLayout;
|
||||||
|
import org.eclipse.cdt.ui.dialogs.AbstractCOptionPage;
|
||||||
|
import org.eclipse.cdt.ui.dialogs.ICOptionContainer;
|
||||||
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IConfigurationElement;
|
import org.eclipse.core.runtime.IConfigurationElement;
|
||||||
import org.eclipse.core.runtime.IExtensionPoint;
|
import org.eclipse.core.runtime.IExtensionPoint;
|
||||||
import org.eclipse.core.runtime.Platform;
|
import org.eclipse.core.runtime.Platform;
|
||||||
|
import org.eclipse.core.runtime.Preferences;
|
||||||
import org.eclipse.jface.resource.ImageDescriptor;
|
import org.eclipse.jface.resource.ImageDescriptor;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
|
||||||
|
@ -30,13 +36,47 @@ import org.eclipse.swt.widgets.Composite;
|
||||||
*
|
*
|
||||||
* @author vhirsl
|
* @author vhirsl
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractDiscoveryOptionsBlock extends AbstractDiscoveryPage {
|
public abstract class AbstractDiscoveryOptionsBlock extends AbstractCOptionPage {
|
||||||
|
private Preferences fPrefs;
|
||||||
|
private IScannerConfigBuilderInfo2 fBuildInfo;
|
||||||
|
private boolean fInitialized = false;
|
||||||
|
|
||||||
private Map fProfilePageMap = null;
|
private Map fProfilePageMap = null;
|
||||||
|
|
||||||
// Composite parent provided by the block.
|
// Composite parent provided by the block.
|
||||||
private Composite fCompositeParent;
|
private Composite fCompositeParent;
|
||||||
private ICOptionPage fCurrentPage;
|
private AbstractDiscoveryPage fCurrentPage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Returns the project.
|
||||||
|
*/
|
||||||
|
protected IProject getProject() {
|
||||||
|
return getContainer().getProject();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @return Returns the fPrefs.
|
||||||
|
*/
|
||||||
|
protected Preferences getPrefs() {
|
||||||
|
return fPrefs;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @return Returns the fBuildInfo.
|
||||||
|
*/
|
||||||
|
protected IScannerConfigBuilderInfo2 getBuildInfo() {
|
||||||
|
return fBuildInfo;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @return Returns the fInitialized.
|
||||||
|
*/
|
||||||
|
protected boolean isInitialized() {
|
||||||
|
return fInitialized;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param initialized The fInitialized to set.
|
||||||
|
*/
|
||||||
|
protected void setInitialized(boolean initialized) {
|
||||||
|
fInitialized = initialized;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Create a profile page only on request
|
* Create a profile page only on request
|
||||||
*
|
*
|
||||||
|
@ -44,16 +84,16 @@ public abstract class AbstractDiscoveryOptionsBlock extends AbstractDiscoveryPag
|
||||||
*/
|
*/
|
||||||
protected static class DiscoveryProfilePageConfiguration {
|
protected static class DiscoveryProfilePageConfiguration {
|
||||||
|
|
||||||
ICOptionPage page;
|
AbstractDiscoveryPage page;
|
||||||
IConfigurationElement fElement;
|
IConfigurationElement fElement;
|
||||||
|
|
||||||
public DiscoveryProfilePageConfiguration(IConfigurationElement element) {
|
public DiscoveryProfilePageConfiguration(IConfigurationElement element) {
|
||||||
fElement = element;
|
fElement = element;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICOptionPage getPage() throws CoreException {
|
public AbstractDiscoveryPage getPage() throws CoreException {
|
||||||
if (page == null) {
|
if (page == null) {
|
||||||
page = (ICOptionPage) fElement.createExecutableExtension("class"); //$NON-NLS-1$
|
page = (AbstractDiscoveryPage) fElement.createExecutableExtension("class"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
@ -95,13 +135,73 @@ public abstract class AbstractDiscoveryOptionsBlock extends AbstractDiscoveryPag
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.ui.dialogs.ICOptionPage#setContainer(org.eclipse.cdt.ui.dialogs.ICOptionContainer)
|
||||||
|
*/
|
||||||
|
public void setContainer(ICOptionContainer container) {
|
||||||
|
super.setContainer(container);
|
||||||
|
|
||||||
|
fPrefs = getContainer().getPreferences();
|
||||||
|
IProject project = getContainer().getProject();
|
||||||
|
|
||||||
|
fInitialized = true;
|
||||||
|
if (project != null) {
|
||||||
|
try {
|
||||||
|
fBuildInfo = ScannerConfigProfileManager.createScannerConfigBuildInfo2(project);
|
||||||
|
} catch (CoreException e) {
|
||||||
|
// missing builder information (builder disabled or legacy project)
|
||||||
|
fInitialized = false;
|
||||||
|
fBuildInfo = null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fBuildInfo = ScannerConfigProfileManager.createScannerConfigBuildInfo2(fPrefs, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void updateContainer() {
|
||||||
|
getContainer().updateContainer();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param project
|
||||||
|
*/
|
||||||
|
protected void createBuildInfo() {
|
||||||
|
if (getProject() != null) {
|
||||||
|
try {
|
||||||
|
// get the project properties
|
||||||
|
fBuildInfo = ScannerConfigProfileManager.createScannerConfigBuildInfo2(getProject());
|
||||||
|
}
|
||||||
|
catch (CoreException e) {
|
||||||
|
fBuildInfo = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// get the preferences
|
||||||
|
fBuildInfo = ScannerConfigProfileManager.createScannerConfigBuildInfo2(fPrefs, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create build info based on preferences
|
||||||
|
*/
|
||||||
|
protected void createDefaultBuildInfo() {
|
||||||
|
// Populate with the default values
|
||||||
|
if (getProject() != null) {
|
||||||
|
// get the preferences
|
||||||
|
fBuildInfo = ScannerConfigProfileManager.createScannerConfigBuildInfo2(fPrefs, false);
|
||||||
|
} else {
|
||||||
|
// get the defaults
|
||||||
|
fBuildInfo = ScannerConfigProfileManager.createScannerConfigBuildInfo2(fPrefs, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected Composite getCompositeParent() {
|
protected Composite getCompositeParent() {
|
||||||
return fCompositeParent;
|
return fCompositeParent;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setCompositeParent(Composite parent) {
|
protected void setCompositeParent(Composite parent) {
|
||||||
fCompositeParent = parent;
|
fCompositeParent = parent;
|
||||||
// fCompositeParent.setLayout(new TabFolderLayout());
|
fCompositeParent.setLayout(new TabFolderLayout());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -122,31 +222,32 @@ public abstract class AbstractDiscoveryOptionsBlock extends AbstractDiscoveryPag
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String profileId = getCurrentProfileId();
|
String profileId = getCurrentProfileId();
|
||||||
ICOptionPage page = getDiscoveryProfilePage(profileId);
|
AbstractDiscoveryPage page = getDiscoveryProfilePage(profileId);
|
||||||
if (page != null) {
|
if (page != null) {
|
||||||
if (page.getControl() == null) {
|
if (page.getControl() == null) {
|
||||||
Composite parent = getCompositeParent();
|
Composite parent = getCompositeParent();
|
||||||
page.setContainer(getContainer());
|
page.setContainer(this);
|
||||||
page.createControl(parent);
|
page.createControl(parent);
|
||||||
parent.layout(true);
|
parent.layout(true);
|
||||||
} else {
|
}
|
||||||
page.setVisible(false);
|
if (fCurrentPage != null) {
|
||||||
|
fCurrentPage.setVisible(false);
|
||||||
}
|
}
|
||||||
page.setVisible(true);
|
page.setVisible(true);
|
||||||
}
|
}
|
||||||
setCurrentPage(page);
|
setCurrentPage(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ICOptionPage getCurrentPage() {
|
protected AbstractDiscoveryPage getCurrentPage() {
|
||||||
return fCurrentPage;
|
return fCurrentPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setCurrentPage(ICOptionPage page) {
|
protected void setCurrentPage(AbstractDiscoveryPage page) {
|
||||||
fCurrentPage = page;
|
fCurrentPage = page;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.ui.dialogs.ICOptionPage#isValid()
|
* @see org.eclipse.cdt.ui.dialogs.AbstractDiscoveryPage#isValid()
|
||||||
*/
|
*/
|
||||||
public boolean isValid() {
|
public boolean isValid() {
|
||||||
return (getCurrentPage() == null) ? true : getCurrentPage().isValid();
|
return (getCurrentPage() == null) ? true : getCurrentPage().isValid();
|
||||||
|
@ -159,7 +260,7 @@ public abstract class AbstractDiscoveryOptionsBlock extends AbstractDiscoveryPag
|
||||||
return getCurrentPage().getErrorMessage();
|
return getCurrentPage().getErrorMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ICOptionPage getDiscoveryProfilePage(String profileId) {
|
protected AbstractDiscoveryPage getDiscoveryProfilePage(String profileId) {
|
||||||
DiscoveryProfilePageConfiguration configElement =
|
DiscoveryProfilePageConfiguration configElement =
|
||||||
(DiscoveryProfilePageConfiguration) fProfilePageMap.get(profileId);
|
(DiscoveryProfilePageConfiguration) fProfilePageMap.get(profileId);
|
||||||
if (configElement != null) {
|
if (configElement != null) {
|
||||||
|
@ -196,4 +297,5 @@ public abstract class AbstractDiscoveryOptionsBlock extends AbstractDiscoveryPag
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract String getCurrentProfileId();
|
protected abstract String getCurrentProfileId();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,14 +10,8 @@
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
package org.eclipse.cdt.make.ui.dialogs;
|
package org.eclipse.cdt.make.ui.dialogs;
|
||||||
|
|
||||||
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
|
||||||
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2;
|
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2;
|
||||||
import org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigProfileManager;
|
import org.eclipse.jface.dialogs.DialogPage;
|
||||||
import org.eclipse.cdt.ui.dialogs.AbstractCOptionPage;
|
|
||||||
import org.eclipse.cdt.ui.dialogs.ICOptionContainer;
|
|
||||||
import org.eclipse.core.resources.IProject;
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
|
||||||
import org.eclipse.core.runtime.Preferences;
|
|
||||||
import org.eclipse.jface.resource.ImageDescriptor;
|
import org.eclipse.jface.resource.ImageDescriptor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -25,12 +19,24 @@ import org.eclipse.jface.resource.ImageDescriptor;
|
||||||
*
|
*
|
||||||
* @author vhirsl
|
* @author vhirsl
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractDiscoveryPage extends AbstractCOptionPage {
|
public abstract class AbstractDiscoveryPage extends DialogPage {
|
||||||
|
protected static final String PREFIX = "ScannerConfigOptionsDialog"; //$NON-NLS-1$
|
||||||
|
protected static final String PROFILE_GROUP_LABEL = PREFIX + ".profile.group.label"; //$NON-NLS-1$
|
||||||
|
|
||||||
private Preferences fPrefs;
|
protected AbstractDiscoveryOptionsBlock fContainer;
|
||||||
private IScannerConfigBuilderInfo2 fBuildInfo;
|
|
||||||
private boolean fInitialized = false;
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Returns the fContainer.
|
||||||
|
*/
|
||||||
|
protected AbstractDiscoveryOptionsBlock getContainer() {
|
||||||
|
return fContainer;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param container The fContainer to set.
|
||||||
|
*/
|
||||||
|
protected void setContainer(AbstractDiscoveryOptionsBlock container) {
|
||||||
|
fContainer = container;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -53,89 +59,20 @@ public abstract class AbstractDiscoveryPage extends AbstractCOptionPage {
|
||||||
super(title, image);
|
super(title, image);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
protected abstract boolean isValid();
|
||||||
* @return Returns the fPrefs.
|
protected abstract void populateBuildInfo(IScannerConfigBuilderInfo2 buildInfo);
|
||||||
*/
|
protected abstract void restoreFromBuildinfo(IScannerConfigBuilderInfo2 buildInfo);
|
||||||
protected Preferences getPrefs() {
|
|
||||||
return fPrefs;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @return Returns the fBuildInfo.
|
|
||||||
*/
|
|
||||||
protected IScannerConfigBuilderInfo2 getBuildInfo() {
|
|
||||||
return fBuildInfo;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @return Returns the fInitialized.
|
|
||||||
*/
|
|
||||||
protected boolean isInitialized() {
|
|
||||||
return fInitialized;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @param initialized The fInitialized to set.
|
|
||||||
*/
|
|
||||||
protected void setInitialized(boolean initialized) {
|
|
||||||
fInitialized = initialized;
|
|
||||||
}
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.ui.dialogs.ICOptionPage#setContainer(org.eclipse.cdt.ui.dialogs.ICOptionContainer)
|
|
||||||
*/
|
|
||||||
public void setContainer(ICOptionContainer container) {
|
|
||||||
super.setContainer(container);
|
|
||||||
|
|
||||||
fPrefs = getContainer().getPreferences();
|
public void performApply() {
|
||||||
IProject project = getContainer().getProject();
|
IScannerConfigBuilderInfo2 buildInfo = getContainer().getBuildInfo();
|
||||||
|
|
||||||
fInitialized = true;
|
populateBuildInfo(buildInfo);
|
||||||
if (project != null) {
|
|
||||||
try {
|
|
||||||
fBuildInfo = ScannerConfigProfileManager.createScannerConfigBuildInfo2(project);
|
|
||||||
} catch (CoreException e) {
|
|
||||||
// missing builder information (builder disabled or legacy project)
|
|
||||||
fInitialized = false;
|
|
||||||
fBuildInfo = null;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
fBuildInfo = ScannerConfigProfileManager.createScannerConfigBuildInfo2(fPrefs, false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public void performDefaults() {
|
||||||
* Create build info based on project properties
|
IScannerConfigBuilderInfo2 buildInfo = getContainer().getBuildInfo();
|
||||||
* @param project
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
protected IScannerConfigBuilderInfo2 createBuildInfo(IProject project) {
|
|
||||||
IScannerConfigBuilderInfo2 bi = null;
|
|
||||||
if (project != null) {
|
|
||||||
try {
|
|
||||||
bi = ScannerConfigProfileManager.createScannerConfigBuildInfo2(project);
|
|
||||||
} catch (CoreException e) {
|
|
||||||
// disabled builder... just log it
|
|
||||||
MakeCorePlugin.log(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
bi = ScannerConfigProfileManager.createScannerConfigBuildInfo2(fPrefs, false);
|
|
||||||
}
|
|
||||||
return bi;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
restoreFromBuildinfo(buildInfo);
|
||||||
* Create build info based on preferences
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
protected IScannerConfigBuilderInfo2 createBuildInfo() {
|
|
||||||
IScannerConfigBuilderInfo2 bi = null;
|
|
||||||
// Populate with the default values
|
|
||||||
if (getContainer().getProject() != null) {
|
|
||||||
// get the preferences
|
|
||||||
bi = ScannerConfigProfileManager.createScannerConfigBuildInfo2(fPrefs, false);
|
|
||||||
} else {
|
|
||||||
// get the defaults
|
|
||||||
bi = ScannerConfigProfileManager.createScannerConfigBuildInfo2(fPrefs, true);
|
|
||||||
}
|
|
||||||
return bi;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,11 +30,12 @@ import org.eclipse.cdt.internal.ui.wizards.dialogfields.ITreeListAdapter;
|
||||||
import org.eclipse.cdt.internal.ui.wizards.dialogfields.LayoutUtil;
|
import org.eclipse.cdt.internal.ui.wizards.dialogfields.LayoutUtil;
|
||||||
import org.eclipse.cdt.internal.ui.wizards.dialogfields.TreeListDialogField;
|
import org.eclipse.cdt.internal.ui.wizards.dialogfields.TreeListDialogField;
|
||||||
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
||||||
|
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector;
|
||||||
|
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil;
|
||||||
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo;
|
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo;
|
||||||
import org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredPathContainer;
|
import org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredPathContainer;
|
||||||
import org.eclipse.cdt.make.internal.core.scannerconfig.ScannerConfigUtil;
|
import org.eclipse.cdt.make.internal.core.scannerconfig.ScannerConfigUtil;
|
||||||
import org.eclipse.cdt.make.internal.core.scannerconfig.util.SymbolEntry;
|
import org.eclipse.cdt.make.internal.core.scannerconfig.util.SymbolEntry;
|
||||||
import org.eclipse.cdt.make.internal.core.scannerconfig2.PerProjectSICollector;
|
|
||||||
import org.eclipse.cdt.make.internal.core.scannerconfig2.SCProfileInstance;
|
import org.eclipse.cdt.make.internal.core.scannerconfig2.SCProfileInstance;
|
||||||
import org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigProfileManager;
|
import org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigProfileManager;
|
||||||
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
|
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
|
||||||
|
@ -558,57 +559,59 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr
|
||||||
|
|
||||||
private boolean deleteEntry() {
|
private boolean deleteEntry() {
|
||||||
boolean rc = false;
|
boolean rc = false;
|
||||||
List newSelection = new ArrayList();
|
IProject project = fCProject.getProject();
|
||||||
List selElements = fDiscoveredContainerList.getSelectedElements();
|
SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance().
|
||||||
for (int i = 0; i < selElements.size(); ++i) {
|
getSCProfileInstance(project, ScannerConfigProfileManager.NULL_PROFILE_ID); // use selected profile for the project
|
||||||
DiscoveredElement elem = (DiscoveredElement) selElements.get(i);
|
IScannerInfoCollector collector = profileInstance.getScannerInfoCollector();
|
||||||
if (elem.getEntryKind() != DiscoveredElement.CONTAINER) {
|
if (collector instanceof IScannerInfoCollectorUtil) {
|
||||||
DiscoveredElement parent = elem.getParent();
|
IScannerInfoCollectorUtil collectorUtil = (IScannerInfoCollectorUtil) collector;
|
||||||
if (parent != null) {
|
List newSelection = new ArrayList();
|
||||||
Object[] children = parent.getChildren();
|
List selElements = fDiscoveredContainerList.getSelectedElements();
|
||||||
if (elem.delete()) {
|
for (int i = 0; i < selElements.size(); ++i) {
|
||||||
// ScannerInfoCollector collector = ScannerInfoCollector.getInstance();
|
DiscoveredElement elem = (DiscoveredElement) selElements.get(i);
|
||||||
IProject project = fCProject.getProject();
|
if (elem.getEntryKind() != DiscoveredElement.CONTAINER) {
|
||||||
SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance().
|
DiscoveredElement parent = elem.getParent();
|
||||||
getSCProfileInstance(project, ScannerConfigProfileManager.NULL_PROFILE_ID); // use selected profile for the project
|
if (parent != null) {
|
||||||
PerProjectSICollector collector = (PerProjectSICollector) profileInstance.getScannerInfoCollector();
|
Object[] children = parent.getChildren();
|
||||||
switch (elem.getEntryKind()) {
|
if (elem.delete()) {
|
||||||
case DiscoveredElement.PATHS_GROUP:
|
switch (elem.getEntryKind()) {
|
||||||
collector.deleteAllPaths(project);
|
case DiscoveredElement.PATHS_GROUP:
|
||||||
break;
|
collectorUtil.deleteAllPaths(project);
|
||||||
case DiscoveredElement.SYMBOLS_GROUP:
|
break;
|
||||||
collector.deleteAllSymbols(project);
|
case DiscoveredElement.SYMBOLS_GROUP:
|
||||||
break;
|
collectorUtil.deleteAllSymbols(project);
|
||||||
case DiscoveredElement.INCLUDE_PATH:
|
break;
|
||||||
collector.deletePath(project, elem.getEntry());
|
case DiscoveredElement.INCLUDE_PATH:
|
||||||
break;
|
collectorUtil.deletePath(project, elem.getEntry());
|
||||||
case DiscoveredElement.SYMBOL_DEFINITION:
|
break;
|
||||||
collector.deleteSymbol(project, elem.getEntry());
|
case DiscoveredElement.SYMBOL_DEFINITION:
|
||||||
break;
|
collectorUtil.deleteSymbol(project, elem.getEntry());
|
||||||
}
|
break;
|
||||||
rc = true;
|
}
|
||||||
// set new selection
|
rc = true;
|
||||||
for (int j = 0; j < children.length; ++j) {
|
// set new selection
|
||||||
DiscoveredElement child = (DiscoveredElement) children[j];
|
for (int j = 0; j < children.length; ++j) {
|
||||||
if (elem.equals(child)) {
|
DiscoveredElement child = (DiscoveredElement) children[j];
|
||||||
newSelection.clear();
|
if (elem.equals(child)) {
|
||||||
if (j + 1 < children.length) {
|
newSelection.clear();
|
||||||
newSelection.add(children[j + 1]);
|
if (j + 1 < children.length) {
|
||||||
}
|
newSelection.add(children[j + 1]);
|
||||||
else if (j - 1 >= 0) {
|
}
|
||||||
newSelection.add(children[j - 1]);
|
else if (j - 1 >= 0) {
|
||||||
}
|
newSelection.add(children[j - 1]);
|
||||||
else {
|
}
|
||||||
newSelection.add(parent);
|
else {
|
||||||
}
|
newSelection.add(parent);
|
||||||
break;
|
}
|
||||||
}
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fDiscoveredContainerList.postSetSelection(new StructuredSelection(newSelection));
|
}
|
||||||
|
fDiscoveredContainerList.postSetSelection(new StructuredSelection(newSelection));
|
||||||
|
}
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,9 +15,6 @@ import java.util.Arrays;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
|
||||||
import org.eclipse.cdt.core.ICDescriptor;
|
|
||||||
import org.eclipse.cdt.core.ICDescriptorOperation;
|
|
||||||
import org.eclipse.cdt.core.model.CModelException;
|
import org.eclipse.cdt.core.model.CModelException;
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
|
@ -28,6 +25,7 @@ import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2;
|
||||||
import org.eclipse.cdt.make.core.scannerconfig.ScannerConfigNature;
|
import org.eclipse.cdt.make.core.scannerconfig.ScannerConfigNature;
|
||||||
import org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredPathContainer;
|
import org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredPathContainer;
|
||||||
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
|
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
|
||||||
|
import org.eclipse.cdt.make.internal.ui.preferences.TabFolderLayout;
|
||||||
import org.eclipse.cdt.make.ui.IMakeHelpContextIds;
|
import org.eclipse.cdt.make.ui.IMakeHelpContextIds;
|
||||||
import org.eclipse.cdt.ui.dialogs.ICOptionContainer;
|
import org.eclipse.cdt.ui.dialogs.ICOptionContainer;
|
||||||
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
|
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
|
||||||
|
@ -120,16 +118,13 @@ public class DiscoveryOptionsBlock extends AbstractDiscoveryOptionsBlock {
|
||||||
// Create a group for scanner config discovery
|
// Create a group for scanner config discovery
|
||||||
if (createScannerConfigControls(scComp, tabColumns)) {
|
if (createScannerConfigControls(scComp, tabColumns)) {
|
||||||
// create a composite for discovery profile options
|
// create a composite for discovery profile options
|
||||||
profileComp = ControlFactory.createComposite(composite, 1);
|
profileComp = new Composite(composite, SWT.NULL);
|
||||||
// ((GridLayout)profileComp.getLayout()).marginHeight = 5;
|
// ((GridLayout)profileComp.getLayout()).marginHeight = 5;
|
||||||
// ((GridLayout)profileComp.getLayout()).marginWidth = 5;
|
// ((GridLayout)profileComp.getLayout()).marginWidth = 5;
|
||||||
// ((GridLayout)profileComp.getLayout()).verticalSpacing = 5;
|
// ((GridLayout)profileComp.getLayout()).verticalSpacing = 5;
|
||||||
profileComp.setFont(font);
|
profileComp.setFont(font);
|
||||||
GridData gd = (GridData) profileComp.getLayoutData();
|
profileComp.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
|
||||||
gd.grabExcessHorizontalSpace = true;
|
profileComp.setLayout(new TabFolderLayout());
|
||||||
// gd.grabExcessVerticalSpace = true;
|
|
||||||
gd.horizontalAlignment = GridData.FILL;
|
|
||||||
gd.verticalAlignment = GridData.FILL;
|
|
||||||
|
|
||||||
// Must set the composite parent to super class.
|
// Must set the composite parent to super class.
|
||||||
setCompositeParent(profileComp);
|
setCompositeParent(profileComp);
|
||||||
|
@ -196,7 +191,12 @@ public class DiscoveryOptionsBlock extends AbstractDiscoveryOptionsBlock {
|
||||||
((GridData)label.getLayoutData()).grabExcessHorizontalSpace = false;
|
((GridData)label.getLayoutData()).grabExcessHorizontalSpace = false;
|
||||||
|
|
||||||
profileComboBox = new Combo(scGroup, SWT.DROP_DOWN | SWT.READ_ONLY);
|
profileComboBox = new Combo(scGroup, SWT.DROP_DOWN | SWT.READ_ONLY);
|
||||||
|
profileComboBox.addSelectionListener(new SelectionAdapter() {
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
getBuildInfo().setSelectedProfileId(getCurrentProfileId());
|
||||||
|
handleDiscoveryProfileChanged();
|
||||||
|
}
|
||||||
|
});
|
||||||
// fill the combobox and set the initial value
|
// fill the combobox and set the initial value
|
||||||
for (Iterator items = getDiscoveryProfileIdList().iterator(); items.hasNext();) {
|
for (Iterator items = getDiscoveryProfileIdList().iterator(); items.hasNext();) {
|
||||||
String profileId = (String)items.next();
|
String profileId = (String)items.next();
|
||||||
|
@ -252,33 +252,21 @@ public class DiscoveryOptionsBlock extends AbstractDiscoveryOptionsBlock {
|
||||||
// init buildInfo
|
// init buildInfo
|
||||||
final IProject project = getContainer().getProject();
|
final IProject project = getContainer().getProject();
|
||||||
// Create new build info in case of new C++ project wizard
|
// Create new build info in case of new C++ project wizard
|
||||||
final IScannerConfigBuilderInfo2 buildInfo = createBuildInfo(project);
|
createBuildInfo();
|
||||||
|
|
||||||
if (buildInfo != null) {
|
if (getBuildInfo() != null) {
|
||||||
populateBuildInfo(buildInfo);
|
populateBuildInfo(getBuildInfo());
|
||||||
buildInfo.store();
|
|
||||||
monitor.worked(1);
|
monitor.worked(1);
|
||||||
|
|
||||||
if (scEnabledButton.getSelection()) {
|
if (scEnabledButton.getSelection()) {
|
||||||
getCurrentPage().performApply(monitor);
|
getCurrentPage().performApply();
|
||||||
}
|
}
|
||||||
monitor.worked(1);
|
monitor.worked(1);
|
||||||
|
|
||||||
if (project != null) {
|
if (project != null) {
|
||||||
configureProject(project, monitor);
|
configureProject(project, monitor);
|
||||||
ICDescriptorOperation op = new ICDescriptorOperation() {
|
|
||||||
|
|
||||||
public void execute(ICDescriptor descriptor, IProgressMonitor monitor) throws CoreException {
|
|
||||||
buildInfo.save();
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
CCorePlugin.getDefault().getCDescriptorManager().
|
|
||||||
runDescriptorOperation(project, op, monitor);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
buildInfo.save();
|
|
||||||
}
|
}
|
||||||
|
getBuildInfo().save();
|
||||||
}
|
}
|
||||||
monitor.done();
|
monitor.done();
|
||||||
}
|
}
|
||||||
|
@ -321,10 +309,12 @@ public class DiscoveryOptionsBlock extends AbstractDiscoveryOptionsBlock {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void populateBuildInfo(IScannerConfigBuilderInfo2 buildInfo) {
|
private void populateBuildInfo(IScannerConfigBuilderInfo2 buildInfo) {
|
||||||
buildInfo.setAutoDiscoveryEnabled(scEnabledButton.getSelection());
|
if (buildInfo != null) {
|
||||||
String profileName = profileComboBox.getItem(profileComboBox.getSelectionIndex());
|
buildInfo.setAutoDiscoveryEnabled(scEnabledButton.getSelection());
|
||||||
buildInfo.setSelectedProfileId(getDiscoveryProfileId(profileName));
|
String profileName = profileComboBox.getItem(profileComboBox.getSelectionIndex());
|
||||||
buildInfo.setProblemReportingEnabled(scProblemReportingEnabledButton.getSelection());
|
buildInfo.setSelectedProfileId(getDiscoveryProfileId(profileName));
|
||||||
|
buildInfo.setProblemReportingEnabled(scProblemReportingEnabledButton.getSelection());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -336,19 +326,23 @@ public class DiscoveryOptionsBlock extends AbstractDiscoveryOptionsBlock {
|
||||||
// Missing builder info on a non-legacy project
|
// Missing builder info on a non-legacy project
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
IScannerConfigBuilderInfo2 buildInfo = createBuildInfo();
|
createDefaultBuildInfo();
|
||||||
|
|
||||||
restoreFromBuildinfo(buildInfo);
|
restoreFromBuildinfo(getBuildInfo());
|
||||||
enableAllControls();
|
enableAllControls();
|
||||||
|
|
||||||
getCurrentPage().performDefaults();
|
getCurrentPage().performDefaults();
|
||||||
|
|
||||||
|
handleDiscoveryProfileChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void restoreFromBuildinfo(IScannerConfigBuilderInfo2 buildInfo) {
|
private void restoreFromBuildinfo(IScannerConfigBuilderInfo2 buildInfo) {
|
||||||
scEnabledButton.setSelection(buildInfo.isAutoDiscoveryEnabled());
|
if (buildInfo != null) {
|
||||||
String profileId = buildInfo.getSelectedProfileId();
|
scEnabledButton.setSelection(buildInfo.isAutoDiscoveryEnabled());
|
||||||
profileComboBox.setText(getDiscoveryProfileName(profileId));
|
String profileId = buildInfo.getSelectedProfileId();
|
||||||
scProblemReportingEnabledButton.setSelection(buildInfo.isProblemReportingEnabled());
|
profileComboBox.setText(getDiscoveryProfileName(profileId));
|
||||||
|
scProblemReportingEnabledButton.setSelection(buildInfo.isProblemReportingEnabled());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,281 @@
|
||||||
|
/***********************************************************************
|
||||||
|
* Copyright (c) 2004 IBM Corporation and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* IBM - Initial API and implementation
|
||||||
|
***********************************************************************/
|
||||||
|
package org.eclipse.cdt.make.ui.dialogs;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.ui.util.SWTUtil;
|
||||||
|
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2;
|
||||||
|
import org.eclipse.cdt.make.internal.core.scannerconfig.jobs.BuildOutputReaderJob;
|
||||||
|
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
|
||||||
|
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
|
||||||
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
import org.eclipse.core.runtime.Path;
|
||||||
|
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
|
||||||
|
import org.eclipse.core.runtime.jobs.Job;
|
||||||
|
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
|
||||||
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.events.ModifyEvent;
|
||||||
|
import org.eclipse.swt.events.ModifyListener;
|
||||||
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
|
import org.eclipse.swt.layout.GridData;
|
||||||
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
|
import org.eclipse.swt.widgets.Button;
|
||||||
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
import org.eclipse.swt.widgets.FileDialog;
|
||||||
|
import org.eclipse.swt.widgets.Group;
|
||||||
|
import org.eclipse.swt.widgets.Label;
|
||||||
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
import org.eclipse.swt.widgets.Text;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SCD per project profile property/preference page
|
||||||
|
*
|
||||||
|
* @author vhirsl
|
||||||
|
*/
|
||||||
|
public class GCCPerFileSCDProfilePage extends AbstractDiscoveryPage {
|
||||||
|
private static final int DEFAULT_HEIGHT = 60;
|
||||||
|
|
||||||
|
private static final String BO_PROVIDER_PARSER_ENABLED_BUTTON = PREFIX + ".boProvider.parser.enabled.button"; //$NON-NLS-1$
|
||||||
|
private static final String BO_PROVIDER_OPEN_LABEL = PREFIX + ".boProvider.open.label"; //$NON-NLS-1$
|
||||||
|
private static final String BO_PROVIDER_BROWSE_BUTTON = PREFIX + ".boProvider.browse.button"; //$NON-NLS-1$
|
||||||
|
private static final String BO_PROVIDER_OPEN_FILE_DIALOG = PREFIX + ".boProvider.browse.openFileDialog"; //$NON-NLS-1$
|
||||||
|
private static final String BO_PROVIDER_LOAD_BUTTON = PREFIX + ".boProvider.load.button"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
private Button bopEnabledButton;
|
||||||
|
private Text bopOpenFileText;
|
||||||
|
private Button bopLoadButton;
|
||||||
|
|
||||||
|
// thread syncronization
|
||||||
|
private static Object lock = GCCPerFileSCDProfilePage.class;
|
||||||
|
private Shell shell;
|
||||||
|
private static GCCPerFileSCDProfilePage instance;
|
||||||
|
private static boolean loadButtonInitialEnabled = true;
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
|
||||||
|
*/
|
||||||
|
public void createControl(Composite parent) {
|
||||||
|
Composite page = ControlFactory.createComposite(parent, 1);
|
||||||
|
// ((GridData) page.getLayoutData()).grabExcessVerticalSpace = true;
|
||||||
|
// ((GridData) page.getLayoutData()).verticalAlignment = GridData.FILL;
|
||||||
|
|
||||||
|
// Add the profile UI contribution.
|
||||||
|
Group profileGroup = ControlFactory.createGroup(page,
|
||||||
|
MakeUIPlugin.getResourceString(PROFILE_GROUP_LABEL), 3);
|
||||||
|
|
||||||
|
GridData gd = (GridData) profileGroup.getLayoutData();
|
||||||
|
gd.grabExcessHorizontalSpace = true;
|
||||||
|
// PixelConverter converter = new PixelConverter(profileGroup);
|
||||||
|
// gd.heightHint = converter.convertVerticalDLUsToPixels(DEFAULT_HEIGHT);
|
||||||
|
((GridLayout) profileGroup.getLayout()).makeColumnsEqualWidth = false;
|
||||||
|
|
||||||
|
// Add bop enabled checkbox
|
||||||
|
bopEnabledButton = ControlFactory.createCheckBox(profileGroup,
|
||||||
|
MakeUIPlugin.getResourceString(BO_PROVIDER_PARSER_ENABLED_BUTTON));
|
||||||
|
// bopEnabledButton.setFont(parent.getFont());
|
||||||
|
((GridData)bopEnabledButton.getLayoutData()).horizontalSpan = 3;
|
||||||
|
((GridData)bopEnabledButton.getLayoutData()).grabExcessHorizontalSpace = true;
|
||||||
|
bopEnabledButton.addSelectionListener(new SelectionAdapter() {
|
||||||
|
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
handleModifyOpenFileText();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
// load label
|
||||||
|
Label loadLabel = ControlFactory.createLabel(profileGroup,
|
||||||
|
MakeUIPlugin.getResourceString(BO_PROVIDER_OPEN_LABEL));
|
||||||
|
((GridData) loadLabel.getLayoutData()).horizontalSpan = 3;
|
||||||
|
|
||||||
|
// text field
|
||||||
|
bopOpenFileText = ControlFactory.createTextField(profileGroup, SWT.SINGLE | SWT.BORDER);
|
||||||
|
bopOpenFileText.addModifyListener(new ModifyListener() {
|
||||||
|
public void modifyText(ModifyEvent e) {
|
||||||
|
handleModifyOpenFileText();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// browse button
|
||||||
|
Button browseButton = ControlFactory.createPushButton(profileGroup,
|
||||||
|
MakeUIPlugin.getResourceString(BO_PROVIDER_BROWSE_BUTTON));
|
||||||
|
((GridData) browseButton.getLayoutData()).widthHint =
|
||||||
|
SWTUtil.getButtonWidthHint(browseButton);
|
||||||
|
browseButton.addSelectionListener(new SelectionAdapter() {
|
||||||
|
|
||||||
|
public void widgetSelected(SelectionEvent event) {
|
||||||
|
handleBOPBrowseButtonSelected();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleBOPBrowseButtonSelected() {
|
||||||
|
FileDialog dialog = new FileDialog(getShell(), SWT.NONE);
|
||||||
|
dialog.setText(MakeUIPlugin.getResourceString(BO_PROVIDER_OPEN_FILE_DIALOG)); //$NON-NLS-1$
|
||||||
|
String fileName = getBopOpenFileText();
|
||||||
|
IPath filterPath;
|
||||||
|
if (fileName.length() == 0 && getContainer().getProject() != null) {
|
||||||
|
filterPath = getContainer().getProject().getLocation();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
IPath filePath = new Path(fileName);
|
||||||
|
filterPath = filePath.removeLastSegments(1).makeAbsolute();
|
||||||
|
}
|
||||||
|
dialog.setFilterPath(filterPath.toOSString());
|
||||||
|
String res = dialog.open();
|
||||||
|
if (res == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setBopOpenFileText(res);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// load button
|
||||||
|
bopLoadButton = ControlFactory.createPushButton(profileGroup,
|
||||||
|
MakeUIPlugin.getResourceString(BO_PROVIDER_LOAD_BUTTON));
|
||||||
|
((GridData) bopLoadButton.getLayoutData()).widthHint =
|
||||||
|
SWTUtil.getButtonWidthHint(bopLoadButton);
|
||||||
|
bopLoadButton.addSelectionListener(new SelectionAdapter() {
|
||||||
|
|
||||||
|
public void widgetSelected(SelectionEvent event) {
|
||||||
|
handleBOPLoadFileButtonSelected();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
bopLoadButton.setEnabled(loadButtonInitialEnabled);
|
||||||
|
if (getContainer().getProject() == null) { // project properties
|
||||||
|
bopLoadButton.setVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
setControl(page);
|
||||||
|
// set the shell variable; must be after setControl
|
||||||
|
//lock.acquire();
|
||||||
|
synchronized (lock) {
|
||||||
|
shell = getShell();
|
||||||
|
instance = this;
|
||||||
|
}
|
||||||
|
//lock.release();
|
||||||
|
initializeValues();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void handleModifyOpenFileText() {
|
||||||
|
String fileName = getBopOpenFileText();
|
||||||
|
bopLoadButton.setEnabled(bopEnabledButton.getSelection() &&
|
||||||
|
fileName.length() > 0 &&
|
||||||
|
(new File(fileName)).exists());
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getBopOpenFileText() {
|
||||||
|
// from project relative path to absolute path
|
||||||
|
String fileName = bopOpenFileText.getText().trim();
|
||||||
|
if (fileName.length() > 0) {
|
||||||
|
IPath filePath = new Path(fileName);
|
||||||
|
if (!filePath.isAbsolute()) {
|
||||||
|
if (getContainer().getProject() != null) {
|
||||||
|
IPath projectPath = getContainer().getProject().getLocation();
|
||||||
|
filePath = projectPath.append(filePath);
|
||||||
|
fileName = filePath.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setBopOpenFileText(String fileName) {
|
||||||
|
// from absolute path to project relative path
|
||||||
|
if (fileName.length() > 0) {
|
||||||
|
IPath filePath = new Path(fileName);
|
||||||
|
if (filePath.isAbsolute()) {
|
||||||
|
if (getContainer().getProject() != null) {
|
||||||
|
IPath projectPath = getContainer().getProject().getLocation();
|
||||||
|
if (projectPath.isPrefixOf(filePath)) {
|
||||||
|
filePath = filePath.removeFirstSegments(projectPath.segmentCount());
|
||||||
|
filePath = filePath.setDevice(null);
|
||||||
|
fileName = filePath.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bopOpenFileText.setText(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initializeValues() {
|
||||||
|
bopEnabledButton.setSelection(getContainer().getBuildInfo().isBuildOutputParserEnabled());
|
||||||
|
setBopOpenFileText(getContainer().getBuildInfo().getBuildOutputFilePath());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleBOPLoadFileButtonSelected() {
|
||||||
|
loadButtonInitialEnabled = false;
|
||||||
|
bopLoadButton.setEnabled(false);
|
||||||
|
|
||||||
|
// populate buildInfo to be used by the reader job
|
||||||
|
populateBuildInfo(getContainer().getBuildInfo());
|
||||||
|
IProject project = getContainer().getProject();
|
||||||
|
Job readerJob = new BuildOutputReaderJob(project, getContainer().getBuildInfo());
|
||||||
|
readerJob.setPriority(Job.LONG);
|
||||||
|
readerJob.addJobChangeListener(new JobChangeAdapter() {
|
||||||
|
|
||||||
|
public void done(IJobChangeEvent event) {
|
||||||
|
//lock.acquire();
|
||||||
|
synchronized (lock) {
|
||||||
|
if (!instance.shell.isDisposed()) {
|
||||||
|
instance.shell.getDisplay().asyncExec(new Runnable() {
|
||||||
|
|
||||||
|
public void run() {
|
||||||
|
if (!instance.shell.isDisposed()) {
|
||||||
|
instance.bopLoadButton.setEnabled(instance.bopEnabledButton.getSelection());
|
||||||
|
}
|
||||||
|
loadButtonInitialEnabled = instance.bopEnabledButton.getSelection();//true;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
loadButtonInitialEnabled = instance.bopEnabledButton.getSelection();//true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//lock.release();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
readerJob.schedule();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.make.ui.dialogs.AbstractDiscoveryPage#isValid()
|
||||||
|
*/
|
||||||
|
protected boolean isValid() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.make.ui.dialogs.AbstractDiscoveryPage#populateBuildInfo(org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2)
|
||||||
|
*/
|
||||||
|
protected void populateBuildInfo(IScannerConfigBuilderInfo2 buildInfo) {
|
||||||
|
if (buildInfo != null) {
|
||||||
|
buildInfo.setBuildOutputFileActionEnabled(true);
|
||||||
|
buildInfo.setBuildOutputFilePath(getBopOpenFileText());
|
||||||
|
buildInfo.setBuildOutputParserEnabled(bopEnabledButton.getSelection());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.make.ui.dialogs.AbstractDiscoveryPage#restoreFromBuildinfo(org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2)
|
||||||
|
*/
|
||||||
|
protected void restoreFromBuildinfo(IScannerConfigBuilderInfo2 buildInfo) {
|
||||||
|
if (buildInfo != null) {
|
||||||
|
setBopOpenFileText(buildInfo.getBuildOutputFilePath());
|
||||||
|
bopEnabledButton.setSelection(buildInfo.isBuildOutputParserEnabled());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -18,9 +18,7 @@ import org.eclipse.cdt.make.internal.core.scannerconfig.jobs.BuildOutputReaderJo
|
||||||
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
|
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
|
||||||
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
|
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
|
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
|
||||||
import org.eclipse.core.runtime.jobs.Job;
|
import org.eclipse.core.runtime.jobs.Job;
|
||||||
|
@ -41,15 +39,13 @@ import org.eclipse.swt.widgets.Shell;
|
||||||
import org.eclipse.swt.widgets.Text;
|
import org.eclipse.swt.widgets.Text;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SCD profile property/preference page
|
* SCD per project profile property/preference page
|
||||||
*
|
*
|
||||||
* @author vhirsl
|
* @author vhirsl
|
||||||
*/
|
*/
|
||||||
public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
|
public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
|
||||||
private static final int DEFAULT_HEIGHT = 160;
|
private static final int DEFAULT_HEIGHT = 160;
|
||||||
|
|
||||||
private static final String PREFIX = "ScannerConfigOptionsDialog"; //$NON-NLS-1$
|
|
||||||
private static final String BO_PROVIDER_GROUP_LABEL = PREFIX + ".boProvider.group.label"; //$NON-NLS-1$
|
|
||||||
private static final String BO_PROVIDER_PARSER_ENABLED_BUTTON = PREFIX + ".boProvider.parser.enabled.button"; //$NON-NLS-1$
|
private static final String BO_PROVIDER_PARSER_ENABLED_BUTTON = PREFIX + ".boProvider.parser.enabled.button"; //$NON-NLS-1$
|
||||||
private static final String BO_PROVIDER_OPEN_LABEL = PREFIX + ".boProvider.open.label"; //$NON-NLS-1$
|
private static final String BO_PROVIDER_OPEN_LABEL = PREFIX + ".boProvider.open.label"; //$NON-NLS-1$
|
||||||
private static final String BO_PROVIDER_BROWSE_BUTTON = PREFIX + ".boProvider.browse.button"; //$NON-NLS-1$
|
private static final String BO_PROVIDER_BROWSE_BUTTON = PREFIX + ".boProvider.browse.button"; //$NON-NLS-1$
|
||||||
|
@ -83,15 +79,19 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
|
||||||
* @see org.eclipse.cdt.ui.dialogs.AbstractCOptionPage#createControl(org.eclipse.swt.widgets.Composite)
|
* @see org.eclipse.cdt.ui.dialogs.AbstractCOptionPage#createControl(org.eclipse.swt.widgets.Composite)
|
||||||
*/
|
*/
|
||||||
public void createControl(Composite parent) {
|
public void createControl(Composite parent) {
|
||||||
|
Composite page = ControlFactory.createComposite(parent, 1);
|
||||||
|
// ((GridData) page.getLayoutData()).grabExcessVerticalSpace = true;
|
||||||
|
// ((GridData) page.getLayoutData()).verticalAlignment = GridData.FILL;
|
||||||
|
|
||||||
// Add the profile UI contribution.
|
// Add the profile UI contribution.
|
||||||
Group profileGroup = ControlFactory.createGroup(parent,
|
Group profileGroup = ControlFactory.createGroup(page,
|
||||||
MakeUIPlugin.getResourceString(BO_PROVIDER_GROUP_LABEL), 3);
|
MakeUIPlugin.getResourceString(PROFILE_GROUP_LABEL), 3);
|
||||||
|
|
||||||
GridData gd = (GridData) profileGroup.getLayoutData();
|
GridData gd = (GridData) profileGroup.getLayoutData();
|
||||||
gd.grabExcessHorizontalSpace = true;
|
gd.grabExcessHorizontalSpace = true;
|
||||||
gd.horizontalAlignment = GridData.FILL;
|
gd.horizontalAlignment = GridData.FILL;
|
||||||
// PixelConverter converter = new PixelConverter(parent);
|
// PixelConverter converter = new PixelConverter(parent);
|
||||||
// gd.heightHint = converter.convertHorizontalDLUsToPixels(DEFAULT_HEIGHT);
|
// gd.heightHint = converter.convertVerticalDLUsToPixels(DEFAULT_HEIGHT);
|
||||||
((GridLayout) profileGroup.getLayout()).makeColumnsEqualWidth = false;
|
((GridLayout) profileGroup.getLayout()).makeColumnsEqualWidth = false;
|
||||||
|
|
||||||
// Add bop enabled checkbox
|
// Add bop enabled checkbox
|
||||||
|
@ -135,7 +135,7 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
|
||||||
private void handleBOPBrowseButtonSelected() {
|
private void handleBOPBrowseButtonSelected() {
|
||||||
FileDialog dialog = new FileDialog(getShell(), SWT.NONE);
|
FileDialog dialog = new FileDialog(getShell(), SWT.NONE);
|
||||||
dialog.setText(MakeUIPlugin.getResourceString(BO_PROVIDER_OPEN_FILE_DIALOG)); //$NON-NLS-1$
|
dialog.setText(MakeUIPlugin.getResourceString(BO_PROVIDER_OPEN_FILE_DIALOG)); //$NON-NLS-1$
|
||||||
String fileName = bopOpenFileText.getText().trim();
|
String fileName = getBopOpenFileText();
|
||||||
IPath filterPath;
|
IPath filterPath;
|
||||||
if (fileName.length() == 0 && getContainer().getProject() != null) {
|
if (fileName.length() == 0 && getContainer().getProject() != null) {
|
||||||
filterPath = getContainer().getProject().getLocation();
|
filterPath = getContainer().getProject().getLocation();
|
||||||
|
@ -149,7 +149,7 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
|
||||||
if (res == null) {
|
if (res == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bopOpenFileText.setText(res);
|
setBopOpenFileText(res);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -227,8 +227,7 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
setControl(page);
|
||||||
setControl(parent);
|
|
||||||
// set the shell variable; must be after setControl
|
// set the shell variable; must be after setControl
|
||||||
//lock.acquire();
|
//lock.acquire();
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
|
@ -239,19 +238,13 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
|
||||||
initializeValues();
|
initializeValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
protected void handleModifyOpenFileText() {
|
protected void handleModifyOpenFileText() {
|
||||||
String fileName = bopOpenFileText.getText().trim();
|
String fileName = getBopOpenFileText();
|
||||||
bopLoadButton.setEnabled(bopEnabledButton.getSelection() &&
|
bopLoadButton.setEnabled(bopEnabledButton.getSelection() &&
|
||||||
fileName.length() > 0 &&
|
fileName.length() > 0 &&
|
||||||
new File(fileName).exists());
|
new File(fileName).exists());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
protected void handleModifyRunCommandText() {
|
protected void handleModifyRunCommandText() {
|
||||||
String cmd = sipRunCommandText.getText().trim();
|
String cmd = sipRunCommandText.getText().trim();
|
||||||
isValid = (cmd.length() > 0) ? true : false;
|
isValid = (cmd.length() > 0) ? true : false;
|
||||||
|
@ -259,14 +252,45 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
|
||||||
getContainer().updateContainer();
|
getContainer().updateContainer();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private String getBopOpenFileText() {
|
||||||
*
|
// from project relative path to absolute path
|
||||||
*/
|
String fileName = bopOpenFileText.getText().trim();
|
||||||
|
if (fileName.length() > 0) {
|
||||||
|
IPath filePath = new Path(fileName);
|
||||||
|
if (!filePath.isAbsolute()) {
|
||||||
|
if (getContainer().getProject() != null) {
|
||||||
|
IPath projectPath = getContainer().getProject().getLocation();
|
||||||
|
filePath = projectPath.append(filePath);
|
||||||
|
fileName = filePath.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setBopOpenFileText(String fileName) {
|
||||||
|
// from absolute path to project relative path
|
||||||
|
if (fileName.length() > 0) {
|
||||||
|
IPath filePath = new Path(fileName);
|
||||||
|
if (filePath.isAbsolute()) {
|
||||||
|
if (getContainer().getProject() != null) {
|
||||||
|
IPath projectPath = getContainer().getProject().getLocation();
|
||||||
|
if (projectPath.isPrefixOf(filePath)) {
|
||||||
|
filePath = filePath.removeFirstSegments(projectPath.segmentCount());
|
||||||
|
filePath = filePath.setDevice(null);
|
||||||
|
fileName = filePath.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bopOpenFileText.setText(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
private void initializeValues() {
|
private void initializeValues() {
|
||||||
bopEnabledButton.setSelection(getBuildInfo().isBuildOutputParserEnabled());
|
bopEnabledButton.setSelection(getContainer().getBuildInfo().isBuildOutputParserEnabled());
|
||||||
bopOpenFileText.setText(getBuildInfo().getBuildOutputFilePath());
|
setBopOpenFileText(getContainer().getBuildInfo().getBuildOutputFilePath());
|
||||||
sipEnabledButton.setSelection(getBuildInfo().isProviderOutputParserEnabled(providerId));
|
sipEnabledButton.setSelection(getContainer().getBuildInfo().isProviderOutputParserEnabled(providerId));
|
||||||
sipRunCommandText.setText(getBuildInfo().getProviderRunCommand(providerId));
|
sipRunCommandText.setText(getContainer().getBuildInfo().getProviderRunCommand(providerId));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleBOPLoadFileButtonSelected() {
|
private void handleBOPLoadFileButtonSelected() {
|
||||||
|
@ -274,9 +298,9 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
|
||||||
bopLoadButton.setEnabled(false);
|
bopLoadButton.setEnabled(false);
|
||||||
|
|
||||||
// populate buildInfo to be used by the reader job
|
// populate buildInfo to be used by the reader job
|
||||||
populateBuildInfo(getBuildInfo(), null);
|
populateBuildInfo(getContainer().getBuildInfo());
|
||||||
IProject project = getContainer().getProject();
|
IProject project = getContainer().getProject();
|
||||||
Job readerJob = new BuildOutputReaderJob(project, getBuildInfo());
|
Job readerJob = new BuildOutputReaderJob(project, getContainer().getBuildInfo());
|
||||||
readerJob.setPriority(Job.LONG);
|
readerJob.setPriority(Job.LONG);
|
||||||
readerJob.addJobChangeListener(new JobChangeAdapter() {
|
readerJob.addJobChangeListener(new JobChangeAdapter() {
|
||||||
|
|
||||||
|
@ -321,44 +345,30 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.ui.dialogs.AbstractCOptionPage#performApply(org.eclipse.core.runtime.IProgressMonitor)
|
* @see org.eclipse.cdt.make.ui.dialogs.AbstractDiscoveryPage#populateBuildInfo(org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2)
|
||||||
*/
|
*/
|
||||||
public void performApply(IProgressMonitor monitor) throws CoreException {
|
protected void populateBuildInfo(IScannerConfigBuilderInfo2 buildInfo) {
|
||||||
IProject project = getContainer().getProject();
|
|
||||||
// Create new build info in case of new C++ project wizard
|
|
||||||
IScannerConfigBuilderInfo2 buildInfo = createBuildInfo(project);
|
|
||||||
|
|
||||||
if (buildInfo != null) {
|
if (buildInfo != null) {
|
||||||
populateBuildInfo(buildInfo, monitor);
|
buildInfo.setBuildOutputFileActionEnabled(true);
|
||||||
buildInfo.store();
|
buildInfo.setBuildOutputFilePath(getBopOpenFileText());
|
||||||
|
buildInfo.setBuildOutputParserEnabled(bopEnabledButton.getSelection());
|
||||||
|
|
||||||
|
buildInfo.setProviderOutputParserEnabled(providerId, sipEnabledButton.getSelection());
|
||||||
|
buildInfo.setProviderRunCommand(providerId, sipRunCommandText.getText().trim());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void populateBuildInfo(IScannerConfigBuilderInfo2 buildInfo, IProgressMonitor monitor) {
|
|
||||||
buildInfo.setBuildOutputFileActionEnabled(true);
|
|
||||||
buildInfo.setBuildOutputFilePath(bopOpenFileText.getText().trim());
|
|
||||||
buildInfo.setBuildOutputParserEnabled(bopEnabledButton.getSelection());
|
|
||||||
|
|
||||||
buildInfo.setProviderOutputParserEnabled(providerId, sipEnabledButton.getSelection());
|
|
||||||
buildInfo.setProviderRunCommand(providerId, sipRunCommandText.getText().trim());
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.ui.dialogs.AbstractCOptionPage#performDefaults()
|
* @see org.eclipse.cdt.make.ui.dialogs.AbstractDiscoveryPage#restoreFromBuildinfo(org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2)
|
||||||
*/
|
*/
|
||||||
public void performDefaults() {
|
protected void restoreFromBuildinfo(IScannerConfigBuilderInfo2 buildInfo) {
|
||||||
// Create buildInfo with defaults
|
if (buildInfo != null) {
|
||||||
IScannerConfigBuilderInfo2 buildInfo = createBuildInfo();
|
setBopOpenFileText(buildInfo.getBuildOutputFilePath());
|
||||||
|
bopEnabledButton.setSelection(buildInfo.isBuildOutputParserEnabled());
|
||||||
|
|
||||||
restoreFromBuildinfo(buildInfo);
|
sipEnabledButton.setSelection(buildInfo.isProviderOutputParserEnabled(providerId));
|
||||||
}
|
sipRunCommandText.setText(buildInfo.getProviderRunCommand(providerId));
|
||||||
|
}
|
||||||
private void restoreFromBuildinfo(IScannerConfigBuilderInfo2 buildInfo) {
|
|
||||||
bopOpenFileText.setText(buildInfo.getBuildOutputFilePath());
|
|
||||||
bopEnabledButton.setSelection(buildInfo.isBuildOutputParserEnabled());
|
|
||||||
|
|
||||||
sipEnabledButton.setSelection(buildInfo.isProviderOutputParserEnabled(providerId));
|
|
||||||
sipRunCommandText.setText(buildInfo.getProviderRunCommand(providerId));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue