[Yocto #4206]
Signed-off-by: Ioana Grigoropol <[email protected]>
---
.../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/wizards/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
[email protected]
https://lists.yoctoproject.org/listinfo/yocto