diff options
author | Adrian Dudau <adrian.dudau@enea.com> | 2013-12-12 13:36:50 +0100 |
---|---|---|
committer | Adrian Dudau <adrian.dudau@enea.com> | 2013-12-12 15:25:03 +0100 |
commit | 41ac47d732eed8392d60d0f6773e5a279d49b999 (patch) | |
tree | cf19d099db9cfdb8d73aa21c31e7aa1cc86ff860 /plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/MainPage.java | |
download | eclipse-poky-juno-41ac47d732eed8392d60d0f6773e5a279d49b999.tar.gz |
Migrated from the internal git server on the dora-enea branch
Signed-off-by: Adrian Dudau <adrian.dudau@enea.com>
Diffstat (limited to 'plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/MainPage.java')
-rw-r--r-- | plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/MainPage.java | 498 |
1 files changed, 498 insertions, 0 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 new file mode 100644 index 0000000..ea6544f --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/MainPage.java | |||
@@ -0,0 +1,498 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2012 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.remotetools.wizards.bsp; | ||
12 | |||
13 | import java.io.BufferedReader; | ||
14 | import java.io.File; | ||
15 | import java.io.InputStream; | ||
16 | import java.io.InputStreamReader; | ||
17 | |||
18 | import org.eclipse.core.runtime.IStatus; | ||
19 | import org.eclipse.core.runtime.Status; | ||
20 | import org.eclipse.jface.wizard.WizardPage; | ||
21 | import org.eclipse.swt.SWT; | ||
22 | import org.eclipse.swt.events.FocusEvent; | ||
23 | import org.eclipse.swt.events.FocusListener; | ||
24 | import org.eclipse.swt.events.ModifyEvent; | ||
25 | import org.eclipse.swt.events.ModifyListener; | ||
26 | import org.eclipse.swt.events.SelectionAdapter; | ||
27 | import org.eclipse.swt.events.SelectionEvent; | ||
28 | import org.eclipse.swt.layout.GridData; | ||
29 | import org.eclipse.swt.layout.GridLayout; | ||
30 | import org.eclipse.swt.widgets.Button; | ||
31 | import org.eclipse.swt.widgets.Combo; | ||
32 | import org.eclipse.swt.widgets.Composite; | ||
33 | import org.eclipse.swt.widgets.Control; | ||
34 | import org.eclipse.swt.widgets.DirectoryDialog; | ||
35 | import org.eclipse.swt.widgets.Label; | ||
36 | import org.eclipse.swt.widgets.Text; | ||
37 | import org.eclipse.swt.widgets.Widget; | ||
38 | import org.yocto.sdk.remotetools.YoctoBspElement; | ||
39 | |||
40 | /** | ||
41 | * | ||
42 | * Setting up the parameters for creating the new Yocto BSP | ||
43 | * | ||
44 | * @author jzhang | ||
45 | */ | ||
46 | public class MainPage extends WizardPage { | ||
47 | public static final String PAGE_NAME = "Main"; | ||
48 | private static final String KARCH_CMD = "yocto-bsp list karch"; | ||
49 | private static final String QARCH_CMD = "yocto-bsp list qemu property qemuarch"; | ||
50 | private static final String BSP_SCRIPT = "yocto-bsp"; | ||
51 | private static final String PROPERTIES_CMD_PREFIX = "yocto-bsp list "; | ||
52 | private static final String PROPERTIES_CMD_SURFIX = " properties -o "; | ||
53 | private static final String PROPERTIES_FILE = "/tmp/properties.json"; | ||
54 | |||
55 | private Button btnMetadataLoc; | ||
56 | private Text textMetadataLoc; | ||
57 | private Label labelMetadata; | ||
58 | |||
59 | private Button btnBspOutputLoc; | ||
60 | private Text textBspOutputLoc; | ||
61 | private Label labelBspOutput; | ||
62 | |||
63 | private Button btnBuildLoc; | ||
64 | private Text textBuildLoc; | ||
65 | private Label labelBuildLoc; | ||
66 | |||
67 | private boolean buildDirChecked; | ||
68 | private BuildLocationListener buildLocationListener; | ||
69 | |||
70 | private Text textBspName; | ||
71 | private Label labelBspName; | ||
72 | |||
73 | private Combo comboKArch; | ||
74 | private Label labelKArch; | ||
75 | |||
76 | private Combo comboQArch; | ||
77 | private Label labelQArch; | ||
78 | |||
79 | private YoctoBspElement bspElem; | ||
80 | |||
81 | public MainPage(YoctoBspElement element) { | ||
82 | super(PAGE_NAME, "yocto-bsp Main page", null); | ||
83 | |||
84 | setMessage("Enter the required fields(with *) to create new Yocto Project BSP!"); | ||
85 | this.bspElem = element; | ||
86 | } | ||
87 | |||
88 | @Override | ||
89 | public void createControl(Composite parent) { | ||
90 | setErrorMessage(null); | ||
91 | Composite composite = new Composite(parent, SWT.NONE); | ||
92 | GridLayout layout = new GridLayout(2, false); | ||
93 | GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false); | ||
94 | composite.setLayout(layout); | ||
95 | gd.horizontalSpan = 2; | ||
96 | composite.setLayoutData(gd); | ||
97 | |||
98 | labelMetadata = new Label(composite, SWT.NONE); | ||
99 | labelMetadata.setText("Metadata location*: "); | ||
100 | Composite textContainer = new Composite(composite, SWT.NONE); | ||
101 | textContainer.setLayout(new GridLayout(2, false)); | ||
102 | textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); | ||
103 | textMetadataLoc = (Text)addTextControl(textContainer, ""); | ||
104 | textMetadataLoc.setEnabled(false); | ||
105 | textMetadataLoc.addModifyListener(new ModifyListener() { | ||
106 | @Override | ||
107 | public void modifyText(ModifyEvent e) { | ||
108 | controlChanged(e.widget); | ||
109 | } | ||
110 | }); | ||
111 | setBtnMetadataLoc(addFileSelectButton(textContainer, textMetadataLoc)); | ||
112 | |||
113 | labelBuildLoc = new Label(composite, SWT.NONE); | ||
114 | labelBuildLoc.setText("Build location: "); | ||
115 | |||
116 | textContainer = new Composite(composite, SWT.NONE); | ||
117 | textContainer.setLayout(new GridLayout(2, false)); | ||
118 | textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); | ||
119 | |||
120 | textBuildLoc = (Text)addTextControl(textContainer, ""); | ||
121 | buildLocationListener = new BuildLocationListener(""); | ||
122 | textBuildLoc.addFocusListener(buildLocationListener); | ||
123 | |||
124 | setBtnBuilddirLoc(addFileSelectButton(textContainer, textBuildLoc)); | ||
125 | |||
126 | labelBspName = new Label(composite, SWT.NONE); | ||
127 | labelBspName.setText("BSP Name*: "); | ||
128 | |||
129 | textContainer = new Composite(composite, SWT.NONE); | ||
130 | textContainer.setLayout(new GridLayout(2, false)); | ||
131 | textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); | ||
132 | |||
133 | textBspName = (Text)addTextControl(textContainer, ""); | ||
134 | textBspName.addModifyListener(new ModifyListener() { | ||
135 | @Override | ||
136 | public void modifyText(ModifyEvent e) { | ||
137 | controlChanged(e.widget); | ||
138 | } | ||
139 | }); | ||
140 | |||
141 | labelBspOutput = new Label(composite, SWT.NONE); | ||
142 | labelBspOutput.setText("BSP output location: "); | ||
143 | |||
144 | textContainer = new Composite(composite, SWT.NONE); | ||
145 | textContainer.setLayout(new GridLayout(2, false)); | ||
146 | textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); | ||
147 | |||
148 | textBspOutputLoc = (Text)addTextControl(textContainer, ""); | ||
149 | textBspOutputLoc.addModifyListener(new ModifyListener() { | ||
150 | @Override | ||
151 | public void modifyText(ModifyEvent e) { | ||
152 | controlChanged(e.widget); | ||
153 | } | ||
154 | }); | ||
155 | setBtnBspOutLoc(addFileSelectButton(textContainer, textBspOutputLoc)); | ||
156 | |||
157 | labelKArch = new Label(composite, SWT.NONE); | ||
158 | labelKArch.setText("Kernel Architecture*: "); | ||
159 | |||
160 | textContainer = new Composite(composite, SWT.NONE); | ||
161 | textContainer.setLayout(new GridLayout(2, false)); | ||
162 | textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); | ||
163 | |||
164 | comboKArch = new Combo(textContainer, SWT.READ_ONLY); | ||
165 | comboKArch.setLayout(new GridLayout(2, false)); | ||
166 | comboKArch.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); | ||
167 | comboKArch.setEnabled(false); | ||
168 | comboKArch.addModifyListener(new ModifyListener() { | ||
169 | @Override | ||
170 | public void modifyText(ModifyEvent e) { | ||
171 | controlChanged(e.widget); | ||
172 | } | ||
173 | }); | ||
174 | |||
175 | labelQArch = new Label(composite, SWT.NONE); | ||
176 | labelQArch.setText("Qemu Architecture(* for karch as qemu): "); | ||
177 | labelQArch.setEnabled(false); | ||
178 | |||
179 | textContainer = new Composite(composite, SWT.NONE); | ||
180 | textContainer.setLayout(new GridLayout(2, false)); | ||
181 | textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); | ||
182 | |||
183 | comboQArch = new Combo(textContainer, SWT.READ_ONLY); | ||
184 | comboQArch.setLayout(new GridLayout(2, false)); | ||
185 | comboQArch.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); | ||
186 | comboQArch.setEnabled(false); | ||
187 | comboQArch.addModifyListener(new ModifyListener() { | ||
188 | @Override | ||
189 | public void modifyText(ModifyEvent e) { | ||
190 | controlChanged(e.widget); | ||
191 | } | ||
192 | }); | ||
193 | |||
194 | setControl(composite); | ||
195 | validatePage(); | ||
196 | } | ||
197 | |||
198 | private Control addTextControl(final Composite parent, String value) { | ||
199 | final Text text; | ||
200 | |||
201 | text = new Text(parent, SWT.SINGLE | SWT.LEAD | SWT.BORDER); | ||
202 | text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); | ||
203 | text.setText(value); | ||
204 | text.setSize(10, 150); | ||
205 | |||
206 | return text; | ||
207 | } | ||
208 | |||
209 | private Button addFileSelectButton(final Composite parent, final Text text) { | ||
210 | Button button = new Button(parent, SWT.PUSH | SWT.LEAD); | ||
211 | button.setText("Browse..."); | ||
212 | button.addSelectionListener(new SelectionAdapter() { | ||
213 | @Override | ||
214 | public void widgetSelected(SelectionEvent event) { | ||
215 | String dirName = new DirectoryDialog(parent.getShell()).open(); | ||
216 | if (dirName != null) { | ||
217 | text.setText(dirName); | ||
218 | } | ||
219 | } | ||
220 | }); | ||
221 | return button; | ||
222 | } | ||
223 | |||
224 | private void controlChanged(Widget widget) { | ||
225 | Status status = new Status(IStatus.OK, "not_used", 0, "", null); | ||
226 | setErrorMessage(null); | ||
227 | String metadataLoc = textMetadataLoc.getText(); | ||
228 | |||
229 | if (widget == textMetadataLoc) { | ||
230 | resetKarchCombo(); | ||
231 | if (metadataLoc.length() == 0) { | ||
232 | status = new Status(IStatus.ERROR, "not_used", 0, "Meta data location can't be empty!", null); | ||
233 | } else { | ||
234 | File meta_data = new File(metadataLoc); | ||
235 | if (!meta_data.exists() || !meta_data.isDirectory()) { | ||
236 | status = new Status(IStatus.ERROR, "not_used", 0, | ||
237 | "Invalid meta data location: Make sure it exists and is a directory!", null); | ||
238 | } else { | ||
239 | File bspScript = new File(metadataLoc + "/scripts/" + BSP_SCRIPT); | ||
240 | if (!bspScript.exists() || !bspScript.canExecute()) | ||
241 | status = new Status(IStatus.ERROR, "not_used", 0, | ||
242 | "Make sure yocto-bsp exists under \"" + metadataLoc + "/scripts\" and is executable!", null); | ||
243 | else { | ||
244 | kernelArchesHandler(); | ||
245 | } | ||
246 | } | ||
247 | } | ||
248 | } else if (widget == comboKArch) { | ||
249 | String selection = comboKArch.getText(); | ||
250 | if (!bspElem.getKarch().contentEquals(selection)) | ||
251 | bspElem = new YoctoBspElement(); | ||
252 | if (selection.matches("qemu")) { | ||
253 | labelQArch.setEnabled(true); | ||
254 | comboQArch.setEnabled(true); | ||
255 | } else { | ||
256 | labelQArch.setEnabled(false); | ||
257 | comboQArch.setEnabled(false); | ||
258 | } | ||
259 | } | ||
260 | |||
261 | String buildDir = textBuildLoc.getText(); | ||
262 | String outputDir = textBspOutputLoc.getText(); | ||
263 | String bspName = textBspName.getText(); | ||
264 | |||
265 | if (bspName.contains(" ")) { | ||
266 | status = new Status(IStatus.ERROR, "not_used", 0, | ||
267 | "BSP name contains space which is not allowed!", null); | ||
268 | } | ||
269 | |||
270 | if (!outputDir.isEmpty()){ | ||
271 | if (outputDir.matches(buildDir)) { | ||
272 | status = new Status(IStatus.ERROR, "not_used", 0, | ||
273 | "You've set BSP output directory the same as build directory, please leave output directory empty for this scenario!", null); | ||
274 | } else { | ||
275 | File outputDirectory = new File(outputDir); | ||
276 | if (outputDirectory.exists()){ | ||
277 | status = new Status(IStatus.ERROR, "not_used", 0, | ||
278 | "Your BSP output directory points to an exiting directory!", null); | ||
279 | } | ||
280 | } | ||
281 | } else if (buildDir.startsWith(metadataLoc) && !bspName.isEmpty()) { | ||
282 | String bspDirStr = metadataLoc + "/meta-" + bspName; | ||
283 | File bspDir = new File(bspDirStr); | ||
284 | if (bspDir.exists()) { | ||
285 | status = new Status(IStatus.ERROR, "not_used", 0, | ||
286 | "Your BSP with name: " + bspName + " already exist under directory: " + bspDirStr + ", please change your bsp name!", null); | ||
287 | } | ||
288 | } | ||
289 | |||
290 | if (status.getSeverity() == IStatus.ERROR) | ||
291 | setErrorMessage(status.getMessage()); | ||
292 | |||
293 | getWizard().getContainer().updateButtons(); | ||
294 | canFlipToNextPage(); | ||
295 | } | ||
296 | |||
297 | private Status checkBuildDir() { | ||
298 | |||
299 | String metadataLoc = textMetadataLoc.getText(); | ||
300 | String buildLoc = textBuildLoc.getText(); | ||
301 | |||
302 | if (buildLoc.isEmpty()) { | ||
303 | buildLoc = metadataLoc + "/build"; | ||
304 | return createBuildDir(buildLoc); | ||
305 | } else { | ||
306 | File buildLocDir = new File(buildLoc); | ||
307 | if (!buildLocDir.exists()) { | ||
308 | return createBuildDir(buildLoc); | ||
309 | } else if (buildLocDir.isDirectory()) { | ||
310 | return createBuildDir(buildLoc); | ||
311 | } else { | ||
312 | return new Status(IStatus.ERROR, "not_used", 0, "Invalid build location: Make sure the build location is a directory!", null); | ||
313 | } | ||
314 | } | ||
315 | } | ||
316 | |||
317 | private Status createBuildDir(String buildLoc) { | ||
318 | String metadataDir = textMetadataLoc.getText(); | ||
319 | |||
320 | // if we do not change the directory to metadata location the script will be looked into the directory indicated by user.dir system property | ||
321 | // system.property usually points to the location from where eclipse was started | ||
322 | String createBuildDirCmd = "cd " + metadataDir + ";source " + metadataDir + "/oe-init-build-env " + buildLoc; | ||
323 | |||
324 | try { | ||
325 | ProcessBuilder builder = new ProcessBuilder(new String[] {"bash", "-c", createBuildDirCmd}); | ||
326 | Process proc = builder.start(); | ||
327 | InputStream errorStream = proc.getErrorStream(); | ||
328 | InputStreamReader isr = new InputStreamReader(errorStream); | ||
329 | BufferedReader br = new BufferedReader(isr); | ||
330 | String line = null; | ||
331 | String status = ""; | ||
332 | while ( (line = br.readLine()) != null) { | ||
333 | status += line; | ||
334 | } | ||
335 | |||
336 | if (proc.waitFor() != 0) | ||
337 | return new Status(IStatus.ERROR, "not_used", 0, status, null);; | ||
338 | return new Status(IStatus.OK, "not_used", 0, "", null); | ||
339 | } catch (Exception e) { | ||
340 | return new Status(IStatus.ERROR, "not_used", 0, e.getMessage(), null); | ||
341 | } | ||
342 | } | ||
343 | |||
344 | public YoctoBspElement getBSPElement() { | ||
345 | return this.bspElem; | ||
346 | } | ||
347 | |||
348 | |||
349 | private void resetKarchCombo() { | ||
350 | comboKArch.deselectAll(); | ||
351 | comboQArch.deselectAll(); | ||
352 | comboKArch.setEnabled(false); | ||
353 | labelQArch.setEnabled(false); | ||
354 | comboQArch.setEnabled(false); | ||
355 | } | ||
356 | |||
357 | private void kernelArchesHandler() { | ||
358 | BSPAction kArchesAction = getKArches(); | ||
359 | if (kArchesAction.getMessage() == null && kArchesAction.getItems().length != 0) { | ||
360 | comboKArch.setItems(kArchesAction.getItems()); | ||
361 | comboKArch.setEnabled(true); | ||
362 | } else if (kArchesAction.getMessage() != null){ | ||
363 | setErrorMessage(kArchesAction.getMessage()); | ||
364 | return; | ||
365 | } | ||
366 | BSPAction qArchesAction = getQArches(); | ||
367 | if (qArchesAction.getMessage() == null && qArchesAction.getItems().length != 0) { | ||
368 | comboQArch.setItems(qArchesAction.getItems()); | ||
369 | } else if (qArchesAction.getMessage() != null) | ||
370 | setErrorMessage(qArchesAction.getMessage()); | ||
371 | |||
372 | } | ||
373 | |||
374 | @Override | ||
375 | public boolean canFlipToNextPage(){ | ||
376 | String err = getErrorMessage(); | ||
377 | if (err != null) | ||
378 | return false; | ||
379 | else if (!validatePage()) | ||
380 | return false; | ||
381 | return true; | ||
382 | } | ||
383 | |||
384 | |||
385 | public boolean validatePage() { | ||
386 | String metadataLoc = textMetadataLoc.getText(); | ||
387 | String bspname = textBspName.getText(); | ||
388 | String karch = comboKArch.getText(); | ||
389 | String qarch = comboQArch.getText(); | ||
390 | if (metadataLoc.isEmpty() || | ||
391 | bspname.isEmpty() || | ||
392 | karch.isEmpty()) { | ||
393 | return false; | ||
394 | } else if (karch.matches("qemu") && qarch.isEmpty()) { | ||
395 | return false; | ||
396 | } | ||
397 | |||
398 | bspElem.setBspName(bspname); | ||
399 | if (!textBspOutputLoc.getText().isEmpty()) | ||
400 | bspElem.setBspOutLoc(textBspOutputLoc.getText()); | ||
401 | else | ||
402 | bspElem.setBspOutLoc(""); | ||
403 | if (!textBuildLoc.getText().isEmpty()) { | ||
404 | checkBuildDir(); | ||
405 | bspElem.setBuildLoc(textBuildLoc.getText()); | ||
406 | } else { | ||
407 | bspElem.setBuildLoc(metadataLoc + "/build"); | ||
408 | if (!buildDirChecked) { | ||
409 | checkBuildDir(); | ||
410 | buildDirChecked = true; | ||
411 | } | ||
412 | } | ||
413 | bspElem.setMetadataLoc(metadataLoc); | ||
414 | bspElem.setKarch(karch); | ||
415 | bspElem.setQarch(qarch); | ||
416 | |||
417 | |||
418 | if (!bspElem.getValidPropertiesFile()) { | ||
419 | boolean validPropertiesFile = true; | ||
420 | BSPAction action = createPropertiesFile(); | ||
421 | if (action.getMessage() != null) { | ||
422 | validPropertiesFile = false; | ||
423 | setErrorMessage(action.getMessage()); | ||
424 | } | ||
425 | bspElem.setValidPropertiesFile(validPropertiesFile); | ||
426 | } | ||
427 | return true; | ||
428 | } | ||
429 | |||
430 | private BSPAction createPropertiesFile() { | ||
431 | String createPropertiesCmd = bspElem.getMetadataLoc() + "/scripts/" + | ||
432 | PROPERTIES_CMD_PREFIX + bspElem.getKarch() + | ||
433 | PROPERTIES_CMD_SURFIX + PROPERTIES_FILE; | ||
434 | BSPProgressDialog progressDialog = new BSPProgressDialog(getShell(), new ErrorCollectorThread(createPropertiesCmd), "Creating properties file "); | ||
435 | progressDialog.run(false); | ||
436 | return progressDialog.getBspAction(); | ||
437 | } | ||
438 | |||
439 | private BSPAction getKArches() { | ||
440 | String getKArchCmd = textMetadataLoc.getText() + "/scripts/" + KARCH_CMD; | ||
441 | BSPProgressDialog progressDialog = new BSPProgressDialog(getShell(), new KernelArchGetter(getKArchCmd), "Loading kernel architectures "); | ||
442 | progressDialog.run(false); | ||
443 | return progressDialog.getBspAction(); | ||
444 | } | ||
445 | |||
446 | private BSPAction getQArches() { | ||
447 | String getQArchCmd = textMetadataLoc.getText() + "/scripts/" + QARCH_CMD; | ||
448 | BSPProgressDialog progressDialog = new BSPProgressDialog(getShell(), new QemuArchGetter(getQArchCmd), "Loading Qemu architectures "); | ||
449 | progressDialog.run(false); | ||
450 | return progressDialog.getBspAction(); | ||
451 | } | ||
452 | |||
453 | public Button getBtnMetadataLoc() { | ||
454 | return btnMetadataLoc; | ||
455 | } | ||
456 | |||
457 | public void setBtnMetadataLoc(Button btnMetadataLoc) { | ||
458 | this.btnMetadataLoc = btnMetadataLoc; | ||
459 | } | ||
460 | |||
461 | public Button getBtnBspOutLoc() { | ||
462 | return btnBspOutputLoc; | ||
463 | } | ||
464 | |||
465 | public void setBtnBspOutLoc(Button btnBspOutLoc) { | ||
466 | this.btnBspOutputLoc = btnBspOutLoc; | ||
467 | } | ||
468 | |||
469 | public Button getBtnBuilddirLoc() { | ||
470 | return btnBuildLoc; | ||
471 | } | ||
472 | |||
473 | public void setBtnBuilddirLoc(Button btnBuilddirLoc) { | ||
474 | this.btnBuildLoc = btnBuilddirLoc; | ||
475 | } | ||
476 | |||
477 | class BuildLocationListener implements FocusListener{ | ||
478 | String value; | ||
479 | boolean changed; | ||
480 | |||
481 | BuildLocationListener(String value){ | ||
482 | this.value = value; | ||
483 | } | ||
484 | @Override | ||
485 | public void focusGained(FocusEvent e) { | ||
486 | value = ((Text)e.getSource()).getText(); | ||
487 | } | ||
488 | |||
489 | @Override | ||
490 | public void focusLost(FocusEvent e) { | ||
491 | if(!((Text)e.getSource()).getText().equals(value)) { | ||
492 | checkBuildDir(); | ||
493 | buildDirChecked = true; | ||
494 | } | ||
495 | } | ||
496 | |||
497 | } | ||
498 | } | ||