From: Timo Mueller <timo.muel...@bmw-carit.de> If a cross development profile is changed that is used by projects, the user will be warned that these projects will also be changed. If the user accepts the affected projects are updated and are marked "dirty". Next time the projects are built a reconfigure will also be triggered.
Signed-off-by: Timo Mueller <timo.muel...@bmw-carit.de> --- .../org/yocto/sdk/ide/YoctoSDKMessages.properties | 2 ++ .../ide/preferences/YoctoSDKPreferencePage.java | 32 +++++++++++++++++----- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties index 0323d1c..e5748f7 100644 --- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties @@ -61,6 +61,8 @@ Preferences.Profile.Rename.Dialog.Message = Please input a new profile name. Preferences.Profile.Remove.Title = Remove Preferences.Profile.Remove.Dialog.Title = Remove cross development profile Preferences.Profile.Remove.Dialog.Message = Do you really want to the remove the cross development profile "{0}"?\nProjects using this cross development profile will be reconfigured to use the standard profile. +Preferences.Profile.Update.Dialog.Title = Update cross development profile +Preferences.Profile.Update.Dialog.Message = Do you really want to the update the cross development profile "{0}"?\nProjects using this cross development profile will be reconfigured. Preferences.Profile.Standard.Modification.Title = Modify standard cross development profile Preferences.Profile.Standard.Modification.Message = Standard cross development profile cannot be removed or renamed. diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java index b5963cf..4d57b45 100644 --- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java @@ -18,6 +18,7 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.InputDialog; +import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.preference.PreferencePage; import org.eclipse.swt.SWT; @@ -40,6 +41,8 @@ public class YoctoSDKPreferencePage extends PreferencePage implements IWorkbench private static final String NEW_DIALOG_TITLE = "Preferences.Profile.New.Dialog.Title"; private static final String NEW_DIALOG_MESSAGE = "Preferences.Profile.New.Dialog.Message"; + private static final String UPDATE_DIALOG_TITLE = "Preferences.Profile.Update.Dialog.Title"; + private static final String UPDATE_DIALOG_MESSAGE = "Preferences.Profile.Update.Dialog.Message"; private YoctoProfileSetting yoctoProfileSetting; private YoctoUISetting yoctoUISetting; @@ -93,15 +96,32 @@ public class YoctoSDKPreferencePage extends PreferencePage implements IWorkbench */ public boolean performOk() { try { - yoctoUISetting.validateInput(SDKCheckRequestFrom.Preferences, true); + yoctoUISetting.validateInput(SDKCheckRequestFrom.Preferences, false); + + YoctoUIElement savedElement = YoctoSDKUtils.getElemFromStore(getPreferenceStore()); + YoctoUIElement modifiedElement = yoctoUISetting.getCurrentInput(); - YoctoUIElement elem = yoctoUISetting.getCurrentInput(); - YoctoSDKUtils.saveElemToStore(elem, getPreferenceStore()); + if (savedElement.equals(modifiedElement)) { + return true; + } YoctoProfileElement profileElement = yoctoProfileSetting.getCurrentInput(); + HashSet<IProject> yoctoProjects = getAffectedProjects(profileElement.getSelectedProfile()); + + if (!yoctoProjects.isEmpty()) { + boolean deleteConfirmed = + MessageDialog.openConfirm(null, YoctoSDKMessages.getString(UPDATE_DIALOG_TITLE), + YoctoSDKMessages.getFormattedString(UPDATE_DIALOG_MESSAGE, profileElement.getSelectedProfile())); + + if (!deleteConfirmed) { + return false; + } + } + + YoctoSDKUtils.saveElemToStore(modifiedElement, getPreferenceStore()); YoctoSDKUtils.saveProfilesToDefaultStore(profileElement); - updateAffectedProjects(profileElement.getSelectedProfile(), elem); + updateProjects(yoctoProjects, modifiedElement); return super.performOk(); } catch (YoctoGeneralException e) { @@ -194,9 +214,7 @@ public class YoctoSDKPreferencePage extends PreferencePage implements IWorkbench } } - private void updateAffectedProjects(String usedProfile, YoctoUIElement elem) { - HashSet<IProject> yoctoProjects = getAffectedProjects(usedProfile); - + private void updateProjects(HashSet<IProject> yoctoProjects, YoctoUIElement elem) { for (IProject project : yoctoProjects) { YoctoSDKUtils.saveElemToProjectEnv(elem, project); -- 1.7.11.7 _______________________________________________ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto