001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one
003: * or more contributor license agreements. See the NOTICE file
004: * distributed with this work for additional information
005: * regarding copyright ownership. The ASF licenses this file
006: * to you under the Apache License, Version 2.0 (the
007: * "License"); you may not use this file except in compliance
008: * with the License. You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing,
013: * software distributed under the License is distributed on an
014: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015: * KIND, either express or implied. See the License for the
016: * specific language governing permissions and limitations
017: * under the License.
018: */
019:
020: package org.apache.axis2.tool.codegen.eclipse.ui;
021:
022: import java.io.File;
023:
024: import org.apache.axis2.tool.codegen.eclipse.plugin.CodegenWizardPlugin;
025: import org.apache.axis2.tool.codegen.eclipse.util.UIConstants;
026: import org.eclipse.core.resources.IWorkspaceRoot;
027: import org.eclipse.core.resources.ResourcesPlugin;
028: import org.eclipse.core.runtime.Path;
029: import org.eclipse.swt.SWT;
030: import org.eclipse.swt.events.ModifyEvent;
031: import org.eclipse.swt.events.ModifyListener;
032: import org.eclipse.swt.events.SelectionAdapter;
033: import org.eclipse.swt.events.SelectionEvent;
034: import org.eclipse.swt.graphics.Color;
035: import org.eclipse.swt.layout.GridData;
036: import org.eclipse.swt.layout.GridLayout;
037: import org.eclipse.swt.widgets.Button;
038: import org.eclipse.swt.widgets.Composite;
039: import org.eclipse.swt.widgets.DirectoryDialog;
040: import org.eclipse.swt.widgets.Label;
041: import org.eclipse.swt.widgets.Text;
042: import org.eclipse.ui.dialogs.ContainerSelectionDialog;
043:
044: public class OutputPage extends AbstractWizardPage {
045:
046: private Text outputLocation;
047:
048: private Text axisHomeLocation;
049:
050: private Text jarFileNameText;
051:
052: private Button browseButton;
053:
054: private Button axisHomeBrowseButton;
055:
056: private Button axisLoadLibsButton;
057:
058: private Button copyLibButton;
059:
060: private Button jarCreationButton;
061:
062: private Button workspaceProjectOptionsButton;
063:
064: private Button filesyStemOptionsButton;
065:
066: private Button copyPluginLibButton;
067:
068: private boolean workspaceSaveOption = false;
069:
070: private boolean jarFileCopyOption = false;
071:
072: private Label axisHomeLabel;
073:
074: private Label axisLoadLibResultsLabel;
075:
076: private Label jarFileNameLabel;
077:
078: private String axis2LibsLocation = null;
079:
080: private Label hintLabel;
081:
082: private Button hintButton;
083:
084: private boolean hintVisible = false;
085:
086: /**
087: *
088: */
089: public OutputPage() {
090: super ("page3");
091: }
092:
093: /**
094: * Creates some initial values for the settings.
095: */
096: protected void initializeDefaultSettings() {
097: settings.put(PREF_OUTPUT_LOCATION, "");
098: settings.put(PREF_AXIS_HOME_OUTPUT_LOCATION, "");
099: settings.put(PREF_JAR_FILE_NAME, "");
100: settings.put(PREF_CHECK_WORKSPACE, false);
101: settings.put(PREF_CHECK_FILE_SYSTEM, true);
102: settings.put(PREF_CHECK_AXIS_LIB_COPY, false);
103: settings.put(PREF_CHECK_JAR_CREATION, false);
104: settings.put(PREF_CHECK_AXIS_PLUGIN_LIB_COPY, false);
105: workspaceSaveOption = false;
106: jarFileCopyOption = false;
107: }
108:
109: /*
110: * (non-Javadoc)
111: *
112: * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
113: */
114: public void createControl(Composite parent) {
115: Composite container = new Composite(parent, SWT.NULL);
116: GridLayout layout = new GridLayout();
117: container.setLayout(layout);
118: layout.numColumns = 3;
119: layout.verticalSpacing = 9;
120:
121: GridData gd = new GridData(GridData.FILL_HORIZONTAL);
122:
123: gd = new GridData(GridData.FILL_HORIZONTAL);
124: gd.horizontalSpan = 3;
125: Label selectLabel = new Label(container, SWT.NULL);
126: selectLabel.setText(CodegenWizardPlugin
127: .getResourceString("page3.result.decs"));
128: selectLabel.setLayoutData(gd);
129:
130: gd = new GridData(GridData.FILL_HORIZONTAL);
131: gd.horizontalSpan = 3;
132: workspaceProjectOptionsButton = new Button(container, SWT.RADIO);
133: workspaceProjectOptionsButton.setLayoutData(gd);
134: workspaceProjectOptionsButton.setText(CodegenWizardPlugin
135: .getResourceString("page3.workspace.caption"));
136: workspaceProjectOptionsButton
137: .setToolTipText(CodegenWizardPlugin
138: .getResourceString("page3.workspace.desc"));
139: settings.put(PREF_CHECK_WORKSPACE, false);
140: settings.put(PREF_CHECK_FILE_SYSTEM, true);
141: workspaceProjectOptionsButton.setSelection(settings
142: .getBoolean(PREF_CHECK_WORKSPACE));
143: workspaceProjectOptionsButton
144: .addSelectionListener(new SelectionAdapter() {
145: public void widgetSelected(SelectionEvent e) {
146: handleCheckboxSelection();
147: }
148: });
149:
150: gd = new GridData(GridData.FILL_HORIZONTAL);
151: gd.horizontalSpan = 3;
152: filesyStemOptionsButton = new Button(container, SWT.RADIO);
153: filesyStemOptionsButton.setLayoutData(gd);
154: filesyStemOptionsButton.setText(CodegenWizardPlugin
155: .getResourceString("page3.filesystem.caption"));
156: filesyStemOptionsButton.setToolTipText(CodegenWizardPlugin
157: .getResourceString("page3.filesystem.desc"));
158: filesyStemOptionsButton.setSelection(settings
159: .getBoolean(PREF_CHECK_FILE_SYSTEM));
160: filesyStemOptionsButton
161: .addSelectionListener(new SelectionAdapter() {
162: public void widgetSelected(SelectionEvent e) {
163: handleCheckboxSelection();
164: }
165: });
166:
167: gd = new GridData(GridData.FILL_HORIZONTAL);
168: Label label = new Label(container, SWT.NULL);
169: label
170: .setText(org.apache.axis2.tool.codegen.eclipse.plugin.CodegenWizardPlugin
171: .getResourceString("page3.output.caption"));
172:
173: settings.put(PREF_OUTPUT_LOCATION, "");
174: settings.put(PREF_AXIS_HOME_OUTPUT_LOCATION, "");
175: outputLocation = new Text(container, SWT.BORDER);
176: outputLocation.setText(settings.get(PREF_OUTPUT_LOCATION));
177: outputLocation.setLayoutData(gd);
178: outputLocation.addModifyListener(new ModifyListener() {
179: public void modifyText(ModifyEvent e) {
180: settings.put(PREF_OUTPUT_LOCATION, outputLocation
181: .getText());
182: handleModifyEvent();
183: }
184: });
185:
186: browseButton = new Button(container, SWT.PUSH);
187: browseButton.setText(CodegenWizardPlugin
188: .getResourceString("page3.outselection.browse"));
189: browseButton.addSelectionListener(new SelectionAdapter() {
190: public void widgetSelected(SelectionEvent e) {
191: handleBrowse();
192: }
193: });
194:
195: gd = new GridData(GridData.FILL_HORIZONTAL);
196: gd.horizontalSpan = 3;
197: copyPluginLibButton = new Button(container, SWT.CHECK);
198: copyPluginLibButton.setText(CodegenWizardPlugin
199: .getResourceString("page3.copypluginlib.caption"));
200: copyPluginLibButton.setToolTipText(CodegenWizardPlugin
201: .getResourceString("page3.copypluginlib.caption"));
202: settings.put(PREF_CHECK_AXIS_PLUGIN_LIB_COPY, false);
203: copyPluginLibButton.setSelection(settings
204: .getBoolean(PREF_CHECK_AXIS_PLUGIN_LIB_COPY));
205: copyPluginLibButton.setLayoutData(gd);
206: copyPluginLibButton
207: .addSelectionListener(new SelectionAdapter() {
208: public void widgetSelected(SelectionEvent e) {
209: handleCopyPluginLibsCheckBox();
210: settings.put(PREF_CHECK_AXIS_PLUGIN_LIB_COPY,
211: copyPluginLibButton.getSelection());
212: }
213: });
214:
215: gd = new GridData(GridData.FILL_HORIZONTAL);
216: gd.horizontalSpan = 3;
217: Label fillLabel = new Label(container, SWT.NULL);
218: fillLabel.setText("");
219:
220: //filling label
221: gd = new GridData(GridData.FILL_HORIZONTAL);
222: gd.horizontalSpan = 3;
223: Label fillLabel1 = new Label(container, SWT.HORIZONTAL
224: | SWT.SEPARATOR);
225: fillLabel1.setLayoutData(gd);
226:
227: gd = new GridData(GridData.FILL_HORIZONTAL);
228: gd.horizontalSpan = 3;
229: copyLibButton = new Button(container, SWT.CHECK);
230: copyLibButton.setText(CodegenWizardPlugin
231: .getResourceString("page3.addaxislib.caption"));
232: copyLibButton.setToolTipText(CodegenWizardPlugin
233: .getResourceString("page3.addaxislib.desc"));
234: settings.put(PREF_CHECK_AXIS_LIB_COPY, false);
235: copyLibButton.setSelection(settings
236: .getBoolean(PREF_CHECK_AXIS_LIB_COPY));
237: copyLibButton.setLayoutData(gd);
238: copyLibButton.addSelectionListener(new SelectionAdapter() {
239: public void widgetSelected(SelectionEvent e) {
240: handlejarCheckBox();
241: settings.put(PREF_CHECK_AXIS_LIB_COPY, copyLibButton
242: .getSelection());
243: }
244: });
245:
246: gd = new GridData(GridData.FILL_HORIZONTAL);
247: axisHomeLabel = new Label(container, SWT.NULL);
248: axisHomeLabel.setText(CodegenWizardPlugin
249: .getResourceString("page3.axishome.caption"));
250:
251: axisHomeLocation = new Text(container, SWT.BORDER);
252: axisHomeLocation.setLayoutData(gd);
253: settings.put(PREF_AXIS_HOME_OUTPUT_LOCATION, "");
254: axisHomeLocation.setText(settings
255: .get(PREF_AXIS_HOME_OUTPUT_LOCATION));
256: axisHomeLocation.addModifyListener(new ModifyListener() {
257: public void modifyText(ModifyEvent e) {
258: settings.put(PREF_AXIS_HOME_OUTPUT_LOCATION,
259: axisHomeLocation.getText());
260: handleAxisHomeModifyEvent();
261: }
262: });
263:
264: axisHomeBrowseButton = new Button(container, SWT.PUSH);
265: axisHomeBrowseButton.setText(CodegenWizardPlugin
266: .getResourceString("page3.outselection.browse"));
267: axisHomeBrowseButton
268: .addSelectionListener(new SelectionAdapter() {
269: public void widgetSelected(SelectionEvent e) {
270: handleAxisHomeBrowse();
271: }
272: });
273:
274: axisLoadLibsButton = new Button(container, SWT.PUSH);
275: axisLoadLibsButton.setText(CodegenWizardPlugin
276: .getResourceString("page3.loadlibs.browse"));
277: axisLoadLibsButton.addSelectionListener(new SelectionAdapter() {
278: public void widgetSelected(SelectionEvent e) {
279: handleLoadLibsBrowse();
280: }
281: });
282:
283: gd = new GridData(GridData.FILL_HORIZONTAL);
284: gd.horizontalSpan = 2;
285: gd = new GridData(GridData.FILL_HORIZONTAL);
286: axisLoadLibResultsLabel = new Label(container, SWT.NULL);
287: axisLoadLibResultsLabel.setText("");
288: axisLoadLibResultsLabel.setLayoutData(gd);
289:
290: //filling label
291: gd = new GridData(GridData.FILL_HORIZONTAL);
292: gd.horizontalSpan = 3;
293: Label fillLabel2 = new Label(container, SWT.HORIZONTAL
294: | SWT.SEPARATOR);
295: fillLabel2.setLayoutData(gd);
296:
297: gd = new GridData(GridData.FILL_HORIZONTAL);
298: gd.horizontalSpan = 3;
299: jarCreationButton = new Button(container, SWT.CHECK);
300: jarCreationButton.setText(CodegenWizardPlugin
301: .getResourceString("page3.jarcreation.caption"));
302: jarCreationButton.setToolTipText(CodegenWizardPlugin
303: .getResourceString("page3.jarcreation.desc"));
304: settings.put(PREF_CHECK_JAR_CREATION, false);
305: jarCreationButton.setSelection(settings
306: .getBoolean(PREF_CHECK_JAR_CREATION));
307: jarCreationButton.setLayoutData(gd);
308: jarCreationButton.addSelectionListener(new SelectionAdapter() {
309: public void widgetSelected(SelectionEvent e) {
310: handlejarCreationCheckBox();
311: // settings.put(PREF_CHECK_JAR_CREATION, jarCreationButton.getSelection());
312: }
313: });
314:
315: gd = new GridData(GridData.FILL_HORIZONTAL);
316: jarFileNameLabel = new Label(container, SWT.NULL);
317: jarFileNameLabel.setText(CodegenWizardPlugin
318: .getResourceString("page3.jarname.caption"));
319:
320: jarFileNameText = new Text(container, SWT.BORDER);
321: jarFileNameText.setLayoutData(gd);
322: jarFileNameText.setText(settings.get(PREF_JAR_FILE_NAME));
323: jarFileNameText.addModifyListener(new ModifyListener() {
324: public void modifyText(ModifyEvent e) {
325: settings.put(PREF_JAR_FILE_NAME, jarFileNameText
326: .getText());
327: // handleAxisHomeModifyEvent();
328: }
329: });
330:
331: //filling label
332: gd = new GridData(GridData.FILL_HORIZONTAL);
333: gd.horizontalSpan = 3;
334: Label fillLabel3 = new Label(container, SWT.HORIZONTAL
335: | SWT.SEPARATOR);
336: fillLabel3.setLayoutData(gd);
337:
338: gd = new GridData(GridData.FILL_HORIZONTAL);
339: gd.horizontalSpan = 3;
340:
341: hintButton = new Button(container, SWT.PUSH);
342: hintButton.setText(CodegenWizardPlugin
343: .getResourceString("page3.hint.off"));
344: hintButton.addSelectionListener(new SelectionAdapter() {
345: public void widgetSelected(SelectionEvent e) {
346: handleHintBrowse();
347: }
348: });
349:
350: gd = new GridData(GridData.FILL_HORIZONTAL);
351: gd.horizontalSpan = 3;
352: hintLabel = new Label(container, SWT.NULL);
353: hintLabel.setText(CodegenWizardPlugin
354: .getResourceString("page3.hint.caption"));
355: hintLabel.setLayoutData(gd);
356: hintLabel.setVisible(hintVisible);
357:
358: disableControls();
359:
360: setControl(container);
361:
362: /*
363: * Update the buttons, in case this was restored from an earlier setting
364: */
365: if (restoredFromPreviousSettings) {
366: handleModifyEvent();
367: }
368: }
369:
370: private void handleHintBrowse() {
371: if (hintVisible) {
372: hintButton.setText(CodegenWizardPlugin
373: .getResourceString("page3.hint.off"));
374: hintVisible = false;
375: hintLabel.setVisible(hintVisible);
376: } else {
377: hintButton.setText(CodegenWizardPlugin
378: .getResourceString("page3.hint.on"));
379: hintVisible = true;
380: hintLabel.setVisible(hintVisible);
381: }
382:
383: }
384:
385: /**
386: * get the output location
387: *
388: * @return a string containing the full pathname of the output location
389: */
390: public String getOutputLocation() {
391: return outputLocation.getText();
392: }
393:
394: public String getAxisHomeLocation() {
395: return axisHomeLocation.getText();
396: }
397:
398: public String getJarFilename() {
399: return jarFileNameText.getText();
400: }
401:
402: public boolean getAxis2PluginLibCopyCheckBoxSelection() {
403: // return settings.getBoolean(PREF_CHECK_AXIS_PLUGIN_LIB_COPY);
404: return this .copyPluginLibButton.getSelection();
405: }
406:
407: public boolean getAxisLibCopyCheckBoxSelection() {
408: // return settings.getBoolean(PREF_CHECK_AXIS_LIB_COPY);
409: return this .copyLibButton.getSelection();
410: }
411:
412: public boolean getCreateJarCheckBoxSelection() {
413: // return settings.getBoolean(PREF_CHECK_JAR_CREATION);
414: return jarCreationButton.getSelection();
415:
416: }
417:
418: public String getAxisJarsLocation() {
419: return this .axis2LibsLocation;
420:
421: }
422:
423: public boolean oktoLoadLibs() {
424: return this .jarFileCopyOption;
425: }
426:
427: public void setJarFileName(String jarFileName) {
428: this .jarFileNameText.setText(jarFileName);
429: }
430:
431: /**
432: * Worker method for handling modifications to the textbox
433: *
434: */
435: private void handleModifyEvent() {
436: String text = this .outputLocation.getText();
437: if ((text == null) || (text.trim().equals(""))) {
438: updateStatus(org.apache.axis2.tool.codegen.eclipse.plugin.CodegenWizardPlugin
439: .getResourceString("page3.error.nolocation"));
440: return;
441: }
442: updateStatus(null);
443: }
444:
445: private void handleAxisHomeModifyEvent() {
446: String text = this .axisHomeLocation.getText();
447: if ((text == null) || (text.trim().equals(""))) {
448: updateStatus(org.apache.axis2.tool.codegen.eclipse.plugin.CodegenWizardPlugin
449: .getResourceString("page3.error.nolocation"));
450: return;
451: }
452: updateStatus(null);
453: }
454:
455: // private void handleJarNameModifyEvent() {
456: // String text = this.jarFileNameText.getText();
457: // if ((text == null) || (text.trim().equals(""))) {
458: // updateStatus(org.apache.axis2.tool.codegen.eclipse.plugin.CodegenWizardPlugin
459: // .getResourceString("page3.error.nolocation"));
460: // return;
461: // }
462: // updateStatus(null);
463: // }
464:
465: private void handleCheckboxSelection() {
466: if (workspaceProjectOptionsButton.getSelection()) {
467: settings.put(PREF_CHECK_WORKSPACE, true);
468: settings.put(PREF_CHECK_FILE_SYSTEM, false);
469: workspaceSaveOption = true;
470: } else if (filesyStemOptionsButton.getSelection()) {
471: settings.put(PREF_CHECK_FILE_SYSTEM, true);
472: settings.put(PREF_CHECK_WORKSPACE, false);
473: workspaceSaveOption = false;
474: }
475: }
476:
477: private void handlejarCheckBox() {
478: if (copyLibButton.getSelection()) {
479: enableControls();
480: settings.put(PREF_CHECK_AXIS_LIB_COPY, true);
481: } else {
482: disableControls();
483: settings.put(PREF_CHECK_AXIS_LIB_COPY, false);
484: }
485: }
486:
487: private void handleCopyPluginLibsCheckBox() {
488: if (copyPluginLibButton.getSelection()) {
489: settings.put(PREF_CHECK_AXIS_PLUGIN_LIB_COPY, true);
490: } else {
491: settings.put(PREF_CHECK_AXIS_PLUGIN_LIB_COPY, false);
492: }
493: }
494:
495: private void handlejarCreationCheckBox() {
496: if (jarCreationButton.getSelection() == true) {
497: settings.put(PREF_CHECK_JAR_CREATION, true);
498: } else {
499: settings.put(PREF_CHECK_JAR_CREATION, false);
500: this .jarFileNameText.setText("");
501: }
502: if (jarFileNameLabel.equals("")) {
503: updateStatus("Please enter a valid name to the jar file");
504: }
505: }
506:
507: private void disableControls() {
508: this .axisHomeLocation
509: .setText("Unpacked Axis2 binary home Or Axis2 source location");
510: this .axisHomeBrowseButton.setEnabled(false);
511: this .axisHomeLocation.setEnabled(false);
512: this .jarCreationButton.setSelection(false);
513: this .jarCreationButton.setEnabled(false);
514: this .axisHomeLabel.setEnabled(false);
515: this .axisLoadLibResultsLabel.setText("");
516: this .axisLoadLibResultsLabel.setEnabled(false);
517: this .axisLoadLibsButton.setEnabled(false);
518: this .jarFileNameLabel.setEnabled(false);
519: this .jarFileNameText.setText("");
520: this .jarFileNameText.setEnabled(false);
521: settings.put(PREF_CHECK_JAR_CREATION, false);
522: jarFileCopyOption = false;
523: Color color = getShell().getDisplay().getSystemColor(
524: SWT.COLOR_INFO_BACKGROUND);
525: axisLoadLibResultsLabel.setBackground(color);
526: }
527:
528: private void enableControls() {
529: this .axisHomeBrowseButton.setEnabled(true);
530: this .axisHomeLocation.setEnabled(true);
531: this .jarCreationButton.setEnabled(true);
532: this .axisHomeLabel.setEnabled(true);
533: this .axisLoadLibResultsLabel.setEnabled(true);
534: this .axisLoadLibsButton.setEnabled(true);
535: this .jarFileNameLabel.setEnabled(true);
536: this .jarFileNameText.setEnabled(true);
537: if (axisLoadLibResultsLabel.getText().equals("")) {
538: updateStatus("Please enter a valid path to the Axis2 libs and then try to load the libraries using the check libs button");
539: }
540: axisLoadLibResultsLabel.setText(CodegenWizardPlugin
541: .getResourceString("page3.loadlib.fail.caption"));
542: Color color = getShell().getDisplay().getSystemColor(
543: SWT.COLOR_RED);
544: axisLoadLibResultsLabel.setBackground(color);
545: }
546:
547: private void handleAxisHomeBrowse() {
548: this .axisHomeLocation
549: .setText("unpacked Axis2 binary home Or Axis2 source Location");
550: DirectoryDialog dialog = new DirectoryDialog(this .getShell());
551: String returnString = dialog.open();
552: if (returnString != null) {
553: axisHomeLocation.setText(returnString);
554: settings.put(PREF_AXIS_HOME_OUTPUT_LOCATION,
555: axisHomeLocation.getText());
556: }
557: }
558:
559: private void handleLoadLibsBrowse() {
560: if (axisHomeLocation.getText().equals("")) {
561: axisLoadLibResultsLabel.setText(CodegenWizardPlugin
562: .getResourceString("page3.loadlib.fail.caption"));
563: jarFileCopyOption = false;
564: if (axisLoadLibResultsLabel.getText().equals("")) {
565: updateStatus("Please enter a valid path to the Axis2 libs and then try to load the libraries using the check libs button");
566: }
567: } else {
568: settings.put(PREF_AXIS_HOME_OUTPUT_LOCATION,
569: axisHomeLocation.getText());
570: String axis_home = settings
571: .get(PREF_AXIS_HOME_OUTPUT_LOCATION);
572: String axis_target_lib = axis_home + File.separator
573: + UIConstants.TARGET + File.separator
574: + UIConstants.LIB;
575: String axis_std_lib_directory = axis_home + File.separator
576: + UIConstants.LIB;
577:
578: File axis_target_libs_directory = new File(axis_target_lib);
579: File axis_libs_directory = new File(axis_std_lib_directory);
580: if (axis_libs_directory.isDirectory()
581: || axis_target_libs_directory.isDirectory()) {
582: axisLoadLibResultsLabel
583: .setText(CodegenWizardPlugin
584: .getResourceString("page3.loadlib.success.caption"));
585: if (axis_libs_directory.isDirectory()) {
586: axis2LibsLocation = axis_std_lib_directory;
587: } else if (axis_target_libs_directory.isDirectory()) {
588: axis2LibsLocation = axis_target_lib;
589: }
590: jarFileCopyOption = true;
591: Color color = getShell().getDisplay().getSystemColor(
592: SWT.COLOR_INFO_BACKGROUND);
593: axisLoadLibResultsLabel.setBackground(color);
594: } else {
595: axisLoadLibResultsLabel
596: .setText(CodegenWizardPlugin
597: .getResourceString("page3.loadlib.fail.caption"));
598: Color color = getShell().getDisplay().getSystemColor(
599: SWT.COLOR_RED);
600: axisLoadLibResultsLabel.setBackground(color);
601: updateStatus(org.apache.axis2.tool.codegen.eclipse.plugin.CodegenWizardPlugin
602: .getResourceString("page3.loadlib.fail.message"));
603: jarFileCopyOption = false;
604: }
605: }
606: }
607:
608: /**
609: * Handle the browse button events: opens a dialog where the user can choose
610: * an external directory location
611: *
612: */
613: private void handleBrowse() {
614: // Change this to add the clarity of 2 option buttions
615: // boolean location = locationSelectCheckBox.getSelection();
616: boolean location = false;
617: if (settings.getBoolean(PREF_CHECK_FILE_SYSTEM)) {
618: location = false;
619: } else if (settings.getBoolean(PREF_CHECK_WORKSPACE)) {
620: location = true;
621: }
622:
623: if (workspaceSaveOption) {
624: location = true;
625: }
626:
627: if (!location) {
628: DirectoryDialog dialog = new DirectoryDialog(this
629: .getShell());
630: String returnString = dialog.open();
631: if (returnString != null) {
632: outputLocation.setText(returnString);
633: }
634: } else {
635: IWorkspaceRoot root = ResourcesPlugin.getWorkspace()
636: .getRoot();
637:
638: ContainerSelectionDialog dialog = new ContainerSelectionDialog(
639: getShell(),
640: root,
641: false,
642: CodegenWizardPlugin
643: .getResourceString("page3.containerbox.title"));
644: if (dialog.open() == ContainerSelectionDialog.OK) {
645: Object[] result = dialog.getResult();
646: if (result.length == 1) {
647: Path path = ((Path) result[0]);
648: // append to the workspace path
649: if (root.exists(path)) {
650: outputLocation.setText(root.getLocation()
651: .append(path).toFile()
652: .getAbsolutePath());
653: }
654: }
655: }
656: }
657:
658: }
659:
660: /*
661: * (non-Javadoc)
662: *
663: * @see org.apache.axis2.tool.codegen.eclipse.ui.CodegenPage#getPageType()
664: */
665: public int getPageType() {
666: return WSDL_2_JAVA_TYPE;
667: }
668: }
|