mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 18:26:01 +02:00
patch from Vmir -
This patch contains fixes for following problems: - PR 64014: [Scanner Config] Path discovery should be on by default, - PR 63971: [Scanner Config] Debugging messages on console, - PR 62742: CDT-specific file changes to .project are not saved - Scanner config portion - Target specific options are applicable only to default generate scanner info command (and not to custom commands), - Discovered scanner info file name associated with project instead with project name (problem when deleting a project, then creating a new one with the same name or renaming a project).
This commit is contained in:
parent
67cd9ad95c
commit
e5c605c11d
9 changed files with 128 additions and 47 deletions
|
@ -127,7 +127,7 @@ public class MakeCorePlugin extends Plugin {
|
||||||
// default plugin preferences for scanner configuration discovery
|
// default plugin preferences for scanner configuration discovery
|
||||||
IScannerConfigBuilderInfo scInfo = createScannerConfigBuildInfo(getPluginPreferences(), ScannerConfigBuilder.BUILDER_ID, true);
|
IScannerConfigBuilderInfo scInfo = createScannerConfigBuildInfo(getPluginPreferences(), ScannerConfigBuilder.BUILDER_ID, true);
|
||||||
try {
|
try {
|
||||||
scInfo.setAutoDiscoveryEnabled(false);
|
scInfo.setAutoDiscoveryEnabled(true);
|
||||||
scInfo.setMakeBuilderConsoleParserEnabled(true);
|
scInfo.setMakeBuilderConsoleParserEnabled(true);
|
||||||
scInfo.setESIProviderCommandEnabled(true);
|
scInfo.setESIProviderCommandEnabled(true);
|
||||||
scInfo.setUseDefaultESIProviderCmd(true);
|
scInfo.setUseDefaultESIProviderCmd(true);
|
||||||
|
|
|
@ -112,13 +112,12 @@ public class ScannerConfigNature implements IProjectNature {
|
||||||
/**
|
/**
|
||||||
* Returns build command as stored in .project file
|
* Returns build command as stored in .project file
|
||||||
*
|
*
|
||||||
* @param project
|
* @param description
|
||||||
* @param builderID
|
* @param builderID
|
||||||
* @return ICommand
|
* @return ICommand
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
public static ICommand getBuildSpec(IProject project, String builderID) throws CoreException {
|
public static ICommand getBuildSpec(IProjectDescription description, String builderID) throws CoreException {
|
||||||
IProjectDescription description = project.getDescription();
|
|
||||||
ICommand[] commands = description.getBuildSpec();
|
ICommand[] commands = description.getBuildSpec();
|
||||||
for (int i = 0; i < commands.length; ++i) {
|
for (int i = 0; i < commands.length; ++i) {
|
||||||
if (commands[i].getBuilderName().equals(builderID)) {
|
if (commands[i].getBuilderName().equals(builderID)) {
|
||||||
|
@ -128,4 +127,37 @@ public class ScannerConfigNature implements IProjectNature {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stores a build command in .project file
|
||||||
|
*
|
||||||
|
* @param description
|
||||||
|
* @param newCommand
|
||||||
|
* @return IProjecDescription
|
||||||
|
* @throws CoreException
|
||||||
|
*/
|
||||||
|
public static IProjectDescription setBuildSpec(IProjectDescription description, ICommand newCommand) throws CoreException {
|
||||||
|
ICommand[] oldCommands = description.getBuildSpec();
|
||||||
|
ICommand oldCommand = getBuildSpec(description, newCommand.getBuilderName());
|
||||||
|
ICommand[] newCommands;
|
||||||
|
|
||||||
|
if (oldCommand == null) {
|
||||||
|
// Add the build spec at the end
|
||||||
|
newCommands = new ICommand[oldCommands.length + 1];
|
||||||
|
System.arraycopy(oldCommands, 0, newCommands, 0, oldCommands.length);
|
||||||
|
newCommands[oldCommands.length] = newCommand;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for (int i = 0; i < oldCommands.length; i++) {
|
||||||
|
if (oldCommands[i] == oldCommand) {
|
||||||
|
oldCommands[i] = newCommand;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
newCommands = oldCommands;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Commit the spec change into the project
|
||||||
|
description.setBuildSpec(newCommands);
|
||||||
|
return description;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,8 @@ ExternalScannerInfoProvider.Creating_Markers=Generating markers ...
|
||||||
ScannerInfoCollector.Processing=Processing discovered scanner configuration ...
|
ScannerInfoCollector.Processing=Processing discovered scanner configuration ...
|
||||||
ScannerInfoCollector.Updating=Updating Scanner Configuration for project
|
ScannerInfoCollector.Updating=Updating Scanner Configuration for project
|
||||||
|
|
||||||
|
DiscoveredPathManager.File_Error_Message=Error accessing scanner config file for project
|
||||||
|
|
||||||
GCCScannerConfigUtil.Error_Message=Error creating specs file
|
GCCScannerConfigUtil.Error_Message=Error creating specs file
|
||||||
|
|
||||||
DiscoveredContainer.description=Discovered Paths
|
DiscoveredContainer.description=Discovered Paths
|
|
@ -68,7 +68,7 @@ public class DefaultExternalScannerInfoProvider implements IExternalScannerInfoP
|
||||||
if (targetSpecificOptions == null) {
|
if (targetSpecificOptions == null) {
|
||||||
targetSpecificOptions = new ArrayList();
|
targetSpecificOptions = new ArrayList();
|
||||||
}
|
}
|
||||||
if (!initialize(currentProject, buildInfo, targetSpecificOptions)) {
|
if (!initialize(currentProject, buildInfo)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (monitor == null) {
|
if (monitor == null) {
|
||||||
|
@ -90,7 +90,11 @@ public class DefaultExternalScannerInfoProvider implements IExternalScannerInfoP
|
||||||
launcher.showCommand(true);
|
launcher.showCommand(true);
|
||||||
|
|
||||||
// add file and TSO
|
// add file and TSO
|
||||||
String[] compileArguments = prepareArguments(targetSpecificOptions);
|
String[] compileArguments = fCompileArguments;
|
||||||
|
if (buildInfo.isDefaultESIProviderCmd()) {
|
||||||
|
// consider TSO only if default command
|
||||||
|
compileArguments = prepareArguments(targetSpecificOptions);
|
||||||
|
}
|
||||||
|
|
||||||
String ca = coligate(compileArguments);
|
String ca = coligate(compileArguments);
|
||||||
|
|
||||||
|
@ -140,10 +144,9 @@ public class DefaultExternalScannerInfoProvider implements IExternalScannerInfoP
|
||||||
/**
|
/**
|
||||||
* @param currentProject
|
* @param currentProject
|
||||||
* @param buildInfo
|
* @param buildInfo
|
||||||
* @param targetSpecificOptions
|
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
private boolean initialize(IProject currentProject, IScannerConfigBuilderInfo buildInfo, List targetSpecificOptions) {
|
private boolean initialize(IProject currentProject, IScannerConfigBuilderInfo buildInfo) {
|
||||||
boolean rc = false;
|
boolean rc = false;
|
||||||
|
|
||||||
fWorkingDirectory = currentProject.getLocation();
|
fWorkingDirectory = currentProject.getLocation();
|
||||||
|
|
|
@ -85,11 +85,7 @@ public class DiscoveredPathManager implements IDiscoveredPathManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeDiscoveredInfo(IProject project) {
|
public void removeDiscoveredInfo(IProject project) {
|
||||||
IPath path = MakeCorePlugin.getWorkingDirectory();
|
ScannerConfigUtil.getDiscoveredScannerConfigStore(project, true);
|
||||||
path = path.append(project.getName() + ".sc"); //$NON-NLS-1$
|
|
||||||
if (path.toFile().exists()) {
|
|
||||||
path.toFile().delete();
|
|
||||||
}
|
|
||||||
DiscoveredPathInfo info = (DiscoveredPathInfo)fDiscoveredMap.remove(project);
|
DiscoveredPathInfo info = (DiscoveredPathInfo)fDiscoveredMap.remove(project);
|
||||||
fireUpdate(INFO_REMOVED, info);
|
fireUpdate(INFO_REMOVED, info);
|
||||||
}
|
}
|
||||||
|
@ -104,8 +100,7 @@ public class DiscoveredPathManager implements IDiscoveredPathManager {
|
||||||
private void loadDiscoveredScannerInfoFromState(IProject project, LinkedHashMap includes, LinkedHashMap symbols)
|
private void loadDiscoveredScannerInfoFromState(IProject project, LinkedHashMap includes, LinkedHashMap symbols)
|
||||||
throws CoreException {
|
throws CoreException {
|
||||||
// Save the document
|
// Save the document
|
||||||
IPath path = MakeCorePlugin.getWorkingDirectory();
|
IPath path = ScannerConfigUtil.getDiscoveredScannerConfigStore(project, false);
|
||||||
path = path.append(project.getName() + ".sc"); //$NON-NLS-1$
|
|
||||||
if (path.toFile().exists()) {
|
if (path.toFile().exists()) {
|
||||||
try {
|
try {
|
||||||
FileInputStream file = new FileInputStream(path.toFile());
|
FileInputStream file = new FileInputStream(path.toFile());
|
||||||
|
@ -118,15 +113,15 @@ public class DiscoveredPathManager implements IDiscoveredPathManager {
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1,
|
throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1,
|
||||||
MakeMessages.getString("GCCScannerConfigUtil.Error_Message"), e)); //$NON-NLS-1$
|
MakeMessages.getString("DiscoveredPathManager.File_Error_Message"), e)); //$NON-NLS-1$
|
||||||
} catch (ParserConfigurationException e) {
|
} catch (ParserConfigurationException e) {
|
||||||
MakeCorePlugin.log(e);
|
MakeCorePlugin.log(e);
|
||||||
throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1,
|
throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1,
|
||||||
MakeMessages.getString("GCCScannerConfigUtil.Error_Message"), e)); //$NON-NLS-1$
|
MakeMessages.getString("DiscoveredPathManager.File_Error_Message"), e)); //$NON-NLS-1$
|
||||||
} catch (SAXException e) {
|
} catch (SAXException e) {
|
||||||
MakeCorePlugin.log(e);
|
MakeCorePlugin.log(e);
|
||||||
throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1,
|
throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1,
|
||||||
MakeMessages.getString("GCCScannerConfigUtil.Error_Message"), e)); //$NON-NLS-1$
|
MakeMessages.getString("DiscoveredPathManager.File_Error_Message"), e)); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -218,15 +213,14 @@ public class DiscoveredPathManager implements IDiscoveredPathManager {
|
||||||
transformer.transform(source, result);
|
transformer.transform(source, result);
|
||||||
|
|
||||||
// Save the document
|
// Save the document
|
||||||
IPath path = MakeCorePlugin.getWorkingDirectory();
|
|
||||||
path = path.append(info.getProject().getName() + ".sc"); //$NON-NLS-1$
|
|
||||||
try {
|
try {
|
||||||
|
IPath path = ScannerConfigUtil.getDiscoveredScannerConfigStore(info.getProject(), false);
|
||||||
FileOutputStream file = new FileOutputStream(path.toFile());
|
FileOutputStream file = new FileOutputStream(path.toFile());
|
||||||
file.write(stream.toByteArray());
|
file.write(stream.toByteArray());
|
||||||
file.close();
|
file.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1,
|
throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1,
|
||||||
MakeMessages.getString("GCCScannerConfigUtil.Error_Message"), e)); //$NON-NLS-1$
|
MakeMessages.getString("DiscoveredPathManager.File_Error_Message"), e)); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close the streams
|
// Close the streams
|
||||||
|
@ -234,15 +228,15 @@ public class DiscoveredPathManager implements IDiscoveredPathManager {
|
||||||
} catch (TransformerException e) {
|
} catch (TransformerException e) {
|
||||||
MakeCorePlugin.log(e);
|
MakeCorePlugin.log(e);
|
||||||
throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1,
|
throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1,
|
||||||
MakeMessages.getString("GCCScannerConfigUtil.Error_Message"), e)); //$NON-NLS-1$
|
MakeMessages.getString("DiscoveredPathManager.File_Error_Message"), e)); //$NON-NLS-1$
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
MakeCorePlugin.log(e);
|
MakeCorePlugin.log(e);
|
||||||
throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1,
|
throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1,
|
||||||
MakeMessages.getString("GCCScannerConfigUtil.Error_Message"), e)); //$NON-NLS-1$
|
MakeMessages.getString("DiscoveredPathManager.File_Error_Message"), e)); //$NON-NLS-1$
|
||||||
} catch (ParserConfigurationException e) {
|
} catch (ParserConfigurationException e) {
|
||||||
MakeCorePlugin.log(e);
|
MakeCorePlugin.log(e);
|
||||||
throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1,
|
throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1,
|
||||||
MakeMessages.getString("GCCScannerConfigUtil.Error_Message"), e)); //$NON-NLS-1$
|
MakeMessages.getString("DiscoveredPathManager.File_Error_Message"), e)); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.core.resources.ICommand;
|
import org.eclipse.core.resources.ICommand;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import org.eclipse.core.resources.IProjectDescription;
|
||||||
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.IExtension;
|
import org.eclipse.core.runtime.IExtension;
|
||||||
|
@ -25,6 +26,7 @@ import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.core.runtime.Preferences;
|
import org.eclipse.core.runtime.Preferences;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
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.scannerconfig.IScannerConfigBuilderInfo;
|
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo;
|
||||||
import org.eclipse.cdt.make.core.scannerconfig.ScannerConfigNature;
|
import org.eclipse.cdt.make.core.scannerconfig.ScannerConfigNature;
|
||||||
import org.eclipse.cdt.make.internal.core.MakeMessages;
|
import org.eclipse.cdt.make.internal.core.MakeMessages;
|
||||||
|
@ -271,7 +273,7 @@ public class ScannerConfigInfoFactory {
|
||||||
BuildProperty(IProject project, String builderID) throws CoreException {
|
BuildProperty(IProject project, String builderID) throws CoreException {
|
||||||
this.project = project;
|
this.project = project;
|
||||||
this.builderID = builderID;
|
this.builderID = builderID;
|
||||||
ICommand builder = ScannerConfigNature.getBuildSpec(project, builderID);
|
ICommand builder = ScannerConfigNature.getBuildSpec(project.getDescription(), builderID);
|
||||||
if (builder == null) {
|
if (builder == null) {
|
||||||
throw new CoreException(new Status(IStatus.ERROR,
|
throw new CoreException(new Status(IStatus.ERROR,
|
||||||
MakeCorePlugin.getUniqueIdentifier(), -1,
|
MakeCorePlugin.getUniqueIdentifier(), -1,
|
||||||
|
@ -286,10 +288,14 @@ public class ScannerConfigInfoFactory {
|
||||||
if (curValue != null && curValue.equals(value)) {
|
if (curValue != null && curValue.equals(value)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ICommand builder = ScannerConfigNature.getBuildSpec(project, builderID);
|
IProjectDescription description = project.getDescription();
|
||||||
|
ICommand builder = ScannerConfigNature.getBuildSpec(description, builderID);
|
||||||
args.put(name, value);
|
args.put(name, value);
|
||||||
builder.setArguments(args);
|
ICommand newBuilder = description.newCommand();
|
||||||
project.setDescription(project.getDescription(), null);
|
newBuilder.setBuilderName(builder.getBuilderName());
|
||||||
|
newBuilder.setArguments(args);
|
||||||
|
description = MakeProjectNature.setBuildSpec(description, newBuilder);
|
||||||
|
project.setDescription(description, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getString(String name) {
|
protected String getString(String name) {
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
package org.eclipse.cdt.make.internal.core.scannerconfig.util;
|
package org.eclipse.cdt.make.internal.core.scannerconfig.util;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -17,9 +18,14 @@ import java.util.Iterator;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Random;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
||||||
|
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.QualifiedName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility class that handles some Scanner Config specifig collection conversions
|
* Utility class that handles some Scanner Config specifig collection conversions
|
||||||
|
@ -27,6 +33,9 @@ import org.eclipse.core.runtime.IPath;
|
||||||
* @author vhirsl
|
* @author vhirsl
|
||||||
*/
|
*/
|
||||||
public final class ScannerConfigUtil {
|
public final class ScannerConfigUtil {
|
||||||
|
private static Random sRandom = new Random();
|
||||||
|
private static final QualifiedName discoveredScannerConfigFileNameProperty = new
|
||||||
|
QualifiedName(MakeCorePlugin.getUniqueIdentifier(), "discoveredScannerConfigFileName"); //$NON-NLS-1$
|
||||||
/**
|
/**
|
||||||
* Adds all new discovered symbols/values to the existing ones.
|
* Adds all new discovered symbols/values to the existing ones.
|
||||||
*
|
*
|
||||||
|
@ -286,4 +295,29 @@ public final class ScannerConfigUtil {
|
||||||
}
|
}
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static IPath getDiscoveredScannerConfigStore(IProject project, boolean delete) {
|
||||||
|
if (project != null) {
|
||||||
|
try {
|
||||||
|
String fileName = (String) project.getPersistentProperty(discoveredScannerConfigFileNameProperty);
|
||||||
|
if (fileName == null) {
|
||||||
|
fileName = String.valueOf(sRandom.nextLong()) + ".sc"; //$NON-NLS-1$
|
||||||
|
project.setPersistentProperty(discoveredScannerConfigFileNameProperty, fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
IPath path = MakeCorePlugin.getWorkingDirectory();
|
||||||
|
path = path.append(fileName);
|
||||||
|
if (delete) {
|
||||||
|
File file = path.toFile();
|
||||||
|
if (file.exists()) {
|
||||||
|
file.delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return path;
|
||||||
|
} catch (CoreException e) {
|
||||||
|
MakeCorePlugin.log(e.getStatus());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,8 +27,10 @@ public class TraceUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void outputTrace(String prefix, String msg, String postfix) {
|
public static void outputTrace(String prefix, String msg, String postfix) {
|
||||||
System.out.println();
|
if (isTracing()) {
|
||||||
System.out.println(prefix + ' ' + msg + ' ' + postfix);
|
System.out.println();
|
||||||
|
System.out.println(prefix + ' ' + msg + ' ' + postfix);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -33,6 +33,7 @@ import org.eclipse.cdt.ui.dialogs.AbstractCOptionPage;
|
||||||
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;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import org.eclipse.core.resources.IWorkspaceRunnable;
|
||||||
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.IExtension;
|
import org.eclipse.core.runtime.IExtension;
|
||||||
|
@ -147,27 +148,34 @@ public class DiscoveryOptionsBlock extends AbstractCOptionPage {
|
||||||
buildInfo = MakeCorePlugin.createScannerConfigBuildInfo(project, ScannerConfigBuilder.BUILDER_ID);
|
buildInfo = MakeCorePlugin.createScannerConfigBuildInfo(project, ScannerConfigBuilder.BUILDER_ID);
|
||||||
if (fCreatePathContainer) {
|
if (fCreatePathContainer) {
|
||||||
createDiscoveredPathContainer(project);
|
createDiscoveredPathContainer(project);
|
||||||
|
// create a new discovered scanner config store
|
||||||
|
MakeCorePlugin.getDefault().getDiscoveryManager().removeDiscoveredInfo(project);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
buildInfo = MakeCorePlugin.createScannerConfigBuildInfo(fPrefs, ScannerConfigBuilder.BUILDER_ID, false);
|
buildInfo = MakeCorePlugin.createScannerConfigBuildInfo(fPrefs, ScannerConfigBuilder.BUILDER_ID, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
buildInfo.setAutoDiscoveryEnabled(isScannerConfigDiscoveryEnabled());
|
final IScannerConfigBuilderInfo fInfo = buildInfo;
|
||||||
if (isScannerConfigDiscoveryEnabled()) {
|
MakeUIPlugin.getWorkspace().run(new IWorkspaceRunnable() {
|
||||||
buildInfo.setMakeBuilderConsoleParserEnabled(isBuilderParserEnabled());
|
public void run(IProgressMonitor monitor) throws CoreException {
|
||||||
if (isBuilderParserEnabled()) {
|
fInfo.setAutoDiscoveryEnabled(isScannerConfigDiscoveryEnabled());
|
||||||
buildInfo.setMakeBuilderConsoleParserId((String) builderParsers.get(makeBuilderSIParserComboBox.getText()));
|
if (isScannerConfigDiscoveryEnabled()) {
|
||||||
}
|
fInfo.setMakeBuilderConsoleParserEnabled(isBuilderParserEnabled());
|
||||||
buildInfo.setESIProviderCommandEnabled(isProviderCommandEnabled());
|
if (isBuilderParserEnabled()) {
|
||||||
if (isProviderCommandEnabled()) {
|
fInfo.setMakeBuilderConsoleParserId((String) builderParsers.get(makeBuilderSIParserComboBox.getText()));
|
||||||
buildInfo.setUseDefaultESIProviderCmd(useDefaultESIProviderCmd());
|
}
|
||||||
if (!useDefaultESIProviderCmd()) {
|
fInfo.setESIProviderCommandEnabled(isProviderCommandEnabled());
|
||||||
storeSIProviderCommandLine(buildInfo);
|
if (isProviderCommandEnabled()) {
|
||||||
|
fInfo.setUseDefaultESIProviderCmd(useDefaultESIProviderCmd());
|
||||||
|
if (!useDefaultESIProviderCmd()) {
|
||||||
|
storeSIProviderCommandLine(fInfo);
|
||||||
|
}
|
||||||
|
fInfo.setESIProviderConsoleParserId((String) providerParsers.get(esiProviderParserComboBox.getText()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
buildInfo.setESIProviderConsoleParserId((String) providerParsers.get(esiProviderParserComboBox.getText()));
|
|
||||||
}
|
}
|
||||||
}
|
} /* IWorkspaceRunnable */, monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -208,7 +216,7 @@ public class DiscoveryOptionsBlock extends AbstractCOptionPage {
|
||||||
makeBuilderSIParserComboBox.setText(getParserName(builderParsers, info.getMakeBuilderConsoleParserId()));
|
makeBuilderSIParserComboBox.setText(getParserName(builderParsers, info.getMakeBuilderConsoleParserId()));
|
||||||
enableProviderCommandButton.setSelection(info.isESIProviderCommandEnabled());
|
enableProviderCommandButton.setSelection(info.isESIProviderCommandEnabled());
|
||||||
defESIProviderCommandButton.setSelection(info.isDefaultESIProviderCmd());
|
defESIProviderCommandButton.setSelection(info.isDefaultESIProviderCmd());
|
||||||
setESIProviderCommand(info);
|
setESIProviderCommandFrom(info);
|
||||||
esiProviderParserComboBox.setText(getParserName(providerParsers, info.getESIProviderConsoleParserId()));
|
esiProviderParserComboBox.setText(getParserName(providerParsers, info.getESIProviderConsoleParserId()));
|
||||||
|
|
||||||
enableAllControls();
|
enableAllControls();
|
||||||
|
@ -302,7 +310,7 @@ public class DiscoveryOptionsBlock extends AbstractCOptionPage {
|
||||||
/**
|
/**
|
||||||
* Handles scanner configuration discovery selection change
|
* Handles scanner configuration discovery selection change
|
||||||
*/
|
*/
|
||||||
protected void handleScannerConfigEnable() {
|
private void handleScannerConfigEnable() {
|
||||||
boolean enable = scEnabledButton.getSelection();
|
boolean enable = scEnabledButton.getSelection();
|
||||||
if (enable && needsSCNature) {
|
if (enable && needsSCNature) {
|
||||||
// first install the SC nature
|
// first install the SC nature
|
||||||
|
@ -436,7 +444,7 @@ public class DiscoveryOptionsBlock extends AbstractCOptionPage {
|
||||||
esiProviderCommand = ControlFactory.createTextField(parent, SWT.SINGLE | SWT.BORDER);
|
esiProviderCommand = ControlFactory.createTextField(parent, SWT.SINGLE | SWT.BORDER);
|
||||||
((GridData) (esiProviderCommand.getLayoutData())).horizontalAlignment = GridData.FILL;
|
((GridData) (esiProviderCommand.getLayoutData())).horizontalAlignment = GridData.FILL;
|
||||||
((GridData) (esiProviderCommand.getLayoutData())).grabExcessHorizontalSpace = true;
|
((GridData) (esiProviderCommand.getLayoutData())).grabExcessHorizontalSpace = true;
|
||||||
setESIProviderCommand(fBuildInfo);
|
setESIProviderCommandFrom(fBuildInfo);
|
||||||
if (fBuildInfo.isDefaultESIProviderCmd()) {
|
if (fBuildInfo.isDefaultESIProviderCmd()) {
|
||||||
esiProviderCommand.setEnabled(false);
|
esiProviderCommand.setEnabled(false);
|
||||||
}
|
}
|
||||||
|
@ -451,7 +459,7 @@ public class DiscoveryOptionsBlock extends AbstractCOptionPage {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private void setESIProviderCommand(IScannerConfigBuilderInfo buildInfo) {
|
private void setESIProviderCommandFrom(IScannerConfigBuilderInfo buildInfo) {
|
||||||
IPath sCommand = buildInfo.getESIProviderCommand();
|
IPath sCommand = buildInfo.getESIProviderCommand();
|
||||||
if (sCommand != null) {
|
if (sCommand != null) {
|
||||||
StringBuffer cmd = new StringBuffer(sCommand.toOSString());
|
StringBuffer cmd = new StringBuffer(sCommand.toOSString());
|
||||||
|
|
Loading…
Add table
Reference in a new issue