1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-03 07:05:24 +02:00

Bug 544721 Retain rebuildState state when cloning build configs

When cloning build config, all its childrens' rebuildState and dirty
state are maintained except for the states of AdditionalInput and
InputOrder.

With this change, we also retain their rebuildState and dirty state, if
it is a clone (that is, copyId is true in the InputType).

Change-Id: I63b2d38d0065e50357887bfccb340d458d2f4441
Signed-off-by: Philip Langer <planger@eclipsesource.com>
(cherry picked from commit 17237841e1)
This commit is contained in:
Philip Langer 2019-02-22 13:52:52 +01:00 committed by Jonah Graham
parent 2f46647a4a
commit 652c4ce248
3 changed files with 39 additions and 11 deletions

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005, 2016 Intel Corporation and others.
* Copyright (c) 2005, 2019 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -9,6 +9,7 @@
* Intel Corporation - Initial API and implementation
* IBM Corporation
* Marc-Andre Laperle
* EclipseSource
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.internal.core;
@ -128,6 +129,10 @@ public class AdditionalInput implements IAdditionalInput {
* @param additionalInput The existing AdditionalInput to clone.
*/
public AdditionalInput(IInputType parent, AdditionalInput additionalInput) {
this(parent, additionalInput, false);
}
public AdditionalInput(IInputType parent, AdditionalInput additionalInput, boolean retainRebuildState) {
this.fParent = parent;
fIsExtensionAdditionalInput = false;
@ -140,9 +145,14 @@ public class AdditionalInput implements IAdditionalInput {
fKind = additionalInput.fKind;
}
if (retainRebuildState) {
setDirty(additionalInput.fIsDirty);
setRebuildState(additionalInput.fRebuildState);
} else {
setDirty(true);
setRebuildState(true);
}
}
/*
* E L E M E N T A T T R I B U T E R E A D E R S A N D W R I T E R S

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005, 2016 Intel Corporation and others.
* Copyright (c) 2005, 2019 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -8,6 +8,7 @@
* Contributors:
* Intel Corporation - Initial API and implementation
* IBM Corporation
* EclipseSource
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.internal.core;
@ -90,6 +91,17 @@ public class InputOrder implements IInputOrder {
* @param inputOrder The existing InputOrder to clone.
*/
public InputOrder(IInputType parent, InputOrder inputOrder) {
this(parent, inputOrder, false);
}
/**
* Create an <code>InputOrder</code> based upon an existing InputOrder.
*
* @param parent The <code>IInputType</code> the InputOrder will be added to.
* @param inputOrder The existing InputOrder to clone.
* @param retainRebuildState Whether or not to retain the <code>rebuildState</code> and <code>dirty</code> state of <code>inputOrder</code>.
*/
public InputOrder(IInputType parent, InputOrder inputOrder, boolean retainRebuildState) {
this.fParent = parent;
fIsExtensionInputOrder = false;
@ -106,9 +118,14 @@ public class InputOrder implements IInputOrder {
fExcluded = inputOrder.fExcluded;
}
if (retainRebuildState) {
setDirty(inputOrder.fIsDirty);
setRebuildState(inputOrder.fRebuildState);
} else {
setDirty(true);
setRebuildState(true);
}
}
/*
* E L E M E N T A T T R I B U T E R E A D E R S A N D W R I T E R S

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005, 2016 Intel Corporation and others.
* Copyright (c) 2005, 2019 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -8,6 +8,7 @@
* Contributors:
* Intel Corporation - Initial API and implementation
* IBM Corporation
* EclipseSource
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.internal.core;
@ -279,13 +280,13 @@ public class InputType extends BuildObject implements IInputType {
// Clone the children
if (inputType.inputOrderList != null) {
for (InputOrder inputOrder : inputType.getInputOrderList()) {
InputOrder newInputOrder = new InputOrder(this, inputOrder);
InputOrder newInputOrder = new InputOrder(this, inputOrder, copyIds);
getInputOrderList().add(newInputOrder);
}
}
if (inputType.additionalInputList != null) {
for (AdditionalInput additionalInput : inputType.getAdditionalInputList()) {
AdditionalInput newAdditionalInput = new AdditionalInput(this, additionalInput);
AdditionalInput newAdditionalInput = new AdditionalInput(this, additionalInput, copyIds);
getAdditionalInputList().add(newAdditionalInput);
}
}