mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-25 01:45:33 +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);
|
||||
void setProviderOpenFilePath(String providerId, String filePath);
|
||||
|
||||
/**
|
||||
* Store the buildInfo.
|
||||
* @throws CoreException
|
||||
*/
|
||||
void store() throws CoreException;
|
||||
/**
|
||||
* Persist the buildInfo.
|
||||
* It is expected that buildInfo was previously stored.
|
||||
* @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.setProblemReportingEnabled(true);
|
||||
try {
|
||||
scInfo2.store();
|
||||
scInfo2.save();
|
||||
}
|
||||
catch (CoreException e) {
|
||||
}
|
||||
|
|
|
@ -10,12 +10,18 @@
|
|||
***********************************************************************/
|
||||
package org.eclipse.cdt.make.internal.core.scannerconfig.gnu;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.core.IMarkerGenerator;
|
||||
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.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
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);
|
||||
return rc;
|
||||
}
|
||||
if (getUtility() != null) {
|
||||
IPath pFilePath = ((GCCPerFileBOPConsoleParserUtility) getUtility()).getAbsolutePath(filePath);
|
||||
if (fUtil != null) {
|
||||
IPath pFilePath = fUtil.getAbsolutePath(filePath);
|
||||
String longFileName = pFilePath.toString();
|
||||
String shortFileName = pFilePath.removeFileExtension().lastSegment();
|
||||
String genericLine = line.replaceAll(filePath, "LONG_NAME");
|
||||
genericLine = genericLine.replaceAll(shortFileName+"\\.", "SHORT_NAME\\.");
|
||||
// getUtility().addGenericCommandForFile(longFileName, genericLine);
|
||||
// alternative
|
||||
((GCCPerFileBOPConsoleParserUtility) getUtility()).addGenericCommandForFile2(longFileName, genericLine);
|
||||
|
||||
CCommandDSC cmd = fUtil.getNewCCommandDSC(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;
|
||||
}
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
***********************************************************************/
|
||||
package org.eclipse.cdt.make.internal.core.scannerconfig.gnu;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
|
@ -112,7 +110,7 @@ public class GCCPerFileBOPConsoleParserUtility extends AbstractGCCBOPConsolePars
|
|||
return;
|
||||
compiledFileList.add(longFileName);
|
||||
|
||||
CCommandDSC command = getDSCCommand(genericLine);
|
||||
CCommandDSC command = getNewCCommandDSC(genericLine);
|
||||
int index = commandsList2.indexOf(command);
|
||||
if (index == -1) {
|
||||
commandsList2.add(command);
|
||||
|
@ -121,15 +119,15 @@ public class GCCPerFileBOPConsoleParserUtility extends AbstractGCCBOPConsolePars
|
|||
else {
|
||||
command = (CCommandDSC) commandsList2.get(index);
|
||||
}
|
||||
// add a file
|
||||
command.addFile(longFileName);
|
||||
++filesN;
|
||||
// // add a file
|
||||
// command.addFile(longFileName);
|
||||
// ++filesN;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param genericLine
|
||||
*/
|
||||
private CCommandDSC getDSCCommand(String genericLine) {
|
||||
public CCommandDSC getNewCCommandDSC(String genericLine) {
|
||||
CCommandDSC command = new CCommandDSC();
|
||||
String[] tokens = genericLine.split("\\s+");
|
||||
command.addSCOption(new KVPair(SCDOptionsEnum.COMMAND, tokens[0]));
|
||||
|
@ -189,24 +187,32 @@ public class GCCPerFileBOPConsoleParserUtility extends AbstractGCCBOPConsolePars
|
|||
/**
|
||||
*
|
||||
*/
|
||||
void generateReport2() {
|
||||
StringWriter buffer = new StringWriter();
|
||||
PrintWriter writer = new PrintWriter(buffer);
|
||||
for (Iterator i = commandsList2.iterator(); i.hasNext(); ) {
|
||||
CCommandDSC cmd = (CCommandDSC)i.next();
|
||||
writer.println("Stats for generic command: '" + cmd.getCommandAsString() + "' applicable for " +
|
||||
Integer.toString(cmd.getNumberOfFiles()) + " files: ");
|
||||
List filesList = cmd.getFilesList();
|
||||
if (filesList != null) {
|
||||
for (Iterator j = filesList.iterator(); j.hasNext(); ) {
|
||||
writer.println(" " + (String)j.next());
|
||||
}
|
||||
}
|
||||
}
|
||||
writer.close();
|
||||
|
||||
TraceUtil.metricsTrace(buffer.toString());
|
||||
TraceUtil.summaryTrace("Discovery summary", workingDirsN, commandsN, filesN);
|
||||
// void generateReport2() {
|
||||
// StringWriter buffer = new StringWriter();
|
||||
// PrintWriter writer = new PrintWriter(buffer);
|
||||
// for (Iterator i = commandsList2.iterator(); i.hasNext(); ) {
|
||||
// CCommandDSC cmd = (CCommandDSC)i.next();
|
||||
// writer.println("Stats for generic command: '" + cmd.getCommandAsString() + "' applicable for " +
|
||||
// Integer.toString(cmd.getNumberOfFiles()) + " files: ");
|
||||
// List filesList = cmd.getFilesList();
|
||||
// if (filesList != null) {
|
||||
// for (Iterator j = filesList.iterator(); j.hasNext(); ) {
|
||||
// writer.println(" " + (String)j.next());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// writer.close();
|
||||
//
|
||||
// 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
|
||||
*/
|
||||
public class CCommandDSC {
|
||||
|
||||
private final static String SINGLE_SPACE = " "; //$NON-NLS-1$
|
||||
|
||||
private static int ids = 0;
|
||||
private int commandId;
|
||||
private List compilerCommand; // members are KVPair objects
|
||||
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
|
||||
// TODO add discovered scanner config
|
||||
/**
|
||||
|
@ -34,7 +35,7 @@ public class CCommandDSC {
|
|||
public CCommandDSC() {
|
||||
compilerCommand = new ArrayList();
|
||||
discovered = false;
|
||||
files = null;
|
||||
// files = null;
|
||||
cppFileType = false; // assume C file type
|
||||
commandId = ++ids;
|
||||
}
|
||||
|
@ -43,28 +44,48 @@ public class CCommandDSC {
|
|||
compilerCommand.add(option);
|
||||
}
|
||||
|
||||
public void addFile(String fileName) {
|
||||
if (files == null) {
|
||||
files = new ArrayList();
|
||||
}
|
||||
if (!files.contains(fileName)) {
|
||||
files.add(fileName);
|
||||
if (!cppFileType && !fileName.endsWith(".c")) {
|
||||
cppFileType = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public Integer getCommandIdAsInteger() {
|
||||
return new Integer(getCommandId());
|
||||
}
|
||||
/**
|
||||
* @return Returns the commandId.
|
||||
*/
|
||||
public int getCommandId() {
|
||||
return commandId;
|
||||
}
|
||||
/**
|
||||
* @param commandId The commandId to set.
|
||||
*/
|
||||
public void setCommandId(int commandId) {
|
||||
this.commandId = commandId;
|
||||
}
|
||||
|
||||
// public void addFile(String fileName) {
|
||||
// if (files == null) {
|
||||
// files = new ArrayList();
|
||||
// }
|
||||
// if (!files.contains(fileName)) {
|
||||
// files.add(fileName);
|
||||
// if (!cppFileType && !fileName.endsWith(".c")) { //$NON-NLS-1$
|
||||
// cppFileType = true;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
public int getNumberOfFiles() {
|
||||
if (files == null) return 0;
|
||||
return files.size();
|
||||
}
|
||||
// public int getNumberOfFiles() {
|
||||
// if (files == null) return 0;
|
||||
// return files.size();
|
||||
// }
|
||||
|
||||
public String getCommandAsString() {
|
||||
public String toString() {
|
||||
String commandAsString = new String();
|
||||
for (Iterator i = compilerCommand.iterator(); i.hasNext(); ) {
|
||||
KVPair optionPair = (KVPair)i.next();
|
||||
commandAsString += optionPair.getKey().toString() + " " + optionPair.getValue() + " ";
|
||||
commandAsString += optionPair.getKey().toString() + SINGLE_SPACE +
|
||||
optionPair.getValue() + SINGLE_SPACE;
|
||||
}
|
||||
return commandAsString.trim();
|
||||
}
|
||||
|
@ -84,7 +105,8 @@ public class CCommandDSC {
|
|||
if (optionPair.getKey().equals(SCDOptionsEnum.IMACROS_FILE) ||
|
||||
optionPair.getKey().equals(SCDOptionsEnum.INCLUDE_FILE))
|
||||
continue;
|
||||
commandAsString += optionPair.getKey().toString() + " " + optionPair.getValue() + " ";
|
||||
commandAsString += optionPair.getKey().toString() + SINGLE_SPACE +
|
||||
optionPair.getValue() + SINGLE_SPACE;
|
||||
}
|
||||
return commandAsString.trim();
|
||||
}
|
||||
|
@ -111,9 +133,9 @@ public class CCommandDSC {
|
|||
return (String[]) includeFiles.toArray(new String[includeFiles.size()]);
|
||||
}
|
||||
|
||||
public List getFilesList() {
|
||||
return files;
|
||||
}
|
||||
// public List getFilesList() {
|
||||
// return files;
|
||||
// }
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
|
@ -130,4 +152,5 @@ public class CCommandDSC {
|
|||
public int hashCode() {
|
||||
return compilerCommand.hashCode();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,11 +10,19 @@
|
|||
***********************************************************************/
|
||||
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.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2;
|
||||
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.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
|
@ -25,21 +33,109 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
|||
* @author vhirsl
|
||||
*/
|
||||
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() {
|
||||
super();
|
||||
// TODO Auto-generated constructor stub
|
||||
commandIdToFilesMap = new HashMap();
|
||||
fileToCommandIdsMap = new HashMap();
|
||||
commandIdCommandMap = new HashMap();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2#setProject(org.eclipse.core.resources.IProject)
|
||||
*/
|
||||
public void setProject(IProject project) {
|
||||
// TODO Auto-generated method stub
|
||||
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
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -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)
|
||||
* @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.MakeProjectNature;
|
||||
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.IDiscoveredPathManager.IDiscoveredPathInfo;
|
||||
import org.eclipse.cdt.make.internal.core.MakeMessages;
|
||||
|
@ -43,7 +44,7 @@ import org.eclipse.core.runtime.Platform;
|
|||
* @since 3.0
|
||||
* @author vhirsl
|
||||
*/
|
||||
public class PerProjectSICollector implements IScannerInfoCollector2 {
|
||||
public class PerProjectSICollector implements IScannerInfoCollector2, IScannerInfoCollectorUtil {
|
||||
private IProject project;
|
||||
|
||||
private Map discoveredSI;
|
||||
|
@ -390,47 +391,41 @@ public class PerProjectSICollector implements IScannerInfoCollector2 {
|
|||
return sumDiscoveredIncludes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete all discovered paths for the project
|
||||
*
|
||||
* @param project
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil#deleteAllPaths(org.eclipse.core.resources.IResource)
|
||||
*/
|
||||
public void deleteAllPaths(IProject project) {
|
||||
public void deleteAllPaths(IResource resource) {
|
||||
IProject project = resource.getProject();
|
||||
if (project != null && project.equals(this.project)) {
|
||||
sumDiscoveredIncludes.clear();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete all discovered symbols for the project
|
||||
*
|
||||
* @param project
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil#deleteAllSymbols(org.eclipse.core.resources.IResource)
|
||||
*/
|
||||
public void deleteAllSymbols(IProject project) {
|
||||
public void deleteAllSymbols(IResource resource) {
|
||||
IProject project = resource.getProject();
|
||||
if (project != null && project.equals(this.project)) {
|
||||
sumDiscoveredSymbols.clear();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a specific include path
|
||||
*
|
||||
* @param project
|
||||
* @param path
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil#deletePath(org.eclipse.core.resources.IResource, java.lang.String)
|
||||
*/
|
||||
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)) {
|
||||
sumDiscoveredIncludes.remove(path);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a specific symbol definition
|
||||
*
|
||||
* @param project
|
||||
* @param path
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil#deleteSymbol(org.eclipse.core.resources.IResource, java.lang.String)
|
||||
*/
|
||||
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)) {
|
||||
// remove it from the Map of SymbolEntries
|
||||
ScannerConfigUtil.removeSymbolEntryValue(symbol, sumDiscoveredSymbols);
|
||||
|
|
|
@ -18,12 +18,15 @@ import java.util.Map;
|
|||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
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.scannerconfig.IScannerConfigBuilderInfo;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2;
|
||||
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.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.Preferences;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
@ -420,7 +423,6 @@ public class ScannerConfigInfoFactory2 {
|
|||
* @author vhirsl
|
||||
*/
|
||||
private static class BuildProperty extends Store {
|
||||
private static boolean sIsDirty = false;
|
||||
private IProject project;
|
||||
private String profileId;
|
||||
|
||||
|
@ -436,7 +438,8 @@ public class ScannerConfigInfoFactory2 {
|
|||
*/
|
||||
protected void load() {
|
||||
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 {
|
||||
descriptor = CCorePlugin.getDefault().getCProjectDescription(project, false);
|
||||
for (Node sc = descriptor.getProjectData(SCANNER_CONFIG).getFirstChild();
|
||||
|
@ -449,28 +452,82 @@ public class ScannerConfigInfoFactory2 {
|
|||
: profileId;
|
||||
problemReportingEnabled = Boolean.valueOf(
|
||||
((Element)sc).getAttribute(PROBLEM_REPORTING_ENABLED)).booleanValue();
|
||||
++loaded;
|
||||
}
|
||||
else if (sc.getNodeName().equals(PROFILE)) {
|
||||
//if (selectedProfile.equals(((Element)sc).getAttribute(ID))) {
|
||||
load(sc);
|
||||
++loaded;
|
||||
loadedProfiles.add(((Element)sc).getAttribute(ID));
|
||||
//}
|
||||
}
|
||||
}
|
||||
if (loaded < 2) {
|
||||
if (loadedProfiles.size() < 1) {
|
||||
// No ScannerConfigDiscovery entry, try old project location - .project
|
||||
if (!migrateScannerConfigBuildInfo(ScannerConfigProfileManager.PER_PROJECT_PROFILE_ID)) {
|
||||
// disable autodiscovery
|
||||
autoDiscoveryEnabled = false;
|
||||
if (migrateScannerConfigBuildInfo(ScannerConfigProfileManager.PER_PROJECT_PROFILE_ID)) {
|
||||
loadedProfiles.add(ScannerConfigProfileManager.PER_PROJECT_PROFILE_ID);
|
||||
}
|
||||
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) {
|
||||
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
|
||||
*/
|
||||
private boolean migrateScannerConfigBuildInfo(String profileId) {
|
||||
|
@ -506,7 +563,6 @@ public class ScannerConfigInfoFactory2 {
|
|||
|
||||
// store migrated data
|
||||
isDirty = true;
|
||||
store();
|
||||
save();
|
||||
}
|
||||
catch (CoreException e) {
|
||||
|
@ -591,41 +647,37 @@ public class ScannerConfigInfoFactory2 {
|
|||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigInfoFactory2.Store#store()
|
||||
*/
|
||||
public void store() throws CoreException {
|
||||
private boolean store() throws CoreException {
|
||||
if (isDirty) {
|
||||
synchronized (BuildProperty.class) {
|
||||
ICDescriptor descriptor = CCorePlugin.getDefault().getCProjectDescription(project, true);
|
||||
Element sc = descriptor.getProjectData(SCANNER_CONFIG);
|
||||
Document doc = sc.getOwnerDocument();
|
||||
|
||||
// Clear out all current children
|
||||
Node child = sc.getFirstChild();
|
||||
while (child != null) {
|
||||
sc.removeChild(child);
|
||||
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;
|
||||
ICDescriptor descriptor = CCorePlugin.getDefault().getCProjectDescription(project, true);
|
||||
Element sc = descriptor.getProjectData(SCANNER_CONFIG);
|
||||
Document doc = sc.getOwnerDocument();
|
||||
|
||||
// Clear out all current children
|
||||
Node child = sc.getFirstChild();
|
||||
while (child != null) {
|
||||
sc.removeChild(child);
|
||||
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;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -691,13 +743,17 @@ public class ScannerConfigInfoFactory2 {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#save()
|
||||
*/
|
||||
public void save() throws CoreException {
|
||||
synchronized (BuildProperty.class) {
|
||||
if (sIsDirty) {
|
||||
ICDescriptor descriptor = CCorePlugin.getDefault().getCProjectDescription(project, true);
|
||||
descriptor.saveProjectData();
|
||||
sIsDirty = false;
|
||||
}
|
||||
public synchronized void save() throws CoreException {
|
||||
if (store()) {
|
||||
ICDescriptorOperation op = new ICDescriptorOperation() {
|
||||
|
||||
public void execute(ICDescriptor descriptor, IProgressMonitor monitor) throws CoreException {
|
||||
descriptor.saveProjectData();
|
||||
}
|
||||
|
||||
};
|
||||
CCorePlugin.getDefault().getCDescriptorManager().
|
||||
runDescriptorOperation(project, op, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -785,10 +841,7 @@ public class ScannerConfigInfoFactory2 {
|
|||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigInfoFactory2.Store#store()
|
||||
*/
|
||||
public void store() {
|
||||
private void store() {
|
||||
if (isDirty) {
|
||||
set(SCANNER_CONFIG_AUTODISCOVERY_ENABLED, autoDiscoveryEnabled);
|
||||
set(SCANNER_CONFIG_SELECTED_PROFILE_ID, selectedProfile);
|
||||
|
@ -871,7 +924,7 @@ public class ScannerConfigInfoFactory2 {
|
|||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#save()
|
||||
*/
|
||||
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
|
||||
|
||||
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"
|
||||
name="%GCCPerProjectProfile.name"
|
||||
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>
|
||||
|
|
|
@ -215,31 +215,13 @@ ManageDefinedSymbolsDialog.userGroup.title=User specified symbol definitions
|
|||
ManageDefinedSymbolsDialog.discoveredGroup.title=Discovered symbol definitions
|
||||
|
||||
# --- 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.description=Set the scanner configuration discovery options for this project
|
||||
ScannerConfigOptionsDialog.scGroup.label=Automated 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.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.open.label=Load build output from file
|
||||
ScannerConfigOptionsDialog.boProvider.browse.button=Browse...
|
||||
|
|
|
@ -16,12 +16,18 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
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.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.IConfigurationElement;
|
||||
import org.eclipse.core.runtime.IExtensionPoint;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.core.runtime.Preferences;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
|
||||
|
@ -30,13 +36,47 @@ import org.eclipse.swt.widgets.Composite;
|
|||
*
|
||||
* @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;
|
||||
|
||||
// Composite parent provided by the block.
|
||||
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
|
||||
*
|
||||
|
@ -44,16 +84,16 @@ public abstract class AbstractDiscoveryOptionsBlock extends AbstractDiscoveryPag
|
|||
*/
|
||||
protected static class DiscoveryProfilePageConfiguration {
|
||||
|
||||
ICOptionPage page;
|
||||
AbstractDiscoveryPage page;
|
||||
IConfigurationElement fElement;
|
||||
|
||||
public DiscoveryProfilePageConfiguration(IConfigurationElement element) {
|
||||
fElement = element;
|
||||
}
|
||||
|
||||
public ICOptionPage getPage() throws CoreException {
|
||||
public AbstractDiscoveryPage getPage() throws CoreException {
|
||||
if (page == null) {
|
||||
page = (ICOptionPage) fElement.createExecutableExtension("class"); //$NON-NLS-1$
|
||||
page = (AbstractDiscoveryPage) fElement.createExecutableExtension("class"); //$NON-NLS-1$
|
||||
}
|
||||
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() {
|
||||
return fCompositeParent;
|
||||
}
|
||||
|
||||
protected void setCompositeParent(Composite parent) {
|
||||
fCompositeParent = parent;
|
||||
// fCompositeParent.setLayout(new TabFolderLayout());
|
||||
fCompositeParent.setLayout(new TabFolderLayout());
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -122,31 +222,32 @@ public abstract class AbstractDiscoveryOptionsBlock extends AbstractDiscoveryPag
|
|||
return;
|
||||
}
|
||||
String profileId = getCurrentProfileId();
|
||||
ICOptionPage page = getDiscoveryProfilePage(profileId);
|
||||
AbstractDiscoveryPage page = getDiscoveryProfilePage(profileId);
|
||||
if (page != null) {
|
||||
if (page.getControl() == null) {
|
||||
Composite parent = getCompositeParent();
|
||||
page.setContainer(getContainer());
|
||||
page.setContainer(this);
|
||||
page.createControl(parent);
|
||||
parent.layout(true);
|
||||
} else {
|
||||
page.setVisible(false);
|
||||
}
|
||||
if (fCurrentPage != null) {
|
||||
fCurrentPage.setVisible(false);
|
||||
}
|
||||
page.setVisible(true);
|
||||
}
|
||||
setCurrentPage(page);
|
||||
}
|
||||
|
||||
protected ICOptionPage getCurrentPage() {
|
||||
protected AbstractDiscoveryPage getCurrentPage() {
|
||||
return fCurrentPage;
|
||||
}
|
||||
|
||||
protected void setCurrentPage(ICOptionPage page) {
|
||||
protected void setCurrentPage(AbstractDiscoveryPage page) {
|
||||
fCurrentPage = page;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.ui.dialogs.ICOptionPage#isValid()
|
||||
* @see org.eclipse.cdt.ui.dialogs.AbstractDiscoveryPage#isValid()
|
||||
*/
|
||||
public boolean isValid() {
|
||||
return (getCurrentPage() == null) ? true : getCurrentPage().isValid();
|
||||
|
@ -159,7 +260,7 @@ public abstract class AbstractDiscoveryOptionsBlock extends AbstractDiscoveryPag
|
|||
return getCurrentPage().getErrorMessage();
|
||||
}
|
||||
|
||||
protected ICOptionPage getDiscoveryProfilePage(String profileId) {
|
||||
protected AbstractDiscoveryPage getDiscoveryProfilePage(String profileId) {
|
||||
DiscoveryProfilePageConfiguration configElement =
|
||||
(DiscoveryProfilePageConfiguration) fProfilePageMap.get(profileId);
|
||||
if (configElement != null) {
|
||||
|
@ -196,4 +297,5 @@ public abstract class AbstractDiscoveryOptionsBlock extends AbstractDiscoveryPag
|
|||
}
|
||||
|
||||
protected abstract String getCurrentProfileId();
|
||||
|
||||
}
|
||||
|
|
|
@ -10,14 +10,8 @@
|
|||
***********************************************************************/
|
||||
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.internal.core.scannerconfig2.ScannerConfigProfileManager;
|
||||
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.dialogs.DialogPage;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
|
||||
/**
|
||||
|
@ -25,12 +19,24 @@ import org.eclipse.jface.resource.ImageDescriptor;
|
|||
*
|
||||
* @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;
|
||||
private IScannerConfigBuilderInfo2 fBuildInfo;
|
||||
private boolean fInitialized = false;
|
||||
protected AbstractDiscoveryOptionsBlock fContainer;
|
||||
|
||||
/**
|
||||
* @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);
|
||||
}
|
||||
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.ui.dialogs.ICOptionPage#setContainer(org.eclipse.cdt.ui.dialogs.ICOptionContainer)
|
||||
*/
|
||||
public void setContainer(ICOptionContainer container) {
|
||||
super.setContainer(container);
|
||||
protected abstract boolean isValid();
|
||||
protected abstract void populateBuildInfo(IScannerConfigBuilderInfo2 buildInfo);
|
||||
protected abstract void restoreFromBuildinfo(IScannerConfigBuilderInfo2 buildInfo);
|
||||
|
||||
public void performApply() {
|
||||
IScannerConfigBuilderInfo2 buildInfo = getContainer().getBuildInfo();
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create build info based on project properties
|
||||
* @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;
|
||||
populateBuildInfo(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;
|
||||
public void performDefaults() {
|
||||
IScannerConfigBuilderInfo2 buildInfo = getContainer().getBuildInfo();
|
||||
|
||||
restoreFromBuildinfo(buildInfo);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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.TreeListDialogField;
|
||||
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.internal.core.scannerconfig.DiscoveredPathContainer;
|
||||
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.scannerconfig2.PerProjectSICollector;
|
||||
import org.eclipse.cdt.make.internal.core.scannerconfig2.SCProfileInstance;
|
||||
import org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigProfileManager;
|
||||
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
|
||||
|
@ -558,57 +559,59 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr
|
|||
|
||||
private boolean deleteEntry() {
|
||||
boolean rc = false;
|
||||
List newSelection = new ArrayList();
|
||||
List selElements = fDiscoveredContainerList.getSelectedElements();
|
||||
for (int i = 0; i < selElements.size(); ++i) {
|
||||
DiscoveredElement elem = (DiscoveredElement) selElements.get(i);
|
||||
if (elem.getEntryKind() != DiscoveredElement.CONTAINER) {
|
||||
DiscoveredElement parent = elem.getParent();
|
||||
if (parent != null) {
|
||||
Object[] children = parent.getChildren();
|
||||
if (elem.delete()) {
|
||||
// ScannerInfoCollector collector = ScannerInfoCollector.getInstance();
|
||||
IProject project = fCProject.getProject();
|
||||
SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance().
|
||||
getSCProfileInstance(project, ScannerConfigProfileManager.NULL_PROFILE_ID); // use selected profile for the project
|
||||
PerProjectSICollector collector = (PerProjectSICollector) profileInstance.getScannerInfoCollector();
|
||||
switch (elem.getEntryKind()) {
|
||||
case DiscoveredElement.PATHS_GROUP:
|
||||
collector.deleteAllPaths(project);
|
||||
break;
|
||||
case DiscoveredElement.SYMBOLS_GROUP:
|
||||
collector.deleteAllSymbols(project);
|
||||
break;
|
||||
case DiscoveredElement.INCLUDE_PATH:
|
||||
collector.deletePath(project, elem.getEntry());
|
||||
break;
|
||||
case DiscoveredElement.SYMBOL_DEFINITION:
|
||||
collector.deleteSymbol(project, elem.getEntry());
|
||||
break;
|
||||
}
|
||||
rc = true;
|
||||
// set new selection
|
||||
for (int j = 0; j < children.length; ++j) {
|
||||
DiscoveredElement child = (DiscoveredElement) children[j];
|
||||
if (elem.equals(child)) {
|
||||
newSelection.clear();
|
||||
if (j + 1 < children.length) {
|
||||
newSelection.add(children[j + 1]);
|
||||
}
|
||||
else if (j - 1 >= 0) {
|
||||
newSelection.add(children[j - 1]);
|
||||
}
|
||||
else {
|
||||
newSelection.add(parent);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fDiscoveredContainerList.postSetSelection(new StructuredSelection(newSelection));
|
||||
IProject project = fCProject.getProject();
|
||||
SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance().
|
||||
getSCProfileInstance(project, ScannerConfigProfileManager.NULL_PROFILE_ID); // use selected profile for the project
|
||||
IScannerInfoCollector collector = profileInstance.getScannerInfoCollector();
|
||||
if (collector instanceof IScannerInfoCollectorUtil) {
|
||||
IScannerInfoCollectorUtil collectorUtil = (IScannerInfoCollectorUtil) collector;
|
||||
List newSelection = new ArrayList();
|
||||
List selElements = fDiscoveredContainerList.getSelectedElements();
|
||||
for (int i = 0; i < selElements.size(); ++i) {
|
||||
DiscoveredElement elem = (DiscoveredElement) selElements.get(i);
|
||||
if (elem.getEntryKind() != DiscoveredElement.CONTAINER) {
|
||||
DiscoveredElement parent = elem.getParent();
|
||||
if (parent != null) {
|
||||
Object[] children = parent.getChildren();
|
||||
if (elem.delete()) {
|
||||
switch (elem.getEntryKind()) {
|
||||
case DiscoveredElement.PATHS_GROUP:
|
||||
collectorUtil.deleteAllPaths(project);
|
||||
break;
|
||||
case DiscoveredElement.SYMBOLS_GROUP:
|
||||
collectorUtil.deleteAllSymbols(project);
|
||||
break;
|
||||
case DiscoveredElement.INCLUDE_PATH:
|
||||
collectorUtil.deletePath(project, elem.getEntry());
|
||||
break;
|
||||
case DiscoveredElement.SYMBOL_DEFINITION:
|
||||
collectorUtil.deleteSymbol(project, elem.getEntry());
|
||||
break;
|
||||
}
|
||||
rc = true;
|
||||
// set new selection
|
||||
for (int j = 0; j < children.length; ++j) {
|
||||
DiscoveredElement child = (DiscoveredElement) children[j];
|
||||
if (elem.equals(child)) {
|
||||
newSelection.clear();
|
||||
if (j + 1 < children.length) {
|
||||
newSelection.add(children[j + 1]);
|
||||
}
|
||||
else if (j - 1 >= 0) {
|
||||
newSelection.add(children[j - 1]);
|
||||
}
|
||||
else {
|
||||
newSelection.add(parent);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fDiscoveredContainerList.postSetSelection(new StructuredSelection(newSelection));
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,9 +15,6 @@ import java.util.Arrays;
|
|||
import java.util.Iterator;
|
||||
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.CoreModel;
|
||||
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.internal.core.scannerconfig.DiscoveredPathContainer;
|
||||
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.ui.dialogs.ICOptionContainer;
|
||||
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
|
||||
|
@ -120,16 +118,13 @@ public class DiscoveryOptionsBlock extends AbstractDiscoveryOptionsBlock {
|
|||
// Create a group for scanner config discovery
|
||||
if (createScannerConfigControls(scComp, tabColumns)) {
|
||||
// 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()).marginWidth = 5;
|
||||
// ((GridLayout)profileComp.getLayout()).verticalSpacing = 5;
|
||||
profileComp.setFont(font);
|
||||
GridData gd = (GridData) profileComp.getLayoutData();
|
||||
gd.grabExcessHorizontalSpace = true;
|
||||
// gd.grabExcessVerticalSpace = true;
|
||||
gd.horizontalAlignment = GridData.FILL;
|
||||
gd.verticalAlignment = GridData.FILL;
|
||||
profileComp.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
|
||||
profileComp.setLayout(new TabFolderLayout());
|
||||
|
||||
// Must set the composite parent to super class.
|
||||
setCompositeParent(profileComp);
|
||||
|
@ -196,7 +191,12 @@ public class DiscoveryOptionsBlock extends AbstractDiscoveryOptionsBlock {
|
|||
((GridData)label.getLayoutData()).grabExcessHorizontalSpace = false;
|
||||
|
||||
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
|
||||
for (Iterator items = getDiscoveryProfileIdList().iterator(); items.hasNext();) {
|
||||
String profileId = (String)items.next();
|
||||
|
@ -252,33 +252,21 @@ public class DiscoveryOptionsBlock extends AbstractDiscoveryOptionsBlock {
|
|||
// init buildInfo
|
||||
final IProject project = getContainer().getProject();
|
||||
// Create new build info in case of new C++ project wizard
|
||||
final IScannerConfigBuilderInfo2 buildInfo = createBuildInfo(project);
|
||||
createBuildInfo();
|
||||
|
||||
if (buildInfo != null) {
|
||||
populateBuildInfo(buildInfo);
|
||||
buildInfo.store();
|
||||
if (getBuildInfo() != null) {
|
||||
populateBuildInfo(getBuildInfo());
|
||||
monitor.worked(1);
|
||||
|
||||
if (scEnabledButton.getSelection()) {
|
||||
getCurrentPage().performApply(monitor);
|
||||
getCurrentPage().performApply();
|
||||
}
|
||||
monitor.worked(1);
|
||||
|
||||
if (project != null) {
|
||||
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();
|
||||
}
|
||||
|
@ -321,10 +309,12 @@ public class DiscoveryOptionsBlock extends AbstractDiscoveryOptionsBlock {
|
|||
}
|
||||
|
||||
private void populateBuildInfo(IScannerConfigBuilderInfo2 buildInfo) {
|
||||
buildInfo.setAutoDiscoveryEnabled(scEnabledButton.getSelection());
|
||||
String profileName = profileComboBox.getItem(profileComboBox.getSelectionIndex());
|
||||
buildInfo.setSelectedProfileId(getDiscoveryProfileId(profileName));
|
||||
buildInfo.setProblemReportingEnabled(scProblemReportingEnabledButton.getSelection());
|
||||
if (buildInfo != null) {
|
||||
buildInfo.setAutoDiscoveryEnabled(scEnabledButton.getSelection());
|
||||
String profileName = profileComboBox.getItem(profileComboBox.getSelectionIndex());
|
||||
buildInfo.setSelectedProfileId(getDiscoveryProfileId(profileName));
|
||||
buildInfo.setProblemReportingEnabled(scProblemReportingEnabledButton.getSelection());
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -336,19 +326,23 @@ public class DiscoveryOptionsBlock extends AbstractDiscoveryOptionsBlock {
|
|||
// Missing builder info on a non-legacy project
|
||||
return;
|
||||
}
|
||||
IScannerConfigBuilderInfo2 buildInfo = createBuildInfo();
|
||||
createDefaultBuildInfo();
|
||||
|
||||
restoreFromBuildinfo(buildInfo);
|
||||
restoreFromBuildinfo(getBuildInfo());
|
||||
enableAllControls();
|
||||
|
||||
getCurrentPage().performDefaults();
|
||||
|
||||
handleDiscoveryProfileChanged();
|
||||
}
|
||||
|
||||
private void restoreFromBuildinfo(IScannerConfigBuilderInfo2 buildInfo) {
|
||||
scEnabledButton.setSelection(buildInfo.isAutoDiscoveryEnabled());
|
||||
String profileId = buildInfo.getSelectedProfileId();
|
||||
profileComboBox.setText(getDiscoveryProfileName(profileId));
|
||||
scProblemReportingEnabledButton.setSelection(buildInfo.isProblemReportingEnabled());
|
||||
if (buildInfo != null) {
|
||||
scEnabledButton.setSelection(buildInfo.isAutoDiscoveryEnabled());
|
||||
String profileId = buildInfo.getSelectedProfileId();
|
||||
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.utils.ui.controls.ControlFactory;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
|
@ -41,15 +39,13 @@ import org.eclipse.swt.widgets.Shell;
|
|||
import org.eclipse.swt.widgets.Text;
|
||||
|
||||
/**
|
||||
* SCD profile property/preference page
|
||||
* SCD per project profile property/preference page
|
||||
*
|
||||
* @author vhirsl
|
||||
*/
|
||||
public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
|
||||
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_OPEN_LABEL = PREFIX + ".boProvider.open.label"; //$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)
|
||||
*/
|
||||
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(parent,
|
||||
MakeUIPlugin.getResourceString(BO_PROVIDER_GROUP_LABEL), 3);
|
||||
Group profileGroup = ControlFactory.createGroup(page,
|
||||
MakeUIPlugin.getResourceString(PROFILE_GROUP_LABEL), 3);
|
||||
|
||||
GridData gd = (GridData) profileGroup.getLayoutData();
|
||||
gd.grabExcessHorizontalSpace = true;
|
||||
gd.horizontalAlignment = GridData.FILL;
|
||||
// PixelConverter converter = new PixelConverter(parent);
|
||||
// gd.heightHint = converter.convertHorizontalDLUsToPixels(DEFAULT_HEIGHT);
|
||||
// gd.heightHint = converter.convertVerticalDLUsToPixels(DEFAULT_HEIGHT);
|
||||
((GridLayout) profileGroup.getLayout()).makeColumnsEqualWidth = false;
|
||||
|
||||
// Add bop enabled checkbox
|
||||
|
@ -135,7 +135,7 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
|
|||
private void handleBOPBrowseButtonSelected() {
|
||||
FileDialog dialog = new FileDialog(getShell(), SWT.NONE);
|
||||
dialog.setText(MakeUIPlugin.getResourceString(BO_PROVIDER_OPEN_FILE_DIALOG)); //$NON-NLS-1$
|
||||
String fileName = bopOpenFileText.getText().trim();
|
||||
String fileName = getBopOpenFileText();
|
||||
IPath filterPath;
|
||||
if (fileName.length() == 0 && getContainer().getProject() != null) {
|
||||
filterPath = getContainer().getProject().getLocation();
|
||||
|
@ -149,7 +149,7 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
|
|||
if (res == null) {
|
||||
return;
|
||||
}
|
||||
bopOpenFileText.setText(res);
|
||||
setBopOpenFileText(res);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -227,8 +227,7 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
setControl(parent);
|
||||
setControl(page);
|
||||
// set the shell variable; must be after setControl
|
||||
//lock.acquire();
|
||||
synchronized (lock) {
|
||||
|
@ -239,19 +238,13 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
|
|||
initializeValues();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected void handleModifyOpenFileText() {
|
||||
String fileName = bopOpenFileText.getText().trim();
|
||||
String fileName = getBopOpenFileText();
|
||||
bopLoadButton.setEnabled(bopEnabledButton.getSelection() &&
|
||||
fileName.length() > 0 &&
|
||||
new File(fileName).exists());
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected void handleModifyRunCommandText() {
|
||||
String cmd = sipRunCommandText.getText().trim();
|
||||
isValid = (cmd.length() > 0) ? true : false;
|
||||
|
@ -259,14 +252,45 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
|
|||
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() {
|
||||
bopEnabledButton.setSelection(getBuildInfo().isBuildOutputParserEnabled());
|
||||
bopOpenFileText.setText(getBuildInfo().getBuildOutputFilePath());
|
||||
sipEnabledButton.setSelection(getBuildInfo().isProviderOutputParserEnabled(providerId));
|
||||
sipRunCommandText.setText(getBuildInfo().getProviderRunCommand(providerId));
|
||||
bopEnabledButton.setSelection(getContainer().getBuildInfo().isBuildOutputParserEnabled());
|
||||
setBopOpenFileText(getContainer().getBuildInfo().getBuildOutputFilePath());
|
||||
sipEnabledButton.setSelection(getContainer().getBuildInfo().isProviderOutputParserEnabled(providerId));
|
||||
sipRunCommandText.setText(getContainer().getBuildInfo().getProviderRunCommand(providerId));
|
||||
}
|
||||
|
||||
private void handleBOPLoadFileButtonSelected() {
|
||||
|
@ -274,9 +298,9 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
|
|||
bopLoadButton.setEnabled(false);
|
||||
|
||||
// populate buildInfo to be used by the reader job
|
||||
populateBuildInfo(getBuildInfo(), null);
|
||||
populateBuildInfo(getContainer().getBuildInfo());
|
||||
IProject project = getContainer().getProject();
|
||||
Job readerJob = new BuildOutputReaderJob(project, getBuildInfo());
|
||||
Job readerJob = new BuildOutputReaderJob(project, getContainer().getBuildInfo());
|
||||
readerJob.setPriority(Job.LONG);
|
||||
readerJob.addJobChangeListener(new JobChangeAdapter() {
|
||||
|
||||
|
@ -321,44 +345,30 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
|
|||
}
|
||||
|
||||
/* (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 {
|
||||
IProject project = getContainer().getProject();
|
||||
// Create new build info in case of new C++ project wizard
|
||||
IScannerConfigBuilderInfo2 buildInfo = createBuildInfo(project);
|
||||
|
||||
protected void populateBuildInfo(IScannerConfigBuilderInfo2 buildInfo) {
|
||||
if (buildInfo != null) {
|
||||
populateBuildInfo(buildInfo, monitor);
|
||||
buildInfo.store();
|
||||
buildInfo.setBuildOutputFileActionEnabled(true);
|
||||
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)
|
||||
* @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() {
|
||||
// Create buildInfo with defaults
|
||||
IScannerConfigBuilderInfo2 buildInfo = createBuildInfo();
|
||||
|
||||
restoreFromBuildinfo(buildInfo);
|
||||
}
|
||||
|
||||
private void restoreFromBuildinfo(IScannerConfigBuilderInfo2 buildInfo) {
|
||||
bopOpenFileText.setText(buildInfo.getBuildOutputFilePath());
|
||||
bopEnabledButton.setSelection(buildInfo.isBuildOutputParserEnabled());
|
||||
|
||||
sipEnabledButton.setSelection(buildInfo.isProviderOutputParserEnabled(providerId));
|
||||
sipRunCommandText.setText(buildInfo.getProviderRunCommand(providerId));
|
||||
protected void restoreFromBuildinfo(IScannerConfigBuilderInfo2 buildInfo) {
|
||||
if (buildInfo != null) {
|
||||
setBopOpenFileText(buildInfo.getBuildOutputFilePath());
|
||||
bopEnabledButton.setSelection(buildInfo.isBuildOutputParserEnabled());
|
||||
|
||||
sipEnabledButton.setSelection(buildInfo.isProviderOutputParserEnabled(providerId));
|
||||
sipRunCommandText.setText(buildInfo.getProviderRunCommand(providerId));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue