[yocto] [RFC v2 10/17] plugins/sdk.ide: Add UI method to delete a profile
Timo Müller
mail at timomueller.eu
Wed Jan 30 05:59:42 PST 2013
Sorry, this one is already obsolete.
Timo Mueller wrote, On 30.01.2013 14:56:
> From: Timo Mueller <timo.mueller at bmw-carit.de>
>
> A profile is removed from the list, when the delete button is
> clicked. The deletion has to be confirmed by the user. Deleting the
> standard profile is not allowed.
>
> Signed-off-by: Timo Mueller <timo.mueller at bmw-carit.de>
> ---
> .../src/org/yocto/sdk/ide/YoctoProfileSetting.java | 34 ++++++++++++++++++++++
> .../org/yocto/sdk/ide/YoctoSDKMessages.properties | 4 +++
> 2 files changed, 38 insertions(+)
>
> diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileSetting.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileSetting.java
> index 633eb67..aa6f4b2 100644
> --- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileSetting.java
> +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileSetting.java
> @@ -10,6 +10,7 @@
> *******************************************************************************/
> package org.yocto.sdk.ide;
>
> +import org.eclipse.jface.dialogs.MessageDialog;
> import org.eclipse.jface.preference.PreferencePage;
> import org.eclipse.swt.SWT;
> import org.eclipse.swt.events.MouseAdapter;
> @@ -22,6 +23,7 @@ import org.eclipse.swt.widgets.Composite;
> import org.eclipse.swt.widgets.Event;
> import org.eclipse.swt.widgets.Group;
> import org.eclipse.swt.widgets.Listener;
> +import org.yocto.sdk.ide.preferences.PreferenceConstants;
> import org.yocto.sdk.ide.preferences.YoctoSDKPreferencePage;
>
> public class YoctoProfileSetting {
> @@ -29,6 +31,10 @@ public class YoctoProfileSetting {
> private static final String NEW_PROFILE_TITLE = "Preferences.Profile.New.Title";
> private static final String RENAME_PROFILE_TITLE = "Preferences.Profile.Rename.Title";
> private static final String REMOVE_PROFILE_TITLE = "Preferences.Profile.Remove.Title";
> + private static final String REMOVE_DIALOG_TITLE = "Preferences.Profile.Remove.Dialog.Title";
> + private static final String REMOVE_DIALOG_MESSAGE = "Preferences.Profile.Remove.Dialog.Message";
> + private static final String MODIFY_STANDARD_TITLE = "Preferences.Profile.Standard.Modification.Title";
> + private static final String MODIFY_STANDARD_MESSAGE = "Preferences.Profile.Standard.Modification.Message";
>
> private Combo sdkConfigsCombo;
> private Button btnConfigRename;
> @@ -105,6 +111,34 @@ public class YoctoProfileSetting {
> btnConfigRemove = new Button(storeYoctoConfigurationsGroup, SWT.PUSH | SWT.LEAD);
> btnConfigRemove.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, true, false, 3, 1));
> btnConfigRemove.setText(YoctoSDKMessages.getString(REMOVE_PROFILE_TITLE));
> + btnConfigRemove.addMouseListener(new MouseAdapter() {
> + @Override
> + public void mouseDown(MouseEvent e) {
> + saveChangesOnCurrentProfile();
> + int selectionIndex = sdkConfigsCombo.getSelectionIndex();
> + String selectedItem = sdkConfigsCombo.getItem(selectionIndex);
> +
> + if (selectedItem.equals(PreferenceConstants.STANDARD_PROFILE_NAME)) {
> + MessageDialog.openInformation(null,
> + YoctoSDKMessages.getString(MODIFY_STANDARD_TITLE),
> + YoctoSDKMessages.getString(MODIFY_STANDARD_MESSAGE));
> + return;
> + }
> +
> + boolean deleteConfirmed =
> + MessageDialog.openConfirm(null,
> + YoctoSDKMessages.getString(REMOVE_DIALOG_TITLE),
> + YoctoSDKMessages.getFormattedString(REMOVE_DIALOG_MESSAGE, selectedItem));
> +
> + if (!deleteConfirmed) {
> + return;
> + }
> +
> + sdkConfigsCombo.select(0);
> + sdkConfigsCombo.remove(selectionIndex);
> + profileElement.remove(selectedItem);
> + }
> + });
> }
>
> private void createRenameButton(Group storeYoctoConfigurationsGroup) {
> 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 14b7846..1a413fa 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
> @@ -57,6 +57,10 @@ Preferences.Profile.New.Dialog.Title = Save as new target profile
> Preferences.Profile.New.Dialog.Message = Please input a profile name.
> Preferences.Profile.Rename.Title = Rename
> 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.
>
> Console.SDK.Name = Yocto Project Console
>
>
More information about the yocto
mailing list