[yocto] [PATCH] [eclipse-poky][master]Check build directory when location is set using "Browse" button

Grigoropol, IoanaX ioanax.grigoropol at intel.com
Mon Apr 8 07:58:50 PDT 2013


Hi Jessica,

I can reproduce this issue following these steps:

- open yocto-bsp menu
- set metadata location
- set build location directory using browse button and without interfering with the text field at all
- set output location to new directory
- press "Next"
- select a Kernel from the combo

The problem is that we only check the build directory when the focus is lost in the text field, and we do not take into account when the value of this field is populated using "Browse" button.
We must check for the build directory in the first page of the wizard, because any of the actions that can be done on the properties page(2nd) needs to have a functional build directory and will fail otherwise. 
The validatePage() method is only taken into consideration when we an finish the wizard without any further user interaction.

Thanks,
Ioana
________________________________________
From: Zhang, Jessica
Sent: Saturday, April 06, 2013 2:04 AM
To: Grigoropol, IoanaX; yocto at yoctoproject.org
Subject: RE: [yocto] [PATCH] [eclipse-poky][master]Check build directory when   location is set using "Browse" button

Hi Ioana,

I can't reproduce the bug on my end so can't further debug the issue.  But based on the context of this patch, seems we're missing checkBuildDir for buildLocation?  By looking at the code, shouldn't the easiest fix is to add checkBuildDir on the validatePage for the case the buildLocationText is not empty?

Thanks,
Jessica

-----Original Message-----
From: yocto-bounces at yoctoproject.org [mailto:yocto-bounces at yoctoproject.org] On Behalf Of Ioana Grigoropol
Sent: Friday, April 05, 2013 7:31 AM
To: yocto at yoctoproject.org
Subject: [yocto] [PATCH] [eclipse-poky][master]Check build directory when location is set using "Browse" button

[Yocto #4206]

Signed-off-by: Ioana Grigoropol <ioanax.grigoropol at intel.com>
---
 .../sdk/remotetools/wizards/bsp/MainPage.java      |   57 +++++++++++++++-----
 1 file changed, 43 insertions(+), 14 deletions(-)

diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/MainPage.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/MainPage.java
index d84cc24..156829b 100644
--- a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/MainPage.java
+++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wi
+++ zards/bsp/MainPage.java
@@ -25,6 +25,7 @@ import org.eclipse.swt.events.ModifyEvent;
 import org.eclipse.swt.events.ModifyListener;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
 import org.eclipse.swt.layout.GridData;  import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Button;
@@ -108,7 +109,8 @@ public class MainPage extends WizardPage {
                                controlChanged(e.widget);
                        }
                });
-               setBtnMetadataLoc(addFileSelectButton(textContainer, textMetadataLoc));
+               buildLocationListener = new BuildLocationListener("");
+               setBtnMetadataLoc(addFileSelectButton(textContainer, textMetadataLoc,
+null));

                labelBuildLoc = new Label(composite, SWT.NONE);
                labelBuildLoc.setText("Build location: "); @@ -118,10 +120,10 @@ public class MainPage extends WizardPage {
                textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

                textBuildLoc = (Text)addTextControl(textContainer, "");
-               buildLocationListener = new BuildLocationListener("");
                textBuildLoc.addFocusListener(buildLocationListener);
+               textBuildLoc.addModifyListener(buildLocationListener);

-               setBtnBuilddirLoc(addFileSelectButton(textContainer, textBuildLoc));
+               setBtnBuilddirLoc(addFileSelectButton(textContainer, textBuildLoc,
+buildLocationListener));

                labelBspName = new Label(composite, SWT.NONE);
                labelBspName.setText("BSP Name*: ");
@@ -152,7 +154,7 @@ public class MainPage extends WizardPage {
                                controlChanged(e.widget);
                        }
                });
-               setBtnBspOutLoc(addFileSelectButton(textContainer, textBspOutputLoc));
+               setBtnBspOutLoc(addFileSelectButton(textContainer, textBspOutputLoc,
+null));

                labelKArch = new Label(composite, SWT.NONE);
                labelKArch.setText("Kernel Architecture*: "); @@ -206,18 +208,25 @@ public class MainPage extends WizardPage {
                return text;
        }

-       private Button addFileSelectButton(final Composite parent, final Text text) {
+       private Button addFileSelectButton(final Composite parent, final Text
+text, SelectionListener listener) {
                Button button = new Button(parent, SWT.PUSH | SWT.LEAD);
                button.setText("Browse...");
-               button.addSelectionListener(new SelectionAdapter() {
-                       @Override
-                       public void widgetSelected(SelectionEvent event) {
-                               String dirName = new DirectoryDialog(parent.getShell()).open();
-                               if (dirName != null) {
-                                       text.setText(dirName);
+               if (listener == null) {
+                       button.addSelectionListener(new SelectionListener() {
+                               @Override
+                               public void widgetSelected(SelectionEvent e) {
+                                       // TODO Auto-generated method stub
+                                       String dirName = new DirectoryDialog(parent.getShell()).open();
+                                       if (dirName != null) {
+                                               text.setText(dirName);
+                                       }
                                }
-                       }
-               });
+                               @Override
+                               public void widgetDefaultSelected(SelectionEvent e) {
+                               }
+                       });
+               } else
+                       button.addSelectionListener(listener);
                return button;
        }

@@ -473,7 +482,7 @@ public class MainPage extends WizardPage {
                this.btnBuildLoc = btnBuilddirLoc;
        }

-       class BuildLocationListener implements FocusListener{
+       class BuildLocationListener implements FocusListener,
+SelectionListener, ModifyListener{
                String value;
                boolean changed;

@@ -492,6 +501,26 @@ public class MainPage extends WizardPage {
                                buildDirChecked = true;
                        }
                }
+               @Override
+               public void widgetSelected(SelectionEvent e) {
+                       String dirName = new DirectoryDialog(((Button)e.getSource()).getParent().getShell()).open();
+                       if (dirName != null) {
+                               textBuildLoc.setText(dirName);
+                               value = dirName;
+                       }
+               }
+               @Override
+               public void widgetDefaultSelected(SelectionEvent e) {
+                       // TODO Auto-generated method stub
+               }
+               @Override
+               public void modifyText(ModifyEvent e) {
+
+                       if(!((Text)e.getSource()).getText().equals(value)) {
+                               checkBuildDir();
+                               buildDirChecked = true;
+                       }
+               }

        }
 }
--
1.7.9.5

_______________________________________________
yocto mailing list
yocto at yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto



More information about the yocto mailing list