Skip to contentSkip to conversation

Rename target profiles and handle global changes

PATCH Applied Timo Mueller 2 participants 7 messages Feb 26, 2013 – Feb 27, 2013

lore
Share & tools
lore
#0 lore raw

cover Rename target profiles and handle global changes

From: Timo Mueller <[email protected]>

Hi,

this implements two of Jessica's comments regarding the target profiles that have been introduced recently.

01..02: Small cleanup work
03: Changes the name of target profiles to cross development
profiles
04..05: If a global profile is updated this will also update affected
projects. Also a warning is shown to the user.

Best regards,
Timo

Timo Mueller (5):
Added eclipse bin folders to gitignore
plugins/sdk.ide: Remove exception that is never thrown plugin/sdk.ide: Change name of target profiles to cross development
profiles
plugin/sdk.ide: Added methods for comparing UIElements plugin/sdk.ide: Update projects on profile update

 .gitignore                                         |  1 +
 .../org/yocto/sdk/ide/YoctoSDKMessages.properties  | 16 +++---
 .../src/org/yocto/sdk/ide/YoctoUIElement.java      | 58 ++++++++++++++++++++++
 .../src/org/yocto/sdk/ide/YoctoUISetting.java      |  4 +-
 .../ide/preferences/YoctoSDKPreferencePage.java    | 32 +++++++++---
 5 files changed, 95 insertions(+), 16 deletions(-)
 create mode 100644 .gitignore
Signature · 1 line
1.7.11.7
#1 lore raw

PATCH 1/5 Added eclipse bin folders to gitignore

From: Timo Mueller <[email protected]>

---
 .gitignore | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 .gitignore
.gitignore new file +1 -0
new file mode 100644
index 0000000..ba077a4
@@ -0,0 +1 @@
+bin
Signature · 1 line
1.7.11.7
#2 lore raw

PATCH 2/5 plugins/sdk.ide: Remove exception that is never thrown

From: Timo Mueller <[email protected]>

---
 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java +2 -2
index 5bca41a..f7e7a3a 100644
@@ -144,7 +144,7 @@ public class YoctoUISetting {
 		return button;
 	}		
 
-	private void createQemuSetup(final Group targetGroup) throws YoctoGeneralException
+	private void createQemuSetup(final Group targetGroup)
 	{
 		//QEMU Setup
 		kernel_label= new Label(targetGroup, SWT.NONE);
@@ -180,7 +180,7 @@ public class YoctoUISetting {
 		*/
 		
 	}
-	public void createComposite(Composite composite) throws YoctoGeneralException
+	public void createComposite(Composite composite)
 	{
 		GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
 		GridLayout layout = new GridLayout(2, false);
Signature · 1 line
1.7.11.7
#3 lore raw

PATCH 3/5 plugin/sdk.ide: Change name of target profiles to cross development profiles

From: Timo Mueller <[email protected]>

---
 .../src/org/yocto/sdk/ide/YoctoSDKMessages.properties      | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties +7 -7
index e779f7d..0323d1c 100644
@@ -51,18 +51,18 @@ Preferences.Profile.Validator.InvalidName.Quote = Warning: The profile name cann
 Preferences.Profile.Validator.InvalidName.Empty = Please provide a new profile name.
 Preferences.Profile.Validator.InvalidName.Exists = Warning: The profile already exists.
 
-Preferences.Profiles.Title = Target profiles:
+Preferences.Profiles.Title = Cross development profiles:
 Preferences.Profile.New.Title = Save as ...
-Preferences.Profile.New.Dialog.Title = Save as new target profile
+Preferences.Profile.New.Dialog.Title = Save as new cross development profile
 Preferences.Profile.New.Dialog.Message = Please input a profile name.
 Preferences.Profile.Rename.Title = Rename
-Preferences.Profile.Rename.Dialog.Title = Rename target profile
+Preferences.Profile.Rename.Dialog.Title = Rename cross development profile
 Preferences.Profile.Rename.Dialog.Message = Please input a new profile name.
 Preferences.Profile.Remove.Title = Remove
-Preferences.Profile.Remove.Dialog.Title = Remove target profile
-Preferences.Profile.Remove.Dialog.Message = Do you really want to the remove the target profile "{0}"?\nProjects using this target profile will be reconfigured to use the standard profile.
-Preferences.Profile.Standard.Modification.Title = Modify standard target profile
-Preferences.Profile.Standard.Modification.Message = Standard target profile cannot be removed or renamed.
+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.Standard.Modification.Title = Modify standard cross development profile
+Preferences.Profile.Standard.Modification.Message = Standard cross development profile cannot be removed or renamed.
 
 Preferences.Profile.ProjectSpecific.Title = Use project specific settings
 Preferences.Profile.ProjectSpecific.Group.Title = Project specific settings:
Signature · 1 line
1.7.11.7
#4 lore raw

PATCH 4/5 plugin/sdk.ide: Added methods for comparing UIElements

From: Timo Mueller <[email protected]>

This adds hashCode and equals methods generated by Eclipse to allow comparison of two UIElements.

---
 .../src/org/yocto/sdk/ide/YoctoUIElement.java      | 58 ++++++++++++++++++++++
 1 file changed, 58 insertions(+)
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUIElement.java +58 -0
index df19510..de3e905 100644
@@ -100,4 +100,62 @@ public class YoctoUIElement {
 	public void setStrSysrootLoc(String strSysrootLoc) {
 		this.strSysrootLoc = strSysrootLoc;
 	}
+
+	@Override
+	public int hashCode() {
+		final int prime = 31;
+		int result = 1;
+		result = prime * result + ((enumDeviceMode == null) ? 0 : enumDeviceMode.hashCode());
+		result = prime * result + ((enumPokyMode == null) ? 0 : enumPokyMode.hashCode());
+		result = prime * result + intTargetIndex;
+		result = prime * result + ((strQemuKernelLoc == null) ? 0 : strQemuKernelLoc.hashCode());
+		result = prime * result + ((strQemuOption == null) ? 0 : strQemuOption.hashCode());
+		result = prime * result + ((strSysrootLoc == null) ? 0 : strSysrootLoc.hashCode());
+		result = prime * result + ((strTarget == null) ? 0 : strTarget.hashCode());
+		result = prime * result + ((strToolChainRoot == null) ? 0 : strToolChainRoot.hashCode());
+		return result;
+	}
+
+	@Override
+	public boolean equals(Object obj) {
+		if (this == obj)
+			return true;
+		if (obj == null)
+			return false;
+		if (getClass() != obj.getClass())
+			return false;
+		YoctoUIElement other = (YoctoUIElement) obj;
+		if (enumDeviceMode != other.enumDeviceMode)
+			return false;
+		if (enumPokyMode != other.enumPokyMode)
+			return false;
+		if (intTargetIndex != other.intTargetIndex)
+			return false;
+		if (strQemuKernelLoc == null) {
+			if (other.strQemuKernelLoc != null)
+				return false;
+		} else if (!strQemuKernelLoc.equals(other.strQemuKernelLoc))
+			return false;
+		if (strQemuOption == null) {
+			if (other.strQemuOption != null)
+				return false;
+		} else if (!strQemuOption.equals(other.strQemuOption))
+			return false;
+		if (strSysrootLoc == null) {
+			if (other.strSysrootLoc != null)
+				return false;
+		} else if (!strSysrootLoc.equals(other.strSysrootLoc))
+			return false;
+		if (strTarget == null) {
+			if (other.strTarget != null)
+				return false;
+		} else if (!strTarget.equals(other.strTarget))
+			return false;
+		if (strToolChainRoot == null) {
+			if (other.strToolChainRoot != null)
+				return false;
+		} else if (!strToolChainRoot.equals(other.strToolChainRoot))
+			return false;
+		return true;
+	}
 }
Signature · 1 line
1.7.11.7
#5 lore raw

PATCH 5/5 plugin/sdk.ide: Update projects on profile update

From: Timo Mueller <[email protected]>

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.

---
 .../org/yocto/sdk/ide/YoctoSDKMessages.properties  |  2 ++
 .../ide/preferences/YoctoSDKPreferencePage.java    | 32 +++++++++++++++++-----
 2 files changed, 27 insertions(+), 7 deletions(-)
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties +2 -0
index 0323d1c..e5748f7 100644
@@ -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.
 
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java +25 -7
index b5963cf..4d57b45 100644
@@ -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);
Signature · 1 line
1.7.11.7
#6 lore raw
In reply to Timo Mueller

Merged to eclipse-poky master.

Thanks,
Jessica

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Timo Mueller
Sent: Tuesday, February 26, 2013 5:49 AM
To: [email protected]
Cc: Timo Mueller
Subject: [yocto] [PATCH 0/5][eclipse-poky] Rename target profiles and handle global changes

From: Timo Mueller <[email protected]>

Hi,

this implements two of Jessica's comments regarding the target profiles that have been introduced recently.

01..02: Small cleanup work
03: Changes the name of target profiles to cross development
profiles
04..05: If a global profile is updated this will also update affected
projects. Also a warning is shown to the user.

Best regards,
Timo

Timo Mueller (5):
Added eclipse bin folders to gitignore
plugins/sdk.ide: Remove exception that is never thrown plugin/sdk.ide: Change name of target profiles to cross development
profiles
plugin/sdk.ide: Added methods for comparing UIElements plugin/sdk.ide: Update projects on profile update

 .gitignore                                         |  1 +
 .../org/yocto/sdk/ide/YoctoSDKMessages.properties  | 16 +++---
 .../src/org/yocto/sdk/ide/YoctoUIElement.java      | 58 ++++++++++++++++++++++
 .../src/org/yocto/sdk/ide/YoctoUISetting.java      |  4 +-
 .../ide/preferences/YoctoSDKPreferencePage.java    | 32 +++++++++---
 5 files changed, 95 insertions(+), 16 deletions(-)  create mode 100644 .gitignore

--
1.7.11.7

_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto