1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-04 14:55:41 +02:00

autotools: Modernize o.e.cdt.autotools.core.

* Enable warnings and save actions. 
* Replace useless @see comments with proper Override annotations. 
* Remove redundant type declarations. 
* Add missing Deprecated annotations. 
* Remove useless throws declarations. 
* Remove useless casts. 
* Remove useless method parameters.

Change-Id: I632c1c811b5d01c80279fab30010cec7d285a971
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
This commit is contained in:
Alexander Kurtakov 2015-10-15 13:06:59 +03:00 committed by Gerrit Code Review @ Eclipse.org
parent 843ecb2adc
commit 495766631c
26 changed files with 324 additions and 154 deletions

View file

@ -1,4 +1,10 @@
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
@ -6,6 +12,89 @@ org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
org.eclipse.jdt.core.compiler.problem.deadCode=warning
org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=disabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=disabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=warning
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.7 org.eclipse.jdt.core.compiler.source=1.7

View file

@ -1,3 +1,61 @@
#Tue Jan 02 14:11:13 EST 2007
eclipse.preferences.version=1 eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
internal.default.compliance=default internal.default.compliance=default
sp_cleanup.add_default_serial_version_id=true
sp_cleanup.add_generated_serial_version_id=false
sp_cleanup.add_missing_annotations=true
sp_cleanup.add_missing_deprecated_annotations=true
sp_cleanup.add_missing_methods=false
sp_cleanup.add_missing_nls_tags=false
sp_cleanup.add_missing_override_annotations=true
sp_cleanup.add_missing_override_annotations_interface_methods=true
sp_cleanup.add_serial_version_id=false
sp_cleanup.always_use_blocks=true
sp_cleanup.always_use_parentheses_in_expressions=false
sp_cleanup.always_use_this_for_non_static_field_access=false
sp_cleanup.always_use_this_for_non_static_method_access=false
sp_cleanup.convert_functional_interfaces=false
sp_cleanup.convert_to_enhanced_for_loop=false
sp_cleanup.correct_indentation=false
sp_cleanup.format_source_code=true
sp_cleanup.format_source_code_changes_only=true
sp_cleanup.insert_inferred_type_arguments=false
sp_cleanup.make_local_variable_final=true
sp_cleanup.make_parameters_final=false
sp_cleanup.make_private_fields_final=true
sp_cleanup.make_type_abstract_if_missing_method=false
sp_cleanup.make_variable_declarations_final=false
sp_cleanup.never_use_blocks=false
sp_cleanup.never_use_parentheses_in_expressions=true
sp_cleanup.on_save_use_additional_actions=true
sp_cleanup.organize_imports=true
sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
sp_cleanup.remove_private_constructors=true
sp_cleanup.remove_redundant_type_arguments=true
sp_cleanup.remove_trailing_whitespaces=false
sp_cleanup.remove_trailing_whitespaces_all=true
sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
sp_cleanup.remove_unnecessary_casts=true
sp_cleanup.remove_unnecessary_nls_tags=false
sp_cleanup.remove_unused_imports=false
sp_cleanup.remove_unused_local_variables=false
sp_cleanup.remove_unused_private_fields=true
sp_cleanup.remove_unused_private_members=false
sp_cleanup.remove_unused_private_methods=true
sp_cleanup.remove_unused_private_types=true
sp_cleanup.sort_members=false
sp_cleanup.sort_members_all=false
sp_cleanup.use_anonymous_class_creation=false
sp_cleanup.use_blocks=false
sp_cleanup.use_blocks_only_for_return_and_throw=false
sp_cleanup.use_lambda=true
sp_cleanup.use_parentheses_in_expressions=false
sp_cleanup.use_this_for_non_static_field_access=false
sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
sp_cleanup.use_this_for_non_static_method_access=false
sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
sp_cleanup.use_type_arguments=false

View file

@ -47,33 +47,21 @@ public class AutotoolsNewProjectNature implements IProjectNature {
private IProject project; private IProject project;
/* (non-Javadoc)
* @see org.eclipse.core.resources.IProjectNature#configure()
*/
@Override @Override
public void configure() throws CoreException { public void configure() throws CoreException {
addAutotoolsBuilder(project, new NullProgressMonitor()); addAutotoolsBuilder(project, new NullProgressMonitor());
} }
/* (non-Javadoc)
* @see org.eclipse.core.resources.IProjectNature#deconfigure()
*/
@Override @Override
public void deconfigure() throws CoreException { public void deconfigure() throws CoreException {
// TODO remove builder from here // TODO remove builder from here
} }
/* (non-Javadoc)
* @see org.eclipse.core.resources.IProjectNature#getProject()
*/
@Override @Override
public IProject getProject() { public IProject getProject() {
return project; return project;
} }
/* (non-Javadoc)
* @see org.eclipse.core.resources.IProjectNature#setProject(org.eclipse.core.resources.IProject)
*/
@Override @Override
public void setProject(IProject project) { public void setProject(IProject project) {
this.project = project; this.project = project;
@ -161,7 +149,7 @@ public class AutotoolsNewProjectNature implements IProjectNature {
static ICommand[] getBuildCommandsList(IProjectDescription description, static ICommand[] getBuildCommandsList(IProjectDescription description,
ICommand[] commands) { ICommand[] commands) {
ArrayList<ICommand> commandList = new ArrayList<ICommand>(); ArrayList<ICommand> commandList = new ArrayList<>();
// Make sure the Autotools Configuration builder just precedes the Common Builder // Make sure the Autotools Configuration builder just precedes the Common Builder
for (int i = 0; i < commands.length; i++) { for (int i = 0; i < commands.length; i++) {
@ -257,7 +245,7 @@ public class AutotoolsNewProjectNature implements IProjectNature {
public static void removeNature(IProject project, String natureId, IProgressMonitor monitor) throws CoreException { public static void removeNature(IProject project, String natureId, IProgressMonitor monitor) throws CoreException {
IProjectDescription description = project.getDescription(); IProjectDescription description = project.getDescription();
String[] prevNatures = description.getNatureIds(); String[] prevNatures = description.getNatureIds();
List<String> newNatures = new ArrayList<String>(Arrays.asList(prevNatures)); List<String> newNatures = new ArrayList<>(Arrays.asList(prevNatures));
newNatures.remove(natureId); newNatures.remove(natureId);
description.setNatureIds(newNatures.toArray(new String[newNatures.size()])); description.setNatureIds(newNatures.toArray(new String[newNatures.size()]));
project.setDescription(description, monitor); project.setDescription(description, monitor);

View file

@ -83,6 +83,7 @@ public class AutotoolsPlugin extends AbstractUIPlugin {
/** /**
* This method is called upon plug-in activation * This method is called upon plug-in activation
*/ */
@Override
public void start(BundleContext context) throws Exception { public void start(BundleContext context) throws Exception {
super.start(context); super.start(context);
} }
@ -90,6 +91,7 @@ public class AutotoolsPlugin extends AbstractUIPlugin {
/** /**
* This method is called when the plug-in is stopped * This method is called when the plug-in is stopped
*/ */
@Override
public void stop(BundleContext context) throws Exception { public void stop(BundleContext context) throws Exception {
super.stop(context); super.stop(context);
plugin = null; plugin = null;
@ -229,6 +231,7 @@ public class AutotoolsPlugin extends AbstractUIPlugin {
display = Display.getDefault(); display = Display.getDefault();
final IStatus fstatus = status; final IStatus fstatus = status;
display.asyncExec(new Runnable() { display.asyncExec(new Runnable() {
@Override
public void run() { public void run() {
ErrorDialog.openError(null, title, null, fstatus); ErrorDialog.openError(null, title, null, fstatus);
} }

View file

@ -103,7 +103,7 @@ public class AutotoolsConfigurationBuilder extends ACBuilder {
} }
@Override @Override
protected void clean(IProgressMonitor monitor) throws CoreException { protected void clean(IProgressMonitor monitor) {
IProject project = getProject(); IProject project = getProject();
final IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(getProject()); final IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(getProject());
if (shouldBuild(CLEAN_BUILD, info)) { if (shouldBuild(CLEAN_BUILD, info)) {
@ -123,7 +123,7 @@ public class AutotoolsConfigurationBuilder extends ACBuilder {
} }
protected MultiStatus performMakefileGeneration(IProject project, IManagedBuildInfo info, protected MultiStatus performMakefileGeneration(IProject project, IManagedBuildInfo info,
IProgressMonitor monitor) throws CoreException { IProgressMonitor monitor) {
MultiStatus result; MultiStatus result;
try { try {

View file

@ -42,14 +42,15 @@ public class AutotoolsEnvironmentVariableSupplier implements IConfigurationEnvir
: name.equals(VerboseEnvironmentVariable.VERBOSE_VAR_NAME); : name.equals(VerboseEnvironmentVariable.VERBOSE_VAR_NAME);
} }
private static IBuildEnvironmentVariable create(IConfiguration configuration) { private static IBuildEnvironmentVariable create() {
return new VerboseEnvironmentVariable(VERBOSE_VAR_NAME, VERBOSE_VAR_VALUE, IEnvironmentVariable.ENVVAR_PREPEND, null); return new VerboseEnvironmentVariable(VERBOSE_VAR_NAME, VERBOSE_VAR_VALUE, IEnvironmentVariable.ENVVAR_PREPEND, null);
} }
} }
@Override
public IBuildEnvironmentVariable[] getVariables(IConfiguration configuration, public IBuildEnvironmentVariable[] getVariables(IConfiguration configuration,
IEnvironmentVariableProvider provider) { IEnvironmentVariableProvider provider) {
IBuildEnvironmentVariable path = VerboseEnvironmentVariable.create(configuration); IBuildEnvironmentVariable path = VerboseEnvironmentVariable.create();
return new IBuildEnvironmentVariable[] { path }; return new IBuildEnvironmentVariable[] { path };
} }
@ -57,7 +58,7 @@ public class AutotoolsEnvironmentVariableSupplier implements IConfigurationEnvir
public IBuildEnvironmentVariable getVariable(String variableName, IConfiguration configuration, public IBuildEnvironmentVariable getVariable(String variableName, IConfiguration configuration,
IEnvironmentVariableProvider provider) { IEnvironmentVariableProvider provider) {
if (VerboseEnvironmentVariable.isVar(variableName)) { if (VerboseEnvironmentVariable.isVar(variableName)) {
return VerboseEnvironmentVariable.create(configuration); return VerboseEnvironmentVariable.create();
} else { } else {
return null; return null;
} }

View file

@ -48,7 +48,6 @@ import org.eclipse.cdt.make.core.MakeCorePlugin;
import org.eclipse.cdt.make.core.makefile.IMakefile; import org.eclipse.cdt.make.core.makefile.IMakefile;
import org.eclipse.cdt.make.core.makefile.ITarget; import org.eclipse.cdt.make.core.makefile.ITarget;
import org.eclipse.cdt.make.core.makefile.ITargetRule; import org.eclipse.cdt.make.core.makefile.ITargetRule;
import org.eclipse.cdt.managedbuilder.core.BuildException;
import org.eclipse.cdt.managedbuilder.core.IBuilder; import org.eclipse.cdt.managedbuilder.core.IBuilder;
import org.eclipse.cdt.managedbuilder.core.IConfiguration; import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo; import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
@ -65,7 +64,6 @@ import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.IResourceStatus; import org.eclipse.core.resources.IResourceStatus;
import org.eclipse.core.resources.IWorkspaceRoot; import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
@ -80,8 +78,6 @@ import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubProgressMonitor; import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.remote.core.IRemoteConnection; import org.eclipse.remote.core.IRemoteConnection;
import org.eclipse.remote.core.IRemoteConnectionControlService;
import org.eclipse.remote.core.IRemoteConnectionPropertyService;
import org.eclipse.remote.core.IRemoteConnectionType; import org.eclipse.remote.core.IRemoteConnectionType;
import org.eclipse.remote.core.IRemoteResource; import org.eclipse.remote.core.IRemoteResource;
import org.eclipse.remote.core.IRemoteServicesManager; import org.eclipse.remote.core.IRemoteServicesManager;
@ -130,12 +126,12 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
private IBuilder builder; private IBuilder builder;
public void generateDependencies() throws CoreException { public void generateDependencies() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
} }
public MultiStatus generateMakefiles(IResourceDelta delta) public MultiStatus generateMakefiles()
throws CoreException { throws CoreException {
return regenerateMakefiles(false); return regenerateMakefiles(false);
} }
@ -175,12 +171,12 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
return project; return project;
} }
public boolean isGeneratedResource(IResource resource) { public boolean isGeneratedResource() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return false; return false;
} }
public void regenerateDependencies(boolean force) throws CoreException { public void regenerateDependencies() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
} }
@ -257,8 +253,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
} }
private void refresh() throws CoreException{ private void refresh() throws CoreException{
IRemoteResource remRes = IRemoteResource remRes = getProject().getAdapter(IRemoteResource.class);
(IRemoteResource)getProject().getAdapter(IRemoteResource.class);
if (remRes != null) { if (remRes != null) {
remRes.refresh(new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN)); remRes.refresh(new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN));
} }
@ -485,12 +480,12 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
} }
} }
ArrayList<String> configureEnvs = new ArrayList<String>(); ArrayList<String> configureEnvs = new ArrayList<>();
ArrayList<String> configureCmdParms = new ArrayList<String>(); ArrayList<String> configureCmdParms = new ArrayList<>();
IPath configurePath = getConfigurePath(configureEnvs, configureCmdParms); IPath configurePath = getConfigurePath(configureEnvs, configureCmdParms);
String[] configArgs = getConfigArgs(configureCmdParms); String[] configArgs = getConfigArgs(configureCmdParms);
ArrayList<String> autogenEnvs = new ArrayList<String>(); ArrayList<String> autogenEnvs = new ArrayList<>();
ArrayList<String> autogenCmdParms = new ArrayList<String>(); ArrayList<String> autogenCmdParms = new ArrayList<>();
IPath autogenPath = getAutogenPath(autogenEnvs, autogenCmdParms); IPath autogenPath = getAutogenPath(autogenEnvs, autogenCmdParms);
// Check if we have a config.status (meaning configure has already run). // Check if we have a config.status (meaning configure has already run).
@ -841,10 +836,8 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
} }
// Run a command or executable (e.g. make). // Run a command or executable (e.g. make).
private int runCommand(IPath commandPath, IPath runPath, String[] args, private int runCommand(IPath commandPath, IPath runPath, String[] args, String jobDescription, String errMsg,
String jobDescription, String errMsg, IConsole console, IConsole console, boolean consoleStart) throws CoreException, NullPointerException, IOException {
boolean consoleStart) throws BuildException, CoreException,
NullPointerException, IOException {
int rc = IStatus.OK; int rc = IStatus.OK;
@ -876,7 +869,6 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
"MakeGenerator.make.message", msgs)); //$NON-NLS-1$ "MakeGenerator.make.message", msgs)); //$NON-NLS-1$
ConsoleOutputStream consoleOutStream = null;
ErrorParserManager epm = null; ErrorParserManager epm = null;
StringBuffer buf = new StringBuffer(); StringBuffer buf = new StringBuffer();
@ -884,8 +876,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
if (consoleStart) if (consoleStart)
console.start(project); console.start(project);
try { try (ConsoleOutputStream consoleOutStream = console.getOutputStream()) {
consoleOutStream = console.getOutputStream();
String[] consoleHeader = new String[3]; String[] consoleHeader = new String[3];
consoleHeader[0] = jobDescription; consoleHeader[0] = jobDescription;
@ -906,7 +897,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
IEnvironmentVariable variables[] = IEnvironmentVariable variables[] =
CCorePlugin.getDefault().getBuildEnvironmentManager().getVariables(cdesc, true); CCorePlugin.getDefault().getBuildEnvironmentManager().getVariables(cdesc, true);
String[] env = null; String[] env = null;
ArrayList<String> envList = new ArrayList<String>(); ArrayList<String> envList = new ArrayList<>();
if (variables != null) { if (variables != null) {
for (int i = 0; i < variables.length; i++) { for (int i = 0; i < variables.length; i++) {
envList.add(variables[i].getName() envList.add(variables[i].getName()
@ -917,7 +908,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
// Hook up an error parser manager // Hook up an error parser manager
URI uri = URIUtil.toURI(runPath); URI uri = URIUtil.toURI(runPath);
epm = new ErrorParserManager(project, uri, this, new String[] {ErrorParser.ID}); epm = new ErrorParserManager(project, uri, this);
epm.setOutputStream(consoleOutStream); epm.setOutputStream(consoleOutStream);
epm.addErrorParser(ErrorParser.ID, new ErrorParser(getSourcePath(), getBuildPath())); epm.addErrorParser(ErrorParser.ID, new ErrorParser(getSourcePath(), getBuildPath()));
@ -1018,8 +1009,6 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
// epm.reportProblems(); // epm.reportProblems();
} finally { } finally {
if (consoleOutStream != null)
consoleOutStream.close();
if (epm != null) if (epm != null)
epm.close(); epm.close();
} }
@ -1044,7 +1033,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
IEnvironmentVariable variables[] = IEnvironmentVariable variables[] =
CCorePlugin.getDefault().getBuildEnvironmentManager().getVariables(cdesc, true); CCorePlugin.getDefault().getBuildEnvironmentManager().getVariables(cdesc, true);
String[] env = new String[0]; String[] env = new String[0];
ArrayList<String> envList = new ArrayList<String>(); ArrayList<String> envList = new ArrayList<>();
if (variables != null) { if (variables != null) {
for (int i = 0; i < variables.length; i++) { for (int i = 0; i < variables.length; i++) {
envList.add(variables[i].getName() envList.add(variables[i].getName()
@ -1070,8 +1059,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
// Get OS name either remotely or locally, depending on the project // Get OS name either remotely or locally, depending on the project
private String getOSName() { private String getOSName() {
IRemoteResource remRes = IRemoteResource remRes = getProject().getAdapter(IRemoteResource.class);
(IRemoteResource)getProject().getAdapter(IRemoteResource.class);
if (remRes != null) { if (remRes != null) {
URI uri = remRes.getActiveLocationURI(); URI uri = remRes.getActiveLocationURI();
IRemoteServicesManager remoteServiceManager = AutotoolsPlugin.getService(IRemoteServicesManager.class); IRemoteServicesManager remoteServiceManager = AutotoolsPlugin.getService(IRemoteServicesManager.class);
@ -1121,11 +1109,9 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
} }
// Run an autotools script (e.g. configure, autogen.sh, config.status). // Run an autotools script (e.g. configure, autogen.sh, config.status).
private int runScript(IPath commandPath, IPath runPath, String[] args, private int runScript(IPath commandPath, IPath runPath, String[] args, String jobDescription, String errMsg,
String jobDescription, String errMsg, IConsole console, IConsole console, ArrayList<String> additionalEnvs, boolean consoleStart)
ArrayList<String> additionalEnvs, throws CoreException, NullPointerException, IOException {
boolean consoleStart) throws BuildException, CoreException,
NullPointerException, IOException {
int rc = IStatus.OK; int rc = IStatus.OK;
boolean removePWD = false; boolean removePWD = false;
@ -1190,7 +1176,6 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
"MakeGenerator.make.message", msgs)); //$NON-NLS-1$ "MakeGenerator.make.message", msgs)); //$NON-NLS-1$
ConsoleOutputStream consoleOutStream = null;
ErrorParserManager epm = null; ErrorParserManager epm = null;
StringBuffer buf = new StringBuffer(); StringBuffer buf = new StringBuffer();
@ -1198,8 +1183,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
if (consoleStart) if (consoleStart)
console.start(project); console.start(project);
try { try (ConsoleOutputStream consoleOutStream = console.getOutputStream()) {
consoleOutStream = console.getOutputStream();
String[] consoleHeader = new String[3]; String[] consoleHeader = new String[3];
consoleHeader[0] = jobDescription; consoleHeader[0] = jobDescription;
@ -1234,7 +1218,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
IEnvironmentVariable variables[] = IEnvironmentVariable variables[] =
CCorePlugin.getDefault().getBuildEnvironmentManager().getVariables(cdesc, true); CCorePlugin.getDefault().getBuildEnvironmentManager().getVariables(cdesc, true);
String[] env = null; String[] env = null;
ArrayList<String> envList = new ArrayList<String>(); ArrayList<String> envList = new ArrayList<>();
if (variables != null) { if (variables != null) {
for (int i = 0; i < variables.length; i++) { for (int i = 0; i < variables.length; i++) {
// For Windows/Mac, check for PWD environment variable being passed. // For Windows/Mac, check for PWD environment variable being passed.
@ -1262,7 +1246,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
// Hook up an error parser manager // Hook up an error parser manager
URI uri = URIUtil.toURI(runPath); URI uri = URIUtil.toURI(runPath);
epm = new ErrorParserManager(project, uri, this, new String[] {ErrorParser.ID}); epm = new ErrorParserManager(project, uri, this);
epm.setOutputStream(consoleOutStream); epm.setOutputStream(consoleOutStream);
epm.addErrorParser(ErrorParser.ID, new ErrorParser(getSourcePath(), getBuildPath())); epm.addErrorParser(ErrorParser.ID, new ErrorParser(getSourcePath(), getBuildPath()));
@ -1364,8 +1348,6 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
// .getResourceString(MARKERS)); // .getResourceString(MARKERS));
// epm.reportProblems(); // epm.reportProblems();
} finally { } finally {
if (consoleOutStream != null)
consoleOutStream.close();
if (epm != null) if (epm != null)
epm.close(); epm.close();
} }
@ -1467,7 +1449,10 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
IMakefile makefile = MakeCorePlugin.createMakefile(makefileFile.toURI(), false, null); IMakefile makefile = MakeCorePlugin.createMakefile(makefileFile.toURI(), false, null);
ITargetRule[] targets = makefile.getTargetRules(); ITargetRule[] targets = makefile.getTargetRules();
ITarget target = null; ITarget target = null;
Map<String, IMakeTarget> makeTargets = new HashMap<String, IMakeTarget>(); // use a HashMap so duplicate names are handled Map<String, IMakeTarget> makeTargets = new HashMap<>(); // use a HashMap
// so duplicate
// names are
// handled
String[] id = makeTargetManager.getTargetBuilders(getProject()); String[] id = makeTargetManager.getTargetBuilders(getProject());
if (id.length == 0) { if (id.length == 0) {
return; return;
@ -1492,7 +1477,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
for (int i = 0; i < targets.length; i++) { for (int i = 0; i < targets.length; i++) {
target = targets[i].getTarget(); target = targets[i].getTarget();
String targetName = target.toString(); String targetName = target.toString();
if (!isValidTarget(targetName, makeTargetManager)) if (!isValidTarget(targetName))
continue; continue;
try { try {
// Bug #351660 - always create a new MakeTarget because an // Bug #351660 - always create a new MakeTarget because an
@ -1505,15 +1490,15 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
makeTarget.setStopOnError(isStopOnError); makeTarget.setStopOnError(isStopOnError);
makeTarget.setRunAllBuilders(false); makeTarget.setRunAllBuilders(false);
makeTarget.setUseDefaultBuildCmd(true); makeTarget.setUseDefaultBuildCmd(true);
makeTarget.setBuildAttribute(IMakeTarget.BUILD_ARGUMENTS, buildArguments); makeTarget.setBuildAttribute(IMakeCommonBuildInfo.BUILD_ARGUMENTS, buildArguments);
makeTarget.setBuildAttribute(IMakeTarget.BUILD_COMMAND, defaultBuildCommand); makeTarget.setBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND, defaultBuildCommand);
makeTarget.setBuildAttribute(GENERATED_TARGET, "true"); //$NON-NLS-1$ makeTarget.setBuildAttribute(GENERATED_TARGET, "true"); //$NON-NLS-1$
makeTarget.setBuildAttribute(IMakeTarget.BUILD_TARGET, makeTarget.setBuildAttribute(IMakeTarget.BUILD_TARGET,
targetName); targetName);
//TODO: should this be raw build directory in macro form? //TODO: should this be raw build directory in macro form?
makeTarget.setBuildAttribute(IMakeTarget.BUILD_LOCATION, makeTarget.setBuildAttribute(IMakeCommonBuildInfo.BUILD_LOCATION,
buildDir); buildDir);
makeTargets.put(makeTarget.getName(), makeTarget); makeTargets.put(makeTarget.getName(), makeTarget);
} catch (CoreException e) { } catch (CoreException e) {
@ -1523,7 +1508,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
IMakeTarget[] makeTargetArray = new IMakeTarget[makeTargets.size()]; IMakeTarget[] makeTargetArray = new IMakeTarget[makeTargets.size()];
Collection<IMakeTarget> values = makeTargets.values(); Collection<IMakeTarget> values = makeTargets.values();
ArrayList<IMakeTarget> valueList = new ArrayList<IMakeTarget>(values); ArrayList<IMakeTarget> valueList = new ArrayList<>(values);
valueList.toArray(makeTargetArray); valueList.toArray(makeTargetArray);
MakeTargetComparator compareMakeTargets = new MakeTargetComparator(); MakeTargetComparator compareMakeTargets = new MakeTargetComparator();
Arrays.sort(makeTargetArray, compareMakeTargets); Arrays.sort(makeTargetArray, compareMakeTargets);
@ -1552,7 +1537,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
saveTargets(makeTargetArray); saveTargets(makeTargetArray);
} }
private boolean isValidTarget(String targetName, IMakeTargetManager makeTargetManager) { private boolean isValidTarget(String targetName) {
return !(targetName.endsWith("-am") //$NON-NLS-1$ return !(targetName.endsWith("-am") //$NON-NLS-1$
|| targetName.endsWith("PROGRAMS") //$NON-NLS-1$ || targetName.endsWith("PROGRAMS") //$NON-NLS-1$
|| targetName.endsWith("-generic") //$NON-NLS-1$ || targetName.endsWith("-generic") //$NON-NLS-1$
@ -1565,7 +1550,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
private String[] makeArray(String string) { private String[] makeArray(String string) {
string = string.trim(); string = string.trim();
char[] array = string.toCharArray(); char[] array = string.toCharArray();
ArrayList<String> aList = new ArrayList<String>(); ArrayList<String> aList = new ArrayList<>();
StringBuilder buffer = new StringBuilder(); StringBuilder buffer = new StringBuilder();
boolean inComment = false; boolean inComment = false;
for (int i = 0; i < array.length; i++) { for (int i = 0; i < array.length; i++) {

View file

@ -25,24 +25,18 @@ import org.eclipse.core.resources.IResource;
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public class DefaultNoDependencyCalculator implements IManagedDependencyGenerator { public class DefaultNoDependencyCalculator implements IManagedDependencyGenerator {
/* (non-Javadoc) @Override
* @see org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderDependencyCalculator#findDependencies(org.eclipse.core.resources.IResource, org.eclipse.core.resources.IProject)
*/
public IResource[] findDependencies(IResource resource, IProject project) { public IResource[] findDependencies(IResource resource, IProject project) {
// Never answers any dependencies // Never answers any dependencies
return null; return null;
} }
/* (non-Javadoc) @Override
* @see org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderDependencyCalculator#getCalculatorType()
*/
public int getCalculatorType() { public int getCalculatorType() {
return TYPE_NODEPS; return TYPE_NODEPS;
} }
/* (non-Javadoc) @Override
* @see org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderDependencyCalculator#getDependencyCommand(org.eclipse.core.resources.IResource)
*/
public String getDependencyCommand(IResource resource, IManagedBuildInfo info) { public String getDependencyCommand(IResource resource, IManagedBuildInfo info) {
// Never answers this call with an actual value // Never answers this call with an actual value
return null; return null;

View file

@ -151,9 +151,7 @@ public class ErrorParser extends MarkerGenerator implements IErrorParser {
if (!file.exists()) if (!file.exists())
return null; return null;
LineNumberReader reader = null; try (LineNumberReader reader = new LineNumberReader(new FileReader(file))) {
try {
reader = new LineNumberReader(new FileReader(file));
// look for something like: // look for something like:
// if test "${ac_cv_prog_WINDRES+set}" = set; then : // if test "${ac_cv_prog_WINDRES+set}" = set; then :
@ -184,14 +182,6 @@ public class ErrorParser extends MarkerGenerator implements IErrorParser {
} }
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} finally {
if (reader != null) {
try {
reader.close();
} catch (IOException e) {
// Ignore.
}
}
} }
return null; return null;

View file

@ -80,18 +80,7 @@ public class ErrorParserManager extends OutputStream {
* @param markerGenerator - marker generator able to create markers. * @param markerGenerator - marker generator able to create markers.
*/ */
public ErrorParserManager(IProject project, MarkerGenerator markerGenerator) { public ErrorParserManager(IProject project, MarkerGenerator markerGenerator) {
this(project, markerGenerator, null); this(project, project.getLocationURI(), markerGenerator);
}
/**
* Constructor.
*
* @param project - project being built.
* @param markerGenerator - marker generator able to create markers.
* @param parsersIDs - array of error parsers' IDs.
*/
public ErrorParserManager(IProject project, MarkerGenerator markerGenerator, String[] parsersIDs) {
this(project, project.getLocationURI(), markerGenerator, parsersIDs);
} }
@ -101,15 +90,14 @@ public class ErrorParserManager extends OutputStream {
* @param project - project being built. * @param project - project being built.
* @param baseDirectoryURI - absolute location URI of working directory of where the build is performed. * @param baseDirectoryURI - absolute location URI of working directory of where the build is performed.
* @param markerGenerator - marker generator able to create markers. * @param markerGenerator - marker generator able to create markers.
* @param parsersIDs - array of error parsers' IDs.
* @since 5.1 * @since 5.1
*/ */
public ErrorParserManager(IProject project, URI baseDirectoryURI, MarkerGenerator markerGenerator, String[] parsersIDs) { public ErrorParserManager(IProject project, URI baseDirectoryURI, MarkerGenerator markerGenerator) {
fProject = project; fProject = project;
fMarkerGenerator = markerGenerator; fMarkerGenerator = markerGenerator;
fDirectoryStack = new Vector<URI>(); fDirectoryStack = new Vector<>();
fErrors = new ArrayList<ProblemMarkerInfo>(); fErrors = new ArrayList<>();
fErrorParsers = new LinkedHashMap<String, ErrorParser>(); fErrorParsers = new LinkedHashMap<>();
if (baseDirectoryURI != null) if (baseDirectoryURI != null)
fBaseDirectoryURI = baseDirectoryURI; fBaseDirectoryURI = baseDirectoryURI;
@ -364,7 +352,7 @@ public class ErrorParserManager extends OutputStream {
* close it explicitly * close it explicitly
*/ */
@Override @Override
public synchronized void close() throws IOException { public synchronized void close() {
if (nOpens > 0 && --nOpens == 0) { if (nOpens > 0 && --nOpens == 0) {
checkLine(true); checkLine(true);
fDirectoryStack.removeAllElements(); fDirectoryStack.removeAllElements();
@ -380,17 +368,14 @@ public class ErrorParserManager extends OutputStream {
outputStream.flush(); outputStream.flush();
} }
/**
* @see java.io.OutputStream#write(int)
*/
@Override @Override
public synchronized void write(int b) throws IOException { public synchronized void write(int b) {
currentLine.append((char) b); currentLine.append((char) b);
checkLine(false); checkLine(false);
} }
@Override @Override
public synchronized void write(byte[] b, int off, int len) throws IOException { public synchronized void write(byte[] b, int off, int len) {
if (b == null) { if (b == null) {
throw new NullPointerException(); throw new NullPointerException();
} else if (off != 0 || (len < 0) || (len > b.length)) { } else if (off != 0 || (len < 0) || (len > b.length)) {

View file

@ -16,6 +16,7 @@ import org.eclipse.ui.IMarkerResolutionGenerator;
public class MarkerResolutionGenerator implements IMarkerResolutionGenerator { public class MarkerResolutionGenerator implements IMarkerResolutionGenerator {
@Override
public IMarkerResolution[] getResolutions(IMarker marker) { public IMarkerResolution[] getResolutions(IMarker marker) {
// System.out.println("in marker resolution, library info is " + marker.getAttribute(IAutotoolsMarker.MARKER_LIBRARY_INFO, "")); // System.out.println("in marker resolution, library info is " + marker.getAttribute(IAutotoolsMarker.MARKER_LIBRARY_INFO, ""));
// String libraryInfo = marker.getAttribute(IAutotoolsMarker.MARKER_LIBRARY_INFO, null); // String libraryInfo = marker.getAttribute(IAutotoolsMarker.MARKER_LIBRARY_INFO, null);

View file

@ -42,14 +42,14 @@ public class PkgconfigErrorResolution implements IMarkerResolution {
} }
@Override @Override
public synchronized void write(int c) throws IOException { public synchronized void write(int c) {
byte ascii[] = new byte[1]; byte ascii[] = new byte[1];
ascii[0] = (byte) c; ascii[0] = (byte) c;
fBuffer.append(new String(ascii)); fBuffer.append(new String(ascii));
} }
@Override @Override
public synchronized void write(byte[] b, int off, int len) throws IOException { public synchronized void write(byte[] b, int off, int len) {
fBuffer.append(new String(b, off, len)); fBuffer.append(new String(b, off, len));
} }
} }

View file

@ -28,10 +28,12 @@ public abstract class AbstractConfigurationOption implements IConfigureOption {
this.cfg = cfg; this.cfg = cfg;
} }
@Override
public String getDescription() { public String getDescription() {
return ConfigureMessages.getConfigureDescription(msgName); return ConfigureMessages.getConfigureDescription(msgName);
} }
@Override
public String getToolTip() { public String getToolTip() {
return ConfigureMessages.getConfigureTip(msgName); return ConfigureMessages.getConfigureTip(msgName);
} }
@ -40,6 +42,7 @@ public abstract class AbstractConfigurationOption implements IConfigureOption {
return msgName; return msgName;
} }
@Override
public String getName() { public String getName() {
return name; return name;
} }
@ -48,8 +51,9 @@ public abstract class AbstractConfigurationOption implements IConfigureOption {
return cfg; return cfg;
} }
@Override
public ArrayList<String> getParameters() { public ArrayList<String> getParameters() {
ArrayList<String> parameters = new ArrayList<String>(); ArrayList<String> parameters = new ArrayList<>();
if (isParmSet()) if (isParmSet())
parameters.add(getParameter()); parameters.add(getParameter());
return parameters; return parameters;
@ -59,18 +63,22 @@ public abstract class AbstractConfigurationOption implements IConfigureOption {
return "--" + getName(); return "--" + getName();
} }
@Override
public boolean isCategory() { public boolean isCategory() {
return false; return false;
} }
@Override
public boolean isFlag() { public boolean isFlag() {
return false; return false;
} }
@Override
public boolean isFlagValue() { public boolean isFlagValue() {
return false; return false;
} }
@Override
public boolean isMultiArg() { public boolean isMultiArg() {
return false; return false;
} }

View file

@ -119,7 +119,7 @@ public class AutotoolsConfiguration implements IAConfiguration {
private boolean isDirty; private boolean isDirty;
private boolean isParmsDirty; private boolean isParmsDirty;
private Map<String, IConfigureOption> configOptions; private Map<String, IConfigureOption> configOptions;
private ArrayList<String> configParms = new ArrayList<String>(); private ArrayList<String> configParms = new ArrayList<>();
public AutotoolsConfiguration(String name) { public AutotoolsConfiguration(String name) {
this(name, true); this(name, true);
@ -127,7 +127,7 @@ public class AutotoolsConfiguration implements IAConfiguration {
private AutotoolsConfiguration(String name, boolean initialize) { private AutotoolsConfiguration(String name, boolean initialize) {
this.id = name; this.id = name;
configOptions = new HashMap<String, IConfigureOption>(); configOptions = new HashMap<>();
if (initialize) if (initialize)
initConfigOptions(); initConfigOptions();
isParmsDirty = true; isParmsDirty = true;
@ -135,7 +135,7 @@ public class AutotoolsConfiguration implements IAConfiguration {
private void initConfigOptions() { private void initConfigOptions() {
// Put configure options in hash map. Ignore categories. // Put configure options in hash map. Ignore categories.
ArrayList<Option> tools = new ArrayList<Option>(); ArrayList<Option> tools = new ArrayList<>();
FlagConfigureOption lastFlag = null; FlagConfigureOption lastFlag = null;
for (int i = 0; i < configOpts.length; ++i) { for (int i = 0; i < configOpts.length; ++i) {
Option opt = configOpts[i]; Option opt = configOpts[i];
@ -202,7 +202,7 @@ public class AutotoolsConfiguration implements IAConfiguration {
} }
public static Option[] getChildOptions(String name) { public static Option[] getChildOptions(String name) {
ArrayList<Option> options = new ArrayList<Option>(); ArrayList<Option> options = new ArrayList<>();
for (int i = 0; i < configOpts.length; ++i) { for (int i = 0; i < configOpts.length; ++i) {
Option opt = configOpts[i]; Option opt = configOpts[i];
if (opt.getName().equals(name)) { if (opt.getName().equals(name)) {
@ -235,14 +235,17 @@ public class AutotoolsConfiguration implements IAConfiguration {
return toolList.clone(); return toolList.clone();
} }
@Override
public IConfigureOption getOption(String name) { public IConfigureOption getOption(String name) {
return configOptions.get(name); return configOptions.get(name);
} }
@Override
public IAConfiguration copy() { public IAConfiguration copy() {
return copy(id); return copy(id);
} }
@Override
public IAConfiguration copy(String newId) { public IAConfiguration copy(String newId) {
AutotoolsConfiguration cfg = new AutotoolsConfiguration(newId, false); AutotoolsConfiguration cfg = new AutotoolsConfiguration(newId, false);
Collection<IConfigureOption> oldValues = configOptions.values(); Collection<IConfigureOption> oldValues = configOptions.values();
@ -257,24 +260,29 @@ public class AutotoolsConfiguration implements IAConfiguration {
return cfg; return cfg;
} }
@Override
public String getId() { public String getId() {
return id; return id;
} }
@Override
public boolean isDirty() { public boolean isDirty() {
return isDirty; return isDirty;
} }
@Override
public void setDirty(boolean value) { public void setDirty(boolean value) {
isDirty = value; isDirty = value;
if (isDirty) if (isDirty)
isParmsDirty = true; isParmsDirty = true;
} }
@Override
public Map<String, IConfigureOption> getOptions() { public Map<String, IConfigureOption> getOptions() {
return configOptions; return configOptions;
} }
@Override
public String getToolParameters(String name) { public String getToolParameters(String name) {
StringBuffer buf = new StringBuffer(); StringBuffer buf = new StringBuffer();
Option[] options = getChildOptions(name); Option[] options = getChildOptions(name);
@ -297,9 +305,10 @@ public class AutotoolsConfiguration implements IAConfiguration {
return buf.toString(); return buf.toString();
} }
@Override
public ArrayList<String> getToolArgs(String name) { public ArrayList<String> getToolArgs(String name) {
if (isParmsDirty) { if (isParmsDirty) {
configParms = new ArrayList<String>(); configParms = new ArrayList<>();
Option[] options = getChildOptions(name); Option[] options = getChildOptions(name);
for (int i = 0; i < options.length; ++i) { for (int i = 0; i < options.length; ++i) {
IConfigureOption option = getOption(options[i].getName()); IConfigureOption option = getOption(options[i].getName());
@ -319,6 +328,7 @@ public class AutotoolsConfiguration implements IAConfiguration {
return configParms; return configParms;
} }
@Override
public void setOption(String name, String value) { public void setOption(String name, String value) {
IConfigureOption option = configOptions.get(name); IConfigureOption option = configOptions.get(name);
if (option != null) { if (option != null) {
@ -329,15 +339,18 @@ public class AutotoolsConfiguration implements IAConfiguration {
} }
} }
@Override
public void setConfigToolDirectory(String configToolDirectory) { public void setConfigToolDirectory(String configToolDirectory) {
setOption("configdir", configToolDirectory); setOption("configdir", configToolDirectory);
} }
@Override
public String getConfigToolDirectory() { public String getConfigToolDirectory() {
IConfigureOption option = configOptions.get("configdir"); IConfigureOption option = configOptions.get("configdir");
return option.getValue(); return option.getValue();
} }
@Override
public void setDefaultOptions() { public void setDefaultOptions() {
initConfigOptions(); initConfigOptions();
} }

View file

@ -28,7 +28,6 @@ import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.ParserConfigurationException;
import org.eclipse.cdt.autotools.core.AutotoolsNewProjectNature; import org.eclipse.cdt.autotools.core.AutotoolsNewProjectNature;
import org.eclipse.cdt.autotools.core.AutotoolsOptionConstants;
import org.eclipse.cdt.autotools.core.AutotoolsPlugin; import org.eclipse.cdt.autotools.core.AutotoolsPlugin;
import org.eclipse.cdt.autotools.core.IAutotoolsOption; import org.eclipse.cdt.autotools.core.IAutotoolsOption;
import org.eclipse.cdt.core.model.CoreModel; import org.eclipse.cdt.core.model.CoreModel;
@ -85,8 +84,8 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
private static Map<String, Map<String, IAConfiguration>> tmpConfigs; private static Map<String, Map<String, IAConfiguration>> tmpConfigs;
private AutotoolsConfigurationManager() { private AutotoolsConfigurationManager() {
configs = new HashMap<String, Map<String, IAConfiguration>>(); configs = new HashMap<>();
tmpConfigs = new HashMap<String, Map<String, IAConfiguration>>(); tmpConfigs = new HashMap<>();
AutotoolsPlugin.getWorkspace().addResourceChangeListener(this); AutotoolsPlugin.getWorkspace().addResourceChangeListener(this);
} }
@ -98,8 +97,7 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
} }
public synchronized IAConfiguration createDefaultConfiguration(IProject project, String id) { public synchronized IAConfiguration createDefaultConfiguration(IProject project, String id) {
IAConfiguration cfg = new AutotoolsConfiguration(id); return new AutotoolsConfiguration(id);
return cfg;
} }
public synchronized IAConfiguration findCfg(IProject p, String id) { public synchronized IAConfiguration findCfg(IProject p, String id) {
@ -138,7 +136,7 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
String projectName = project.getName(); String projectName = project.getName();
Map<String, IAConfiguration> cfgs = getSavedConfigs(project); Map<String, IAConfiguration> cfgs = getSavedConfigs(project);
if (cfgs == null) { if (cfgs == null) {
cfgs = new HashMap<String, IAConfiguration>(); cfgs = new HashMap<>();
configs.put(projectName, cfgs); configs.put(projectName, cfgs);
} }
cfgs.put(cfg.getId(), cfg); cfgs.put(cfg.getId(), cfg);
@ -167,7 +165,7 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
clearTmpConfigurations(project); clearTmpConfigurations(project);
ICProjectDescription pd = CoreModel.getDefault().getProjectDescription(project); ICProjectDescription pd = CoreModel.getDefault().getProjectDescription(project);
ICConfigurationDescription[] cfgs = pd.getConfigurations(); ICConfigurationDescription[] cfgs = pd.getConfigurations();
Map <String, IAConfiguration> newCfgList = new HashMap<String, IAConfiguration>(); Map<String, IAConfiguration> newCfgList = new HashMap<>();
for (int i = 0; i < cfgs.length; ++i) { for (int i = 0; i < cfgs.length; ++i) {
cfgs[i].getConfigurationData(); cfgs[i].getConfigurationData();
IAConfiguration acfg = getTmpConfiguration(project, cfgs[i]); IAConfiguration acfg = getTmpConfiguration(project, cfgs[i]);
@ -197,7 +195,7 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
try { try {
IPath fileLocation = project.getLocation().append(CFG_FILE_NAME); IPath fileLocation = project.getLocation().append(CFG_FILE_NAME);
File dirFile = fileLocation.toFile(); File dirFile = fileLocation.toFile();
Map<String, IAConfiguration> cfgList = new HashMap<String, IAConfiguration>(); Map<String, IAConfiguration> cfgList = new HashMap<>();
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder(); DocumentBuilder db = dbf.newDocumentBuilder();
if (dirFile.exists()) { if (dirFile.exists()) {
@ -329,7 +327,7 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
private Map<String, IAConfiguration> getTmpConfigs(IProject p) { private Map<String, IAConfiguration> getTmpConfigs(IProject p) {
Map <String, IAConfiguration> tmpList = tmpConfigs.get(p.getName()); Map <String, IAConfiguration> tmpList = tmpConfigs.get(p.getName());
if (tmpList == null) { if (tmpList == null) {
tmpList = new HashMap<String, IAConfiguration>(); tmpList = new HashMap<>();
tmpConfigs.put(p.getName(), tmpList); tmpConfigs.put(p.getName(), tmpList);
} }
return tmpList; return tmpList;
@ -357,7 +355,7 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
if (tool.getName().equals("configure")) { //$NON-NLS-1$ if (tool.getName().equals("configure")) { //$NON-NLS-1$
IOption option = IOption option =
tool.getOptionBySuperClassId("org.eclipse.linuxtools.cdt.autotools.core.option.configure.name"); // $NON-NLS-1$ tool.getOptionBySuperClassId("org.eclipse.linuxtools.cdt.autotools.core.option.configure.name"); // $NON-NLS-1$
IHoldsOptions h = (IHoldsOptions)tool; IHoldsOptions h = tool;
try { try {
IOption optionToSet = h.getOptionToSet(option, false); IOption optionToSet = h.getOptionToSet(option, false);
optionToSet.setValue(id); optionToSet.setValue(id);
@ -441,7 +439,7 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
public synchronized void applyConfigs(String projectName, ICConfigurationDescription[] cfgds) { public synchronized void applyConfigs(String projectName, ICConfigurationDescription[] cfgds) {
try { try {
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IResource res = (IProject)root.findMember(projectName, false); IResource res = root.findMember(projectName, false);
if (res == null || res.getType() != IResource.PROJECT) { if (res == null || res.getType() != IResource.PROJECT) {
AutotoolsPlugin.logErrorMessage(ConfigureMessages.getFormattedString(CFG_CANT_SAVE, AutotoolsPlugin.logErrorMessage(ConfigureMessages.getFormattedString(CFG_CANT_SAVE,
new String[]{projectName})); new String[]{projectName}));
@ -461,7 +459,7 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
p.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); //$NON-NLS-1$ p.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); //$NON-NLS-1$
p.println("<configurations>"); // $NON-NLS-1$ p.println("<configurations>"); // $NON-NLS-1$
Option[] optionList = AutotoolsConfiguration.getOptionList(); Option[] optionList = AutotoolsConfiguration.getOptionList();
HashSet<String> savedIds = new HashSet<String>(); HashSet<String> savedIds = new HashSet<>();
setSyncing(true); setSyncing(true);
for (int x = 0; x < cfgds.length; ++x) { for (int x = 0; x < cfgds.length; ++x) {
ICConfigurationDescription cfgd = cfgds[x]; ICConfigurationDescription cfgd = cfgds[x];
@ -513,12 +511,13 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
public synchronized Map<String, IAConfiguration> getConfigurations(IProject project) { public synchronized Map<String, IAConfiguration> getConfigurations(IProject project) {
Map<String, IAConfiguration> list = getSavedConfigs(project); Map<String, IAConfiguration> list = getSavedConfigs(project);
if (list == null) { if (list == null) {
list = new HashMap<String, IAConfiguration>(); list = new HashMap<>();
configs.put(project.getName(), list); configs.put(project.getName(), list);
} }
return list; return list;
} }
@Override
public synchronized void resourceChanged(IResourceChangeEvent event) { public synchronized void resourceChanged(IResourceChangeEvent event) {
IResource res = event.getResource(); IResource res = event.getResource();
if (!(res instanceof IProject)) if (!(res instanceof IProject))
@ -628,13 +627,13 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
} }
IAConfiguration cfg = getConfiguration(project, cfgId); IAConfiguration cfg = getConfiguration(project, cfgId);
HashMap<String, IAutotoolsOption> options = new HashMap<String, IAutotoolsOption>(); HashMap<String, IAutotoolsOption> options = new HashMap<>();
// Get set of configuration options and convert to set of IAutotoolOptions // Get set of configuration options and convert to set of IAutotoolOptions
Map<String, IConfigureOption> cfgOptions = cfg.getOptions(); Map<String, IConfigureOption> cfgOptions = cfg.getOptions();
IAConfiguration dummyCfg = createDefaultConfiguration(project, createDummyId()); IAConfiguration dummyCfg = createDefaultConfiguration(project, createDummyId());
for (Iterator<Entry<String, IConfigureOption>> i = cfgOptions.entrySet().iterator(); i.hasNext();) { for (Iterator<Entry<String, IConfigureOption>> i = cfgOptions.entrySet().iterator(); i.hasNext();) {
Map.Entry<String, IConfigureOption> entry = (Entry<String, IConfigureOption>) i.next(); Map.Entry<String, IConfigureOption> entry = i.next();
String name = entry.getKey(); String name = entry.getKey();
IAutotoolsOption configOption = IAutotoolsOption configOption =
new AutotoolsOption(entry.getValue().copy((AutotoolsConfiguration)dummyCfg)); new AutotoolsOption(entry.getValue().copy((AutotoolsConfiguration)dummyCfg));
@ -665,7 +664,7 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
// Get set of configuration options and convert to set of IAutotoolOptions // Get set of configuration options and convert to set of IAutotoolOptions
for (Iterator<Entry<String, IAutotoolsOption>> i = options.entrySet().iterator(); i.hasNext();) { for (Iterator<Entry<String, IAutotoolsOption>> i = options.entrySet().iterator(); i.hasNext();) {
Map.Entry<String, IAutotoolsOption> entry = (Entry<String, IAutotoolsOption>) i.next(); Map.Entry<String, IAutotoolsOption> entry = i.next();
String name = entry.getKey(); String name = entry.getKey();
IAutotoolsOption option = entry.getValue(); IAutotoolsOption option = entry.getValue();
IConfigureOption cfgOption = cfg.getOption(name); IConfigureOption cfgOption = cfg.getOption(name);

View file

@ -27,9 +27,6 @@ import org.eclipse.core.runtime.CoreException;
public class AutotoolsOptionValueHandler extends ManagedOptionValueHandler public class AutotoolsOptionValueHandler extends ManagedOptionValueHandler
implements IOptionApplicability { implements IOptionApplicability {
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IManagedOptionValueHandler#handleValue(IConfiguration,IToolChain,IOption,String,int)
*/
public final static String DEFAULT_BUILD_DIR = "build"; //$NON-NLS-1$ public final static String DEFAULT_BUILD_DIR = "build"; //$NON-NLS-1$
public final static String CONFIGURE_TOOL_ID = "org.eclipse.linuxtools.cdt.autotools.core.gnu.toolchain.tool.configure"; //$NON-NLS-1$ public final static String CONFIGURE_TOOL_ID = "org.eclipse.linuxtools.cdt.autotools.core.gnu.toolchain.tool.configure"; //$NON-NLS-1$
@ -40,6 +37,7 @@ public class AutotoolsOptionValueHandler extends ManagedOptionValueHandler
public final static String BUILD_DIR_NO = "BuildDir.no"; //$NON-NLS-1$ public final static String BUILD_DIR_NO = "BuildDir.no"; //$NON-NLS-1$
//FIXME: Use holder to set option value, not the "option" parameter //FIXME: Use holder to set option value, not the "option" parameter
@Override
public boolean handleValue(IBuildObject buildObject, public boolean handleValue(IBuildObject buildObject,
IHoldsOptions holder, IHoldsOptions holder,
IOption option, IOption option,
@ -104,16 +102,19 @@ public class AutotoolsOptionValueHandler extends ManagedOptionValueHandler
// IOptionApplicability methods // IOptionApplicability methods
@Override
public boolean isOptionEnabled(IBuildObject configuration, public boolean isOptionEnabled(IBuildObject configuration,
IHoldsOptions holder, IOption option) { IHoldsOptions holder, IOption option) {
return true; return true;
} }
@Override
public boolean isOptionUsedInCommandLine(IBuildObject configuration, public boolean isOptionUsedInCommandLine(IBuildObject configuration,
IHoldsOptions holder, IOption option) { IHoldsOptions holder, IOption option) {
return false; return false;
} }
@Override
public boolean isOptionVisible(IBuildObject configuration, public boolean isOptionVisible(IBuildObject configuration,
IHoldsOptions holder, IOption option) { IHoldsOptions holder, IOption option) {
return true; return true;

View file

@ -27,10 +27,12 @@ public class BinConfigureOption extends AbstractConfigurationOption {
this.value = value; this.value = value;
} }
@Override
public boolean isParmSet() { public boolean isParmSet() {
return value; return value;
} }
@Override
public String getParameter() { public String getParameter() {
if (isParmSet()) if (isParmSet())
return getParameterName(); return getParameterName();
@ -38,10 +40,12 @@ public class BinConfigureOption extends AbstractConfigurationOption {
return ""; // $NON-NLS-1$ return ""; // $NON-NLS-1$
} }
@Override
public String getValue() { public String getValue() {
return Boolean.toString(value); return Boolean.toString(value);
} }
@Override
public void setValue(String value) { public void setValue(String value) {
boolean oldValue = this.value; boolean oldValue = this.value;
if (value.equals("true")) // $NON-NLS-1$ if (value.equals("true")) // $NON-NLS-1$
@ -52,10 +56,12 @@ public class BinConfigureOption extends AbstractConfigurationOption {
cfg.setDirty(true); cfg.setDirty(true);
} }
@Override
public IConfigureOption copy(AutotoolsConfiguration config) { public IConfigureOption copy(AutotoolsConfiguration config) {
return new BinConfigureOption(name, config, value); return new BinConfigureOption(name, config, value);
} }
@Override
public int getType() { public int getType() {
return BIN; return BIN;
} }

View file

@ -20,58 +20,72 @@ public class ConfigureOptionCategory implements IConfigureOption {
this.name = name; this.name = name;
} }
@Override
public IConfigureOption copy(AutotoolsConfiguration config) { public IConfigureOption copy(AutotoolsConfiguration config) {
return new ConfigureOptionCategory(name); return new ConfigureOptionCategory(name);
} }
@Override
public String getDescription() { public String getDescription() {
return ConfigureMessages.getConfigureDescription(name); return ConfigureMessages.getConfigureDescription(name);
} }
@Override
public String getName() { public String getName() {
return name; return name;
} }
@Override
public String getParameter() { public String getParameter() {
return ""; return "";
} }
@Override
public ArrayList<String> getParameters() { public ArrayList<String> getParameters() {
return new ArrayList<String>(); return new ArrayList<>();
} }
@Override
public String getToolTip() { public String getToolTip() {
return ""; return "";
} }
@Override
public String getValue() { public String getValue() {
return "null"; return "null";
} }
@Override
public boolean isCategory() { public boolean isCategory() {
return true; return true;
} }
@Override
public boolean isParmSet() { public boolean isParmSet() {
return false; return false;
} }
@Override
public void setValue(String value) { public void setValue(String value) {
// Do nothing..nothing to set // Do nothing..nothing to set
} }
@Override
public boolean isMultiArg() { public boolean isMultiArg() {
return false; return false;
} }
@Override
public boolean isFlag() { public boolean isFlag() {
return false; return false;
} }
@Override
public boolean isFlagValue() { public boolean isFlagValue() {
return false; return false;
} }
@Override
public int getType() { public int getType() {
return CATEGORY; return CATEGORY;
} }

View file

@ -31,10 +31,12 @@ public class ConfigureTool extends AbstractConfigurationOption {
this.value = value; this.value = value;
} }
@Override
public String getValue() { public String getValue() {
return value; return value;
} }
@Override
public void setValue(String newValue) { public void setValue(String newValue) {
if (!newValue.equals(value)) { if (!newValue.equals(value)) {
cfg.setDirty(true); cfg.setDirty(true);
@ -42,22 +44,27 @@ public class ConfigureTool extends AbstractConfigurationOption {
} }
} }
@Override
public boolean isParmSet() { public boolean isParmSet() {
return false; return false;
} }
@Override
public String getParameter() { public String getParameter() {
return ""; // $NON-NLS-1$ return ""; // $NON-NLS-1$
} }
@Override
public ArrayList<String> getParameters() { public ArrayList<String> getParameters() {
return new ArrayList<String>(); return new ArrayList<>();
} }
@Override
public IConfigureOption copy(AutotoolsConfiguration config) { public IConfigureOption copy(AutotoolsConfiguration config) {
return new ConfigureTool(name, config, value); return new ConfigureTool(name, config, value);
} }
@Override
public int getType() { public int getType() {
return TOOL; return TOOL;
} }

View file

@ -17,7 +17,7 @@ public class FlagConfigureOption extends AbstractConfigurationOption {
private String value; private String value;
private ArrayList<String> children = private ArrayList<String> children =
new ArrayList<String>(); new ArrayList<>();
public FlagConfigureOption(String name, AutotoolsConfiguration cfg) { public FlagConfigureOption(String name, AutotoolsConfiguration cfg) {
super(name, cfg); super(name, cfg);
@ -37,6 +37,7 @@ public class FlagConfigureOption extends AbstractConfigurationOption {
this.children = (ArrayList<String>)children.clone(); this.children = (ArrayList<String>)children.clone();
} }
@Override
public String getParameter() { public String getParameter() {
StringBuffer parms = new StringBuffer(); StringBuffer parms = new StringBuffer();
// Multiple flags are designated by putting multiple flags together using "|" as delimiter // Multiple flags are designated by putting multiple flags together using "|" as delimiter
@ -69,10 +70,12 @@ public class FlagConfigureOption extends AbstractConfigurationOption {
return parms.toString(); return parms.toString();
} }
@Override
public String getParameterName() { public String getParameterName() {
return getName(); return getName();
} }
@Override
public boolean isParmSet() { public boolean isParmSet() {
for (int i = 0; i < children.size(); ++i) { for (int i = 0; i < children.size(); ++i) {
String s = children.get(i); String s = children.get(i);
@ -83,23 +86,28 @@ public class FlagConfigureOption extends AbstractConfigurationOption {
return false; return false;
} }
@Override
public void setValue(String value) { public void setValue(String value) {
this.value = value; this.value = value;
} }
@Override
public IConfigureOption copy(AutotoolsConfiguration config) { public IConfigureOption copy(AutotoolsConfiguration config) {
FlagConfigureOption f = new FlagConfigureOption(name, config, value, children); FlagConfigureOption f = new FlagConfigureOption(name, config, value, children);
return f; return f;
} }
@Override
public String getValue() { public String getValue() {
return value; return value;
} }
@Override
public int getType() { public int getType() {
return FLAG; return FLAG;
} }
@Override
public boolean isFlag() { public boolean isFlag() {
return true; return true;
} }

View file

@ -29,26 +29,32 @@ public class FlagValueConfigureOption extends BinConfigureOption implements IFla
this.flags = flags; this.flags = flags;
} }
@Override
public ArrayList<String> getParameters() { public ArrayList<String> getParameters() {
return new ArrayList<String>(); return new ArrayList<>();
} }
@Override
public String getParameter() { public String getParameter() {
return ""; return "";
} }
@Override
public IConfigureOption copy(AutotoolsConfiguration cfg) { public IConfigureOption copy(AutotoolsConfiguration cfg) {
return new FlagValueConfigureOption(name, cfg, getValue(), flags); return new FlagValueConfigureOption(name, cfg, getValue(), flags);
} }
@Override
public int getType() { public int getType() {
return FLAGVALUE; return FLAGVALUE;
} }
@Override
public String getFlags() { public String getFlags() {
return flags; return flags;
} }
@Override
public boolean isFlagValue() { public boolean isFlagValue() {
return true; return true;
} }

View file

@ -30,10 +30,12 @@ public class InternalConfigureOption extends AbstractConfigurationOption {
this.value = value; this.value = value;
} }
@Override
public String getValue() { public String getValue() {
return value; return value;
} }
@Override
public void setValue(String newValue) { public void setValue(String newValue) {
if (!newValue.equals(value)) { if (!newValue.equals(value)) {
cfg.setDirty(true); cfg.setDirty(true);
@ -41,18 +43,22 @@ public class InternalConfigureOption extends AbstractConfigurationOption {
} }
} }
@Override
public boolean isParmSet() { public boolean isParmSet() {
return false; return false;
} }
@Override
public String getParameter() { public String getParameter() {
return ""; return "";
} }
@Override
public IConfigureOption copy(AutotoolsConfiguration config) { public IConfigureOption copy(AutotoolsConfiguration config) {
return new InternalConfigureOption(name, config, value); return new InternalConfigureOption(name, config, value);
} }
@Override
public int getType() { public int getType() {
return INTERNAL; return INTERNAL;
} }

View file

@ -35,10 +35,12 @@ public class MultiArgConfigureOption extends AbstractConfigurationOption {
this.value = value; this.value = value;
} }
@Override
public String getValue() { public String getValue() {
return value; return value;
} }
@Override
public void setValue(String newValue) { public void setValue(String newValue) {
if (!newValue.equals(value)) { if (!newValue.equals(value)) {
cfg.setDirty(true); cfg.setDirty(true);
@ -47,25 +49,29 @@ public class MultiArgConfigureOption extends AbstractConfigurationOption {
} }
} }
@Override
public boolean isParmSet() { public boolean isParmSet() {
return value.length() > 0; return value.length() > 0;
} }
@Override
public boolean isMultiArg() { public boolean isMultiArg() {
return true; return true;
} }
@Override
public String getParameter() { public String getParameter() {
return value; return value;
} }
@Override
public ArrayList<String> getParameters() { public ArrayList<String> getParameters() {
// May be multiple user-specified options in which case we // May be multiple user-specified options in which case we
// need to split them up into individual options // need to split them up into individual options
if (!isDirty && userArgs != null) if (!isDirty && userArgs != null)
return userArgs; return userArgs;
// Otherwise, we need to calculate userArgs // Otherwise, we need to calculate userArgs
userArgs = new ArrayList<String>(); userArgs = new ArrayList<>();
isDirty = false; isDirty = false;
int lastArgIndex = -1; int lastArgIndex = -1;
int i = 0; int i = 0;
@ -109,10 +115,12 @@ public class MultiArgConfigureOption extends AbstractConfigurationOption {
return userArgs; return userArgs;
} }
@Override
public IConfigureOption copy(AutotoolsConfiguration config) { public IConfigureOption copy(AutotoolsConfiguration config) {
return new MultiArgConfigureOption(name, config, value); return new MultiArgConfigureOption(name, config, value);
} }
@Override
public int getType() { public int getType() {
return MULTIARG; return MULTIARG;
} }

View file

@ -31,10 +31,12 @@ public class StringConfigureOption extends AbstractConfigurationOption {
this.value = value; this.value = value;
} }
@Override
public String getValue() { public String getValue() {
return value; return value;
} }
@Override
public void setValue(String newValue) { public void setValue(String newValue) {
if (!newValue.equals(value)) { if (!newValue.equals(value)) {
cfg.setDirty(true); cfg.setDirty(true);
@ -42,20 +44,24 @@ public class StringConfigureOption extends AbstractConfigurationOption {
} }
} }
@Override
public boolean isParmSet() { public boolean isParmSet() {
return value.length() > 0; return value.length() > 0;
} }
@Override
public String getParameter() { public String getParameter() {
if (isParmSet()) if (isParmSet())
return getParameterName() + "=" + getValue(); // $NON-NLS-1$ return getParameterName() + "=" + getValue(); // $NON-NLS-1$
return ""; return "";
} }
@Override
public IConfigureOption copy(AutotoolsConfiguration config) { public IConfigureOption copy(AutotoolsConfiguration config) {
return new StringConfigureOption(name, config, value); return new StringConfigureOption(name, config, value);
} }
@Override
public int getType() { public int getType() {
return STRING; return STRING;
} }

View file

@ -50,6 +50,7 @@ public class NewAutotoolsProject extends ProcessRunner {
pca = new ProjectCreatedActions(); pca = new ProjectCreatedActions();
} }
@Override
public void process(TemplateCore template, ProcessArgument[] args, String processId, IProgressMonitor monitor) throws ProcessFailureException { public void process(TemplateCore template, ProcessArgument[] args, String processId, IProgressMonitor monitor) throws ProcessFailureException {
String projectName = args[0].getSimpleValue(); String projectName = args[0].getSimpleValue();
String location = args[1].getSimpleValue(); String location = args[1].getSimpleValue();
@ -76,7 +77,7 @@ public class NewAutotoolsProject extends ProcessRunner {
pca.setProject(project); pca.setProject(project);
pca.setProjectLocation(locationPath); pca.setProjectLocation(locationPath);
pca.setConfigs((IConfiguration[]) configs.toArray(new IConfiguration[configs.size()])); pca.setConfigs(configs.toArray(new IConfiguration[configs.size()]));
pca.setArtifactExtension(artifactExtension); pca.setArtifactExtension(artifactExtension);
info = pca.createProject(monitor, CCorePlugin.DEFAULT_INDEXER, isCProject); info = pca.createProject(monitor, CCorePlugin.DEFAULT_INDEXER, isCProject);

View file

@ -12,16 +12,13 @@
package org.eclipse.cdt.internal.autotools.core.wizards; package org.eclipse.cdt.internal.autotools.core.wizards;
import org.eclipse.cdt.autotools.core.AutotoolsPlugin;
import org.eclipse.cdt.core.model.CoreModel; import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.templateengine.TemplateCore; import org.eclipse.cdt.core.templateengine.TemplateCore;
import org.eclipse.cdt.core.templateengine.process.ProcessArgument; import org.eclipse.cdt.core.templateengine.process.ProcessArgument;
import org.eclipse.cdt.core.templateengine.process.ProcessFailureException;
import org.eclipse.cdt.core.templateengine.process.ProcessRunner; import org.eclipse.cdt.core.templateengine.process.ProcessRunner;
import org.eclipse.cdt.internal.autotools.core.configure.AutotoolsConfigurationManager; import org.eclipse.cdt.internal.autotools.core.configure.AutotoolsConfigurationManager;
import org.eclipse.cdt.internal.autotools.core.configure.IAConfiguration; import org.eclipse.cdt.internal.autotools.core.configure.IAConfiguration;
import org.eclipse.cdt.managedbuilder.core.BuildException;
import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceDescription; import org.eclipse.core.resources.IWorkspaceDescription;
@ -31,7 +28,8 @@ import org.eclipse.core.runtime.IProgressMonitor;
public class SetAutotoolsStringOptionValue extends ProcessRunner { public class SetAutotoolsStringOptionValue extends ProcessRunner {
public void process(TemplateCore template, ProcessArgument[] args, String processId, IProgressMonitor monitor) throws ProcessFailureException { @Override
public void process(TemplateCore template, ProcessArgument[] args, String processId, IProgressMonitor monitor) {
String projectName = args[0].getSimpleValue(); String projectName = args[0].getSimpleValue();
IProject projectHandle = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); IProject projectHandle = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspace workspace = ResourcesPlugin.getWorkspace();
@ -48,11 +46,7 @@ public class SetAutotoolsStringOptionValue extends ProcessRunner {
ProcessArgument[] resourcePathObject = resourcePathObjects[i]; ProcessArgument[] resourcePathObject = resourcePathObjects[i];
String id = resourcePathObject[0].getSimpleValue(); String id = resourcePathObject[0].getSimpleValue();
String value = resourcePathObject[1].getSimpleValue(); String value = resourcePathObject[1].getSimpleValue();
try {
setOptionValue(projectHandle, id, value); setOptionValue(projectHandle, id, value);
} catch (BuildException e) {
throw new ProcessFailureException(AutotoolsPlugin.getFormattedString("SetAutotoolsStringOptionValue.error", new String[]{e.getMessage()}), e); //$NON-NLS-1$
}
} }
workspaceDesc.setAutoBuilding(autoBuilding); workspaceDesc.setAutoBuilding(autoBuilding);
@ -62,8 +56,7 @@ public class SetAutotoolsStringOptionValue extends ProcessRunner {
} }
} }
private void setOptionValue(IProject projectHandle, String id, String private void setOptionValue(IProject projectHandle, String id, String value) {
value) throws BuildException, ProcessFailureException {
AutotoolsConfigurationManager.getInstance().syncConfigurations(projectHandle); AutotoolsConfigurationManager.getInstance().syncConfigurations(projectHandle);
ICConfigurationDescription[] cfgds = ICConfigurationDescription[] cfgds =