1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 09:25:31 +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
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.targetPlatform=1.7
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.localVariable=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.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.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

View file

@ -1,3 +1,61 @@
#Tue Jan 02 14:11:13 EST 2007
eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
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;
/* (non-Javadoc)
* @see org.eclipse.core.resources.IProjectNature#configure()
*/
@Override
public void configure() throws CoreException {
addAutotoolsBuilder(project, new NullProgressMonitor());
}
/* (non-Javadoc)
* @see org.eclipse.core.resources.IProjectNature#deconfigure()
*/
@Override
public void deconfigure() throws CoreException {
// TODO remove builder from here
}
/* (non-Javadoc)
* @see org.eclipse.core.resources.IProjectNature#getProject()
*/
@Override
public IProject getProject() {
return project;
}
/* (non-Javadoc)
* @see org.eclipse.core.resources.IProjectNature#setProject(org.eclipse.core.resources.IProject)
*/
@Override
public void setProject(IProject project) {
this.project = project;
@ -161,7 +149,7 @@ public class AutotoolsNewProjectNature implements IProjectNature {
static ICommand[] getBuildCommandsList(IProjectDescription description,
ICommand[] commands) {
ArrayList<ICommand> commandList = new ArrayList<ICommand>();
ArrayList<ICommand> commandList = new ArrayList<>();
// Make sure the Autotools Configuration builder just precedes the Common Builder
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 {
IProjectDescription description = project.getDescription();
String[] prevNatures = description.getNatureIds();
List<String> newNatures = new ArrayList<String>(Arrays.asList(prevNatures));
List<String> newNatures = new ArrayList<>(Arrays.asList(prevNatures));
newNatures.remove(natureId);
description.setNatureIds(newNatures.toArray(new String[newNatures.size()]));
project.setDescription(description, monitor);

View file

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

View file

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

View file

@ -42,14 +42,15 @@ public class AutotoolsEnvironmentVariableSupplier implements IConfigurationEnvir
: 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);
}
}
@Override
public IBuildEnvironmentVariable[] getVariables(IConfiguration configuration,
IEnvironmentVariableProvider provider) {
IBuildEnvironmentVariable path = VerboseEnvironmentVariable.create(configuration);
IBuildEnvironmentVariable path = VerboseEnvironmentVariable.create();
return new IBuildEnvironmentVariable[] { path };
}
@ -57,7 +58,7 @@ public class AutotoolsEnvironmentVariableSupplier implements IConfigurationEnvir
public IBuildEnvironmentVariable getVariable(String variableName, IConfiguration configuration,
IEnvironmentVariableProvider provider) {
if (VerboseEnvironmentVariable.isVar(variableName)) {
return VerboseEnvironmentVariable.create(configuration);
return VerboseEnvironmentVariable.create();
} else {
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.ITarget;
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.IConfiguration;
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.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.IResourceStatus;
import org.eclipse.core.resources.IWorkspaceRoot;
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.SubProgressMonitor;
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.IRemoteResource;
import org.eclipse.remote.core.IRemoteServicesManager;
@ -130,12 +126,12 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
private IBuilder builder;
public void generateDependencies() throws CoreException {
public void generateDependencies() {
// TODO Auto-generated method stub
}
public MultiStatus generateMakefiles(IResourceDelta delta)
public MultiStatus generateMakefiles()
throws CoreException {
return regenerateMakefiles(false);
}
@ -175,12 +171,12 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
return project;
}
public boolean isGeneratedResource(IResource resource) {
public boolean isGeneratedResource() {
// TODO Auto-generated method stub
return false;
}
public void regenerateDependencies(boolean force) throws CoreException {
public void regenerateDependencies() {
// TODO Auto-generated method stub
}
@ -257,8 +253,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
}
private void refresh() throws CoreException{
IRemoteResource remRes =
(IRemoteResource)getProject().getAdapter(IRemoteResource.class);
IRemoteResource remRes = getProject().getAdapter(IRemoteResource.class);
if (remRes != null) {
remRes.refresh(new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN));
}
@ -485,12 +480,12 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
}
}
ArrayList<String> configureEnvs = new ArrayList<String>();
ArrayList<String> configureCmdParms = new ArrayList<String>();
ArrayList<String> configureEnvs = new ArrayList<>();
ArrayList<String> configureCmdParms = new ArrayList<>();
IPath configurePath = getConfigurePath(configureEnvs, configureCmdParms);
String[] configArgs = getConfigArgs(configureCmdParms);
ArrayList<String> autogenEnvs = new ArrayList<String>();
ArrayList<String> autogenCmdParms = new ArrayList<String>();
ArrayList<String> autogenEnvs = new ArrayList<>();
ArrayList<String> autogenCmdParms = new ArrayList<>();
IPath autogenPath = getAutogenPath(autogenEnvs, autogenCmdParms);
// 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).
private int runCommand(IPath commandPath, IPath runPath, String[] args,
String jobDescription, String errMsg, IConsole console,
boolean consoleStart) throws BuildException, CoreException,
NullPointerException, IOException {
private int runCommand(IPath commandPath, IPath runPath, String[] args, String jobDescription, String errMsg,
IConsole console, boolean consoleStart) throws CoreException, NullPointerException, IOException {
int rc = IStatus.OK;
@ -876,7 +869,6 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
"MakeGenerator.make.message", msgs)); //$NON-NLS-1$
ConsoleOutputStream consoleOutStream = null;
ErrorParserManager epm = null;
StringBuffer buf = new StringBuffer();
@ -884,8 +876,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
if (consoleStart)
console.start(project);
try {
consoleOutStream = console.getOutputStream();
try (ConsoleOutputStream consoleOutStream = console.getOutputStream()) {
String[] consoleHeader = new String[3];
consoleHeader[0] = jobDescription;
@ -906,7 +897,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
IEnvironmentVariable variables[] =
CCorePlugin.getDefault().getBuildEnvironmentManager().getVariables(cdesc, true);
String[] env = null;
ArrayList<String> envList = new ArrayList<String>();
ArrayList<String> envList = new ArrayList<>();
if (variables != null) {
for (int i = 0; i < variables.length; i++) {
envList.add(variables[i].getName()
@ -917,7 +908,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
// Hook up an error parser manager
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.addErrorParser(ErrorParser.ID, new ErrorParser(getSourcePath(), getBuildPath()));
@ -1018,8 +1009,6 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
// epm.reportProblems();
} finally {
if (consoleOutStream != null)
consoleOutStream.close();
if (epm != null)
epm.close();
}
@ -1044,7 +1033,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
IEnvironmentVariable variables[] =
CCorePlugin.getDefault().getBuildEnvironmentManager().getVariables(cdesc, true);
String[] env = new String[0];
ArrayList<String> envList = new ArrayList<String>();
ArrayList<String> envList = new ArrayList<>();
if (variables != null) {
for (int i = 0; i < variables.length; i++) {
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
private String getOSName() {
IRemoteResource remRes =
(IRemoteResource)getProject().getAdapter(IRemoteResource.class);
IRemoteResource remRes = getProject().getAdapter(IRemoteResource.class);
if (remRes != null) {
URI uri = remRes.getActiveLocationURI();
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).
private int runScript(IPath commandPath, IPath runPath, String[] args,
String jobDescription, String errMsg, IConsole console,
ArrayList<String> additionalEnvs,
boolean consoleStart) throws BuildException, CoreException,
NullPointerException, IOException {
private int runScript(IPath commandPath, IPath runPath, String[] args, String jobDescription, String errMsg,
IConsole console, ArrayList<String> additionalEnvs, boolean consoleStart)
throws CoreException, NullPointerException, IOException {
int rc = IStatus.OK;
boolean removePWD = false;
@ -1190,7 +1176,6 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
"MakeGenerator.make.message", msgs)); //$NON-NLS-1$
ConsoleOutputStream consoleOutStream = null;
ErrorParserManager epm = null;
StringBuffer buf = new StringBuffer();
@ -1198,8 +1183,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
if (consoleStart)
console.start(project);
try {
consoleOutStream = console.getOutputStream();
try (ConsoleOutputStream consoleOutStream = console.getOutputStream()) {
String[] consoleHeader = new String[3];
consoleHeader[0] = jobDescription;
@ -1234,7 +1218,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
IEnvironmentVariable variables[] =
CCorePlugin.getDefault().getBuildEnvironmentManager().getVariables(cdesc, true);
String[] env = null;
ArrayList<String> envList = new ArrayList<String>();
ArrayList<String> envList = new ArrayList<>();
if (variables != null) {
for (int i = 0; i < variables.length; i++) {
// 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
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.addErrorParser(ErrorParser.ID, new ErrorParser(getSourcePath(), getBuildPath()));
@ -1364,8 +1348,6 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
// .getResourceString(MARKERS));
// epm.reportProblems();
} finally {
if (consoleOutStream != null)
consoleOutStream.close();
if (epm != null)
epm.close();
}
@ -1467,7 +1449,10 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
IMakefile makefile = MakeCorePlugin.createMakefile(makefileFile.toURI(), false, null);
ITargetRule[] targets = makefile.getTargetRules();
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());
if (id.length == 0) {
return;
@ -1492,7 +1477,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
for (int i = 0; i < targets.length; i++) {
target = targets[i].getTarget();
String targetName = target.toString();
if (!isValidTarget(targetName, makeTargetManager))
if (!isValidTarget(targetName))
continue;
try {
// Bug #351660 - always create a new MakeTarget because an
@ -1505,15 +1490,15 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
makeTarget.setStopOnError(isStopOnError);
makeTarget.setRunAllBuilders(false);
makeTarget.setUseDefaultBuildCmd(true);
makeTarget.setBuildAttribute(IMakeTarget.BUILD_ARGUMENTS, buildArguments);
makeTarget.setBuildAttribute(IMakeTarget.BUILD_COMMAND, defaultBuildCommand);
makeTarget.setBuildAttribute(IMakeCommonBuildInfo.BUILD_ARGUMENTS, buildArguments);
makeTarget.setBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND, defaultBuildCommand);
makeTarget.setBuildAttribute(GENERATED_TARGET, "true"); //$NON-NLS-1$
makeTarget.setBuildAttribute(IMakeTarget.BUILD_TARGET,
targetName);
//TODO: should this be raw build directory in macro form?
makeTarget.setBuildAttribute(IMakeTarget.BUILD_LOCATION,
makeTarget.setBuildAttribute(IMakeCommonBuildInfo.BUILD_LOCATION,
buildDir);
makeTargets.put(makeTarget.getName(), makeTarget);
} catch (CoreException e) {
@ -1523,7 +1508,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
IMakeTarget[] makeTargetArray = new IMakeTarget[makeTargets.size()];
Collection<IMakeTarget> values = makeTargets.values();
ArrayList<IMakeTarget> valueList = new ArrayList<IMakeTarget>(values);
ArrayList<IMakeTarget> valueList = new ArrayList<>(values);
valueList.toArray(makeTargetArray);
MakeTargetComparator compareMakeTargets = new MakeTargetComparator();
Arrays.sort(makeTargetArray, compareMakeTargets);
@ -1552,7 +1537,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
saveTargets(makeTargetArray);
}
private boolean isValidTarget(String targetName, IMakeTargetManager makeTargetManager) {
private boolean isValidTarget(String targetName) {
return !(targetName.endsWith("-am") //$NON-NLS-1$
|| targetName.endsWith("PROGRAMS") //$NON-NLS-1$
|| targetName.endsWith("-generic") //$NON-NLS-1$
@ -1565,7 +1550,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
private String[] makeArray(String string) {
string = string.trim();
char[] array = string.toCharArray();
ArrayList<String> aList = new ArrayList<String>();
ArrayList<String> aList = new ArrayList<>();
StringBuilder buffer = new StringBuilder();
boolean inComment = false;
for (int i = 0; i < array.length; i++) {

View file

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

View file

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

View file

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

View file

@ -42,14 +42,14 @@ public class PkgconfigErrorResolution implements IMarkerResolution {
}
@Override
public synchronized void write(int c) throws IOException {
public synchronized void write(int c) {
byte ascii[] = new byte[1];
ascii[0] = (byte) c;
fBuffer.append(new String(ascii));
}
@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));
}
}

View file

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

View file

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

View file

@ -28,7 +28,6 @@ import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
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.IAutotoolsOption;
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 AutotoolsConfigurationManager() {
configs = new HashMap<String, Map<String, IAConfiguration>>();
tmpConfigs = new HashMap<String, Map<String, IAConfiguration>>();
configs = new HashMap<>();
tmpConfigs = new HashMap<>();
AutotoolsPlugin.getWorkspace().addResourceChangeListener(this);
}
@ -98,8 +97,7 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
}
public synchronized IAConfiguration createDefaultConfiguration(IProject project, String id) {
IAConfiguration cfg = new AutotoolsConfiguration(id);
return cfg;
return new AutotoolsConfiguration(id);
}
public synchronized IAConfiguration findCfg(IProject p, String id) {
@ -138,7 +136,7 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
String projectName = project.getName();
Map<String, IAConfiguration> cfgs = getSavedConfigs(project);
if (cfgs == null) {
cfgs = new HashMap<String, IAConfiguration>();
cfgs = new HashMap<>();
configs.put(projectName, cfgs);
}
cfgs.put(cfg.getId(), cfg);
@ -167,7 +165,7 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
clearTmpConfigurations(project);
ICProjectDescription pd = CoreModel.getDefault().getProjectDescription(project);
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) {
cfgs[i].getConfigurationData();
IAConfiguration acfg = getTmpConfiguration(project, cfgs[i]);
@ -197,7 +195,7 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
try {
IPath fileLocation = project.getLocation().append(CFG_FILE_NAME);
File dirFile = fileLocation.toFile();
Map<String, IAConfiguration> cfgList = new HashMap<String, IAConfiguration>();
Map<String, IAConfiguration> cfgList = new HashMap<>();
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
if (dirFile.exists()) {
@ -329,7 +327,7 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
private Map<String, IAConfiguration> getTmpConfigs(IProject p) {
Map <String, IAConfiguration> tmpList = tmpConfigs.get(p.getName());
if (tmpList == null) {
tmpList = new HashMap<String, IAConfiguration>();
tmpList = new HashMap<>();
tmpConfigs.put(p.getName(), tmpList);
}
return tmpList;
@ -357,7 +355,7 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
if (tool.getName().equals("configure")) { //$NON-NLS-1$
IOption option =
tool.getOptionBySuperClassId("org.eclipse.linuxtools.cdt.autotools.core.option.configure.name"); // $NON-NLS-1$
IHoldsOptions h = (IHoldsOptions)tool;
IHoldsOptions h = tool;
try {
IOption optionToSet = h.getOptionToSet(option, false);
optionToSet.setValue(id);
@ -441,7 +439,7 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
public synchronized void applyConfigs(String projectName, ICConfigurationDescription[] cfgds) {
try {
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) {
AutotoolsPlugin.logErrorMessage(ConfigureMessages.getFormattedString(CFG_CANT_SAVE,
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("<configurations>"); // $NON-NLS-1$
Option[] optionList = AutotoolsConfiguration.getOptionList();
HashSet<String> savedIds = new HashSet<String>();
HashSet<String> savedIds = new HashSet<>();
setSyncing(true);
for (int x = 0; x < cfgds.length; ++x) {
ICConfigurationDescription cfgd = cfgds[x];
@ -513,12 +511,13 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
public synchronized Map<String, IAConfiguration> getConfigurations(IProject project) {
Map<String, IAConfiguration> list = getSavedConfigs(project);
if (list == null) {
list = new HashMap<String, IAConfiguration>();
list = new HashMap<>();
configs.put(project.getName(), list);
}
return list;
}
@Override
public synchronized void resourceChanged(IResourceChangeEvent event) {
IResource res = event.getResource();
if (!(res instanceof IProject))
@ -628,13 +627,13 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
}
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
Map<String, IConfigureOption> cfgOptions = cfg.getOptions();
IAConfiguration dummyCfg = createDefaultConfiguration(project, createDummyId());
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();
IAutotoolsOption configOption =
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
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();
IAutotoolsOption option = entry.getValue();
IConfigureOption cfgOption = cfg.getOption(name);

View file

@ -27,9 +27,6 @@ import org.eclipse.core.runtime.CoreException;
public class AutotoolsOptionValueHandler extends ManagedOptionValueHandler
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 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$
//FIXME: Use holder to set option value, not the "option" parameter
@Override
public boolean handleValue(IBuildObject buildObject,
IHoldsOptions holder,
IOption option,
@ -104,16 +102,19 @@ public class AutotoolsOptionValueHandler extends ManagedOptionValueHandler
// IOptionApplicability methods
@Override
public boolean isOptionEnabled(IBuildObject configuration,
IHoldsOptions holder, IOption option) {
return true;
}
@Override
public boolean isOptionUsedInCommandLine(IBuildObject configuration,
IHoldsOptions holder, IOption option) {
return false;
}
@Override
public boolean isOptionVisible(IBuildObject configuration,
IHoldsOptions holder, IOption option) {
return true;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -12,16 +12,13 @@
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.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.templateengine.TemplateCore;
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.internal.autotools.core.configure.AutotoolsConfigurationManager;
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.IWorkspace;
import org.eclipse.core.resources.IWorkspaceDescription;
@ -31,7 +28,8 @@ import org.eclipse.core.runtime.IProgressMonitor;
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();
IProject projectHandle = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
IWorkspace workspace = ResourcesPlugin.getWorkspace();
@ -48,11 +46,7 @@ public class SetAutotoolsStringOptionValue extends ProcessRunner {
ProcessArgument[] resourcePathObject = resourcePathObjects[i];
String id = resourcePathObject[0].getSimpleValue();
String value = resourcePathObject[1].getSimpleValue();
try {
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);
@ -62,8 +56,7 @@ public class SetAutotoolsStringOptionValue extends ProcessRunner {
}
}
private void setOptionValue(IProject projectHandle, String id, String
value) throws BuildException, ProcessFailureException {
private void setOptionValue(IProject projectHandle, String id, String value) {
AutotoolsConfigurationManager.getInstance().syncConfigurations(projectHandle);
ICConfigurationDescription[] cfgds =