~ubuntu-branches/ubuntu/jaunty/ant/jaunty-proposed

« back to all changes in this revision

Viewing changes to src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJAntToolGUI.java

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Gybas
  • Date: 2002-02-14 14:28:48 UTC
  • Revision ID: james.westby@ubuntu.com-20020214142848-2ww7ynmqkj31vlmn
Tags: upstream-1.4.1
ImportĀ upstreamĀ versionĀ 1.4.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package org.apache.tools.ant.taskdefs.optional.ide;
 
2
 
 
3
/*
 
4
 * The Apache Software License, Version 1.1
 
5
 *
 
6
 * Copyright (c) 1999 The Apache Software Foundation.  All rights 
 
7
 * reserved.
 
8
 *
 
9
 * Redistribution and use in source and binary forms, with or without
 
10
 * modification, are permitted provided that the following conditions
 
11
 * are met:
 
12
 *
 
13
 * 1. Redistributions of source code must retain the above copyright
 
14
 *    notice, this list of conditions and the following disclaimer. 
 
15
 *
 
16
 * 2. Redistributions in binary form must reproduce the above copyright
 
17
 *    notice, this list of conditions and the following disclaimer in
 
18
 *    the documentation and/or other materials provided with the
 
19
 *    distribution.
 
20
 *
 
21
 * 3. The end-user documentation included with the redistribution, if
 
22
 *    any, must include the following acknowlegement:  
 
23
 *       "This product includes software developed by the 
 
24
 *        Apache Software Foundation (http://www.apache.org/)."
 
25
 *    Alternately, this acknowlegement may appear in the software itself,
 
26
 *    if and wherever such third-party acknowlegements normally appear.
 
27
 *
 
28
 * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
 
29
 *    Foundation" must not be used to endorse or promote products derived
 
30
 *    from this software without prior written permission. For written 
 
31
 *    permission, please contact apache@apache.org.
 
32
 *
 
33
 * 5. Products derived from this software may not be called "Apache"
 
34
 *    nor may "Apache" appear in their names without prior written
 
35
 *    permission of the Apache Group.
 
36
 *
 
37
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 
38
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 
39
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 
40
 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
 
41
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 
42
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 
43
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 
44
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 
45
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 
46
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 
47
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 
48
 * SUCH DAMAGE.
 
49
 * ====================================================================
 
50
 *
 
51
 * This software consists of voluntary contributions made by many
 
52
 * individuals on behalf of the Apache Software Foundation.  For more
 
53
 * information on the Apache Software Foundation, please see
 
54
 * <http://www.apache.org/>.
 
55
 */
 
56
 
 
57
import java.util.Vector;
 
58
import java.awt.Frame;
 
59
import java.awt.Dialog;
 
60
import java.awt.Panel;
 
61
import java.awt.MenuBar;
 
62
import java.awt.Menu;
 
63
import java.awt.MenuItem;
 
64
import java.awt.Label;
 
65
import java.awt.TextField;
 
66
import java.awt.TextArea;
 
67
import java.awt.List;
 
68
import java.awt.Choice;
 
69
import java.awt.Button;
 
70
import java.awt.FileDialog;
 
71
import java.awt.FlowLayout;
 
72
import java.awt.BorderLayout;
 
73
import java.awt.GridBagLayout;
 
74
import java.awt.GridBagConstraints;
 
75
import java.awt.Insets;
 
76
import java.awt.Toolkit;
 
77
import java.awt.Font;
 
78
import java.awt.SystemColor;
 
79
import java.awt.event.ActionListener;
 
80
import java.awt.event.ItemListener;
 
81
import java.awt.event.TextListener;
 
82
import java.awt.event.WindowListener;
 
83
import java.awt.event.ActionEvent;
 
84
import java.awt.event.ItemEvent;
 
85
import java.awt.event.TextEvent;
 
86
import java.awt.event.WindowEvent;
 
87
import java.beans.PropertyChangeListener;
 
88
import org.apache.tools.ant.Main;
 
89
import org.apache.tools.ant.BuildException;
 
90
import org.apache.tools.ant.BuildListener;
 
91
import org.apache.tools.ant.BuildEvent;
 
92
import org.apache.tools.ant.Project;
 
93
 
 
94
/**
 
95
 * This is a simple grafical user interface to provide the information needed by ANT and
 
96
 * to start the build-process within IBM VisualAge for Java.
 
97
 * <p>
 
98
 * I was using AWT to make it independent from the JDK-version. Please don't ask me for a Swing-version:
 
99
 * I am very familiar with Swing and I really think that it's not necessary for such a simple gui!
 
100
 * <p>
 
101
 * It is completely developed in VAJ using the visual composition editor. About 90% of the code is generated by VAJ,
 
102
 * but in fact I did a lot of <i>code-beautification</i> ;-).
 
103
 * <p>
 
104
 * @version 1.0 h
 
105
 * @author: Christoph Wilhelms, TUI Infotec GmbH
 
106
 */
 
107
public class VAJAntToolGUI extends Frame {
 
108
        /**
 
109
         * Members 
 
110
         */
 
111
        private VAJBuildLogger logger = new VAJBuildLogger();
 
112
        private String lineSeparator = "\r\n";
 
113
        private PrivateEventHandler iEventHandler = new PrivateEventHandler();
 
114
 
 
115
        /**
 
116
         * Members of the main-window
 
117
         */
 
118
        // main model
 
119
        private VAJBuildInfo iBuildInfo = null;
 
120
        // Menue
 
121
        private MenuBar iAntMakeMenuBar = null;
 
122
        private Menu iFileMenu = null;
 
123
        private MenuItem iSaveMenuItem = null;
 
124
        private MenuItem iMenuSeparator = null;
 
125
        private MenuItem iShowLogMenuItem = null;
 
126
        private Menu iHelpMenu = null;
 
127
        private MenuItem iAboutMenuItem = null;
 
128
        // Container
 
129
        private Panel iContentsPane = null;
 
130
        private Panel iOptionenPanel = null;
 
131
        private Panel iCommandButtonPanel = null;
 
132
        private FlowLayout iCommandButtonPanelFlowLayout = null;
 
133
        // Project name
 
134
        private Label iProjectLabel = null;
 
135
        private Label iProjectText = null;
 
136
        // XML-file 
 
137
        private Label iBuildFileLabel = null;
 
138
        private TextField iBuildFileTextField = null;
 
139
        private boolean iConnPtoP2Aligning = false;
 
140
        private Button iBrowseButton = null;
 
141
        private FileDialog iFileDialog = null;
 
142
        // Options
 
143
        private Choice iMessageOutputLevelChoice = null;
 
144
        private Label iMessageOutputLevelLabel = null;
 
145
        private Label iTargetLabel = null;
 
146
        private List iTargetList = null;
 
147
        // Command-buttons
 
148
        private Button iBuildButton = null;
 
149
        private Button iReloadButton = null;    
 
150
        private Button iCloseButton = null;
 
151
        /**
 
152
         * log-Window
 
153
         */
 
154
        // Container
 
155
        private Frame iMessageFrame = null;
 
156
        private Panel iMessageCommandPanel = null;
 
157
        private Panel iMessageContentPanel = null;
 
158
        // Components
 
159
        private TextArea iMessageTextArea = null;
 
160
        private Button iMessageOkButton = null;
 
161
        private Button iMessageClearLogButton = null;
 
162
        /**
 
163
         * About-dialog
 
164
         */
 
165
        // Container
 
166
        private Dialog iAboutDialog = null;
 
167
        private Panel iAboutDialogContentPanel = null;
 
168
        private Panel iAboutInfoPanel = null;
 
169
        private Panel iAboutCommandPanel = null;
 
170
        // Labels
 
171
        private Label iAboutTitleLabel = null;
 
172
        private Label iAboutDevLabel = null;
 
173
        private Label iAboutContactLabel = null;
 
174
        // Buttons
 
175
        private Button iAboutOkButton = null;
 
176
 
 
177
        /**
 
178
         * This internal BuildLogger, to be honest, is just a BuildListener. 
 
179
         * It does nearly the same as the DefaultLogger, but uses the Loggin-Window for output.
 
180
         */
 
181
        private class VAJBuildLogger implements BuildListener {
 
182
                private long startTime = System.currentTimeMillis();
 
183
 
 
184
                /**
 
185
                 * VAJBuildLogger constructor comment.
 
186
                 */
 
187
                public VAJBuildLogger() {
 
188
                        super();
 
189
                }
 
190
 
 
191
                /**
 
192
                 *  Fired after the last target has finished. This event
 
193
                 *  will still be thrown if an error occured during the build.
 
194
                 *
 
195
                 *  @see BuildEvent#getException()
 
196
                 */
 
197
                public void buildFinished(BuildEvent event) {
 
198
                        Throwable error = event.getException();
 
199
 
 
200
                        if (error == null) {
 
201
                                getMessageTextArea().append(lineSeparator + "BUILD SUCCESSFUL");
 
202
                        }
 
203
                        else {
 
204
                                getMessageTextArea().append(lineSeparator + "BUILD FAILED" + lineSeparator);
 
205
 
 
206
                                if (error instanceof BuildException) {
 
207
                                        getMessageTextArea().append(error.toString());
 
208
 
 
209
                                        Throwable nested = ((BuildException)error).getException();
 
210
                                        if (nested != null) {
 
211
                                                nested.printStackTrace(System.err);
 
212
                                        }
 
213
                                }
 
214
                                else {
 
215
                                        error.printStackTrace(System.err);
 
216
                                }
 
217
                        }
 
218
 
 
219
                        getMessageTextArea().append(lineSeparator + "Total time: " + formatTime(System.currentTimeMillis() - startTime));
 
220
                }
 
221
 
 
222
                /**
 
223
                 *  Fired before any targets are started.
 
224
                 */
 
225
                public void buildStarted(BuildEvent event) {
 
226
                        startTime = System.currentTimeMillis();
 
227
                        getMessageTextArea().append(lineSeparator);
 
228
                }
 
229
 
 
230
                /**
 
231
                 *  Fired whenever a message is logged.
 
232
                 *
 
233
                 *  @see BuildEvent#getMessage()
 
234
                 *  @see BuildEvent#getPriority()
 
235
                 */
 
236
                public void messageLogged(BuildEvent event) {
 
237
                        if (event.getPriority() <= getBuildInfo().getOutputMessageLevel()) {
 
238
                                String msg = "";
 
239
                                if (event.getTask() != null)
 
240
                                        msg = "[" + event.getTask().getTaskName() + "] ";
 
241
                                getMessageTextArea().append(lineSeparator + msg + event.getMessage());
 
242
                        }
 
243
                }
 
244
 
 
245
                /**
 
246
                 *  Fired when a target has finished. This event will
 
247
                 *  still be thrown if an error occured during the build.
 
248
                 *
 
249
                 *  @see BuildEvent#getException()
 
250
                 */
 
251
                public void targetFinished(BuildEvent event) {
 
252
                }
 
253
 
 
254
                /**
 
255
                 *  Fired when a target is started.
 
256
                 *
 
257
                 *  @see BuildEvent#getTarget()
 
258
                 */
 
259
                public void targetStarted(BuildEvent event) {
 
260
                        if (getBuildInfo().getOutputMessageLevel() <= Project.MSG_INFO) {
 
261
                                getMessageTextArea().append(lineSeparator + event.getTarget().getName() + ":");
 
262
                        }
 
263
                }
 
264
 
 
265
                /**
 
266
                 *  Fired when a task has finished. This event will still
 
267
                 *  be throw if an error occured during the build.
 
268
                 *
 
269
                 *  @see BuildEvent#getException()
 
270
                 */
 
271
                public void taskFinished(BuildEvent event) {
 
272
                }
 
273
 
 
274
                /**
 
275
                 *  Fired when a task is started.
 
276
                 *
 
277
                 *  @see BuildEvent#getTask()
 
278
                 */
 
279
                public void taskStarted(BuildEvent event) {
 
280
                }
 
281
                /**
 
282
                 * Chris: HACK: remove when Ant-Refactoring is finished!
 
283
                 */
 
284
                public void buildSuccessful() {
 
285
                        getMessageTextArea().append(lineSeparator + "BUILD SUCCESSFUL");
 
286
                        getMessageTextArea().append(lineSeparator + "Total time: " + formatTime(System.currentTimeMillis() - startTime));
 
287
                }
 
288
                /**
 
289
                 * Chris: HACK: remove when Ant-Refactoring is finished!
 
290
                 */
 
291
                public void buildFailed(Throwable exc) {
 
292
                        getMessageTextArea().append(lineSeparator + "BUILD FAILED" + lineSeparator);
 
293
 
 
294
                        if (exc instanceof BuildException) {
 
295
                                getMessageTextArea().append(exc.toString());
 
296
 
 
297
                                Throwable nested = ((BuildException)exc).getException();
 
298
                                if (nested != null) {
 
299
                                        nested.printStackTrace(System.err);
 
300
                                }
 
301
                        }
 
302
                        else {
 
303
                                exc.printStackTrace(System.err);
 
304
                        }
 
305
                        getMessageTextArea().append(lineSeparator + "Total time: " + formatTime(System.currentTimeMillis() - startTime));
 
306
                }
 
307
        }
 
308
        
 
309
        /**
 
310
         * Eventhandler to handle all AWT-events
 
311
         */
 
312
        private class PrivateEventHandler implements ActionListener, ItemListener, TextListener, WindowListener, PropertyChangeListener {
 
313
                /**
 
314
                 * ActionListener method
 
315
                 */
 
316
                public void actionPerformed(ActionEvent e) {
 
317
                        try {
 
318
                                /* #### Main App-Frame #### */
 
319
                                // browse XML-File with filechooser
 
320
                                if (e.getSource() == VAJAntToolGUI.this.getBrowseButton()) {
 
321
                                        getFileDialog().setDirectory(getBuildFileTextField().getText().substring(0, getBuildFileTextField().getText().lastIndexOf('\\') + 1));
 
322
                                        getFileDialog().setFile("*.xml");
 
323
                                        getFileDialog().show();
 
324
                                        if (!getFileDialog().getFile().equals("") ) {
 
325
                                                getBuildFileTextField().setText(getFileDialog().getDirectory() + getFileDialog().getFile());
 
326
                                        }
 
327
                                }
 
328
                                // dispose and exit application 
 
329
                                if (e.getSource() == VAJAntToolGUI.this.getCloseButton()) {
 
330
                                        dispose();
 
331
                                        System.exit(0);
 
332
                                }
 
333
                                // start build-process
 
334
                                if (e.getSource() == VAJAntToolGUI.this.getBuildButton()) 
 
335
                                        executeTarget();
 
336
                                if (e.getSource() == VAJAntToolGUI.this.getReloadButton()) {
 
337
                                        try {
 
338
                                                getBuildInfo().updateTargetList();
 
339
                                                fillList();
 
340
                                        }
 
341
                                        catch (Throwable fileNotFound) {
 
342
                                                handleException(fileNotFound);
 
343
                                                getTargetList().removeAll();
 
344
                                                getBuildButton().setEnabled(false);
 
345
                                        }
 
346
                                }
 
347
                                // MenuItems
 
348
                                if (e.getSource() == VAJAntToolGUI.this.getSaveMenuItem()) 
 
349
                                        saveBuildInfo();
 
350
                                if (e.getSource() == VAJAntToolGUI.this.getAboutMenuItem()) 
 
351
                                        getAboutDialog().show();
 
352
                                if (e.getSource() == VAJAntToolGUI.this.getShowLogMenuItem()) 
 
353
                                        getMessageFrame().show();
 
354
                                /* #### About dialog #### */
 
355
                                if (e.getSource() == VAJAntToolGUI.this.getAboutOkButton()) 
 
356
                                        getAboutDialog().dispose();
 
357
                                /* #### Log frame #### */
 
358
                                if (e.getSource() == VAJAntToolGUI.this.getMessageOkButton())
 
359
                                        getMessageFrame().dispose();
 
360
                                if (e.getSource() == VAJAntToolGUI.this.getMessageClearLogButton()) 
 
361
                                        getMessageTextArea().setText("");
 
362
                                if (e.getSource() == VAJAntToolGUI.this.getMessageOkButton()) 
 
363
                                        getMessageFrame().dispose();
 
364
                        }
 
365
                        catch (Throwable exc) {
 
366
                                handleException(exc);
 
367
                        }
 
368
                }
 
369
 
 
370
                /**
 
371
                 * ItemListener method
 
372
                 */
 
373
                public void itemStateChanged(ItemEvent e) {
 
374
                        try {
 
375
                                if (e.getSource() == VAJAntToolGUI.this.getTargetList()) 
 
376
                                        getBuildButton().setEnabled(true);
 
377
                                if (e.getSource() == VAJAntToolGUI.this.getMessageOutputLevelChoice()) 
 
378
                                        getBuildInfo().setOutputMessageLevel(getMessageOutputLevelChoice().getSelectedIndex());
 
379
                                if (e.getSource() == VAJAntToolGUI.this.getTargetList()) 
 
380
                                        getBuildInfo().setTarget(getTargetList().getSelectedItem());
 
381
                        }
 
382
                        catch (Throwable exc) {
 
383
                                handleException(exc);
 
384
                        }
 
385
                }
 
386
                
 
387
                /**
 
388
                 * PropertyChangeListener method
 
389
                 */
 
390
                public void propertyChange(java.beans.PropertyChangeEvent evt) {
 
391
                        if (evt.getSource() == VAJAntToolGUI.this.getBuildInfo() && (evt.getPropertyName().equals("projectName"))) 
 
392
                                connectProjectNameToLabel();
 
393
                        if (evt.getSource() == VAJAntToolGUI.this.getBuildInfo() && (evt.getPropertyName().equals("buildFileName"))) 
 
394
                                connectBuildFileNameToTextField();
 
395
                }
 
396
                
 
397
                /**
 
398
                 * TextListener method
 
399
                 */
 
400
                public void textValueChanged(TextEvent e) {
 
401
                        if (e.getSource() == VAJAntToolGUI.this.getBuildFileTextField()) 
 
402
                                connectTextFieldToBuildFileName();
 
403
                }
 
404
                
 
405
                /**
 
406
                 * WindowListener methods
 
407
                 */
 
408
                public void windowClosing(WindowEvent e) {
 
409
                        try {
 
410
                                if (e.getSource() == VAJAntToolGUI.this) {
 
411
                                        dispose();
 
412
                                        System.exit(0);
 
413
                                }
 
414
                                if (e.getSource() == VAJAntToolGUI.this.getAboutDialog()) 
 
415
                                        getAboutDialog().dispose();
 
416
                                if (e.getSource() == VAJAntToolGUI.this.getMessageFrame()) 
 
417
                                        getMessageFrame().dispose();
 
418
                        }
 
419
                        catch (Throwable exc) {
 
420
                                handleException(exc);
 
421
                        }
 
422
                }
 
423
                public void windowActivated(WindowEvent e) {};
 
424
                public void windowClosed(WindowEvent e) {};
 
425
                public void windowDeactivated(WindowEvent e) {};
 
426
                public void windowDeiconified(WindowEvent e) {};
 
427
                public void windowIconified(WindowEvent e) {};
 
428
                public void windowOpened(WindowEvent e) {};
 
429
        }
 
430
        
 
431
        /**
 
432
         * AntMake default-constructor.
 
433
         */
 
434
        private VAJAntToolGUI() {
 
435
                super();
 
436
                initialize();
 
437
        }
 
438
        /**
 
439
         * AntMake constructor called by VAJAntTool integration.
 
440
         * @param buildInfo VAJBuildInfo
 
441
         */
 
442
         
 
443
        public VAJAntToolGUI(VAJBuildInfo newBuildInfo) {
 
444
                super();
 
445
                setBuildInfo(newBuildInfo);
 
446
                initialize();
 
447
        }
 
448
        /**
 
449
         * This method is used to center dialogs.
 
450
         */
 
451
        public static void centerDialog(Dialog dialog) {
 
452
                dialog.setLocation((Toolkit.getDefaultToolkit().getScreenSize().width / 2) - (dialog.getSize().width / 2), (java.awt.Toolkit.getDefaultToolkit().getScreenSize().height / 2) - (dialog.getSize().height / 2));
 
453
        }
 
454
        /**
 
455
         * connectBuildFileNameToTextField:  (BuildInfo.buildFileName <--> BuildFileTextField.text)
 
456
         */
 
457
        private void connectBuildFileNameToTextField() {
 
458
                /* Set the target from the source */
 
459
                try {
 
460
                        if (iConnPtoP2Aligning == false) {
 
461
                                iConnPtoP2Aligning = true;
 
462
                                if ((getBuildInfo() != null)) {
 
463
                                        getBuildFileTextField().setText(getBuildInfo().getBuildFileName());
 
464
                                }
 
465
                                iConnPtoP2Aligning = false;
 
466
                        }
 
467
                } catch (Throwable iExc) {
 
468
                        iConnPtoP2Aligning = false;
 
469
                        handleException(iExc);
 
470
                }
 
471
        }
 
472
        /**
 
473
         * connectProjectNameToLabel:  (BuildInfo.vajProjectName <--> ProjectText.text)
 
474
         */
 
475
        private void connectProjectNameToLabel() {
 
476
                /* Set the target from the source */
 
477
                try {
 
478
                        if ((getBuildInfo() != null)) {
 
479
                                getProjectText().setText(getBuildInfo().getVAJProjectName());
 
480
                        }
 
481
                } catch (Throwable iExc) {
 
482
                        handleException(iExc);
 
483
                }
 
484
        }
 
485
        /**
 
486
         * connectTextFieldToBuildFileName:  (BuildInfo.buildFileName <--> BuildFileTextField.text)
 
487
         */
 
488
        private void connectTextFieldToBuildFileName() {
 
489
                /* Set the source from the target */
 
490
                try {
 
491
                        if (iConnPtoP2Aligning == false) {
 
492
                                iConnPtoP2Aligning = true;
 
493
                                if ((getBuildInfo() != null)) {
 
494
                                        getBuildInfo().setBuildFileName(getBuildFileTextField().getText());
 
495
                                }
 
496
                                iConnPtoP2Aligning = false;
 
497
                        }
 
498
                } catch (Throwable iExc) {
 
499
                        iConnPtoP2Aligning = false;
 
500
                        handleException(iExc);
 
501
                }
 
502
        }
 
503
        /**
 
504
         * external build of a .jar-file
 
505
         */
 
506
        private void executeTarget() {
 
507
                try     {
 
508
                        getMessageFrame().show();
 
509
                        // Chris: HACK: remove when Ant-Refactoring is finished!
 
510
                        logger.buildStarted(null);
 
511
                        getBuildInfo().executeProject(logger);
 
512
                        // Chris: HACK: remove when Ant-Refactoring is finished!
 
513
                        logger.buildSuccessful();                       
 
514
                }
 
515
                catch (Throwable exc) {
 
516
                        // We aren't interested in exceptions! All necessary information has been written to the logging-window!
 
517
                        // Unfortunately ANT-Refactoring isn't done yet!
 
518
                        // Chris: HACK: remove when Ant-Refactoring is finished!
 
519
                        logger.buildFailed( exc );                      
 
520
                }
 
521
                return;
 
522
        }
 
523
        /**
 
524
         * Fills the taget-list with project-targets
 
525
         */
 
526
        private void fillList() {
 
527
                getTargetList().removeAll();
 
528
                Vector targets = getBuildInfo().getProjectTargets();
 
529
                for (int i = 0;i < targets.size(); i++) {
 
530
                        getTargetList().add(targets.elementAt(i).toString());
 
531
                }
 
532
                getTargetList().select(iBuildInfo.getProjectTargets().indexOf(iBuildInfo.getTarget()));
 
533
                if (getTargetList().getSelectedIndex() >= 0) {
 
534
                        getBuildButton().setEnabled(true);
 
535
                }
 
536
        }
 
537
        /**
 
538
         * Copied from DefaultLogger to provide the same time-format.
 
539
         */
 
540
        public static String formatTime(long millis) {
 
541
                long seconds = millis / 1000;
 
542
                long minutes = seconds / 60;
 
543
 
 
544
                if (minutes > 0) {
 
545
                        return Long.toString(minutes) + " minute"
 
546
                                + (minutes == 1 ? " " : "s ")
 
547
                                + Long.toString(seconds%60) + " second"
 
548
                                + (seconds%60 == 1 ? "" : "s");
 
549
                }
 
550
                else {
 
551
                        return Long.toString(seconds) + " second"
 
552
                                + (seconds%60 == 1 ? "" : "s");
 
553
                }
 
554
        }
 
555
        /**
 
556
         * Return the AboutCommandPanel property value.
 
557
         * @return java.awt.Panel
 
558
         */
 
559
        private Panel getAboutCommandPanel() {
 
560
                if (iAboutCommandPanel == null) {
 
561
                        try {
 
562
                                iAboutCommandPanel = new Panel();
 
563
                                iAboutCommandPanel.setName("AboutCommandPanel");
 
564
                                iAboutCommandPanel.setLayout(new java.awt.FlowLayout());
 
565
                                getAboutCommandPanel().add(getAboutOkButton(), getAboutOkButton().getName());
 
566
                        } catch (Throwable iExc) {
 
567
                                handleException(iExc);
 
568
                        }
 
569
                }
 
570
                return iAboutCommandPanel;
 
571
        }
 
572
        /**
 
573
         * Return the AboutContactLabel property value.
 
574
         * @return java.awt.Label
 
575
         */
 
576
        private Label getAboutContactLabel() {
 
577
                if (iAboutContactLabel == null) {
 
578
                        try {
 
579
                                iAboutContactLabel = new Label();
 
580
                                iAboutContactLabel.setName("AboutContactLabel");
 
581
                                iAboutContactLabel.setAlignment(java.awt.Label.CENTER);
 
582
                                iAboutContactLabel.setText("contact: wolf.siberski@tui.de or christoph.wilhelms@tui.de");
 
583
                        } catch (Throwable iExc) {
 
584
                                handleException(iExc);
 
585
                        }
 
586
                }
 
587
                return iAboutContactLabel;
 
588
        }
 
589
        /**
 
590
         * Return the AboutDevLabel property value.
 
591
         * @return java.awt.Label
 
592
         */
 
593
        private Label getAboutDevLabel() {
 
594
                if (iAboutDevLabel == null) {
 
595
                        try {
 
596
                                iAboutDevLabel = new Label();
 
597
                                iAboutDevLabel.setName("AboutDevLabel");
 
598
                                iAboutDevLabel.setAlignment(java.awt.Label.CENTER);
 
599
                                iAboutDevLabel.setText("developed by Wolf Siberski & Christoph Wilhelms");
 
600
                        } catch (Throwable iExc) {
 
601
                                handleException(iExc);
 
602
                        }
 
603
                }
 
604
                return iAboutDevLabel;
 
605
        }
 
606
        /**
 
607
         * Return the AboutDialog property value.
 
608
         * @return java.awt.Dialog
 
609
         */
 
610
        private Dialog getAboutDialog() {
 
611
                if (iAboutDialog == null) {
 
612
                        try {
 
613
                                iAboutDialog = new Dialog(this);
 
614
                                iAboutDialog.setName("AboutDialog");
 
615
                                iAboutDialog.setResizable(false);
 
616
                                iAboutDialog.setLayout(new java.awt.BorderLayout());
 
617
                                iAboutDialog.setBounds(550, 14, 383, 142);
 
618
                                iAboutDialog.setModal(true);
 
619
                                iAboutDialog.setTitle("About...");
 
620
                                getAboutDialog().add(getAboutDialogContentPanel(), "Center");
 
621
                                iAboutDialog.pack();
 
622
                                centerDialog(iAboutDialog);
 
623
                        } catch (Throwable iExc) {
 
624
                                handleException(iExc);
 
625
                        }
 
626
                }
 
627
                return iAboutDialog;
 
628
        }
 
629
        /**
 
630
         * Return the AboutDialogContentPanel property value.
 
631
         * @return java.awt.Panel
 
632
         */
 
633
        private Panel getAboutDialogContentPanel() {
 
634
                if (iAboutDialogContentPanel == null) {
 
635
                        try {
 
636
                                iAboutDialogContentPanel = new Panel();
 
637
                                iAboutDialogContentPanel.setName("AboutDialogContentPanel");
 
638
                                iAboutDialogContentPanel.setLayout(new java.awt.BorderLayout());
 
639
                                getAboutDialogContentPanel().add(getAboutCommandPanel(), "South");
 
640
                                getAboutDialogContentPanel().add(getAboutInfoPanel(), "Center");
 
641
                        } catch (Throwable iExc) {
 
642
                                handleException(iExc);
 
643
                        }
 
644
                }
 
645
                return iAboutDialogContentPanel;
 
646
        }
 
647
        /**
 
648
         * Return the AboutInfoPanel property value.
 
649
         * @return java.awt.Panel
 
650
         */
 
651
        private Panel getAboutInfoPanel() {
 
652
                if (iAboutInfoPanel == null) {
 
653
                        try {
 
654
                                iAboutInfoPanel = new Panel();
 
655
                                iAboutInfoPanel.setName("AboutInfoPanel");
 
656
                                iAboutInfoPanel.setLayout(new GridBagLayout());
 
657
 
 
658
                                GridBagConstraints constraintsAboutTitleLabel = new GridBagConstraints();
 
659
                                constraintsAboutTitleLabel.gridx = 0; constraintsAboutTitleLabel.gridy = 0;
 
660
                                constraintsAboutTitleLabel.fill = GridBagConstraints.HORIZONTAL;
 
661
                                constraintsAboutTitleLabel.weightx = 1.0;
 
662
                                constraintsAboutTitleLabel.weighty = 1.0;
 
663
                                constraintsAboutTitleLabel.insets = new Insets(4, 0, 4, 0);
 
664
                                getAboutInfoPanel().add(getAboutTitleLabel(), constraintsAboutTitleLabel);
 
665
 
 
666
                                GridBagConstraints constraintsAboutDevLabel = new GridBagConstraints();
 
667
                                constraintsAboutDevLabel.gridx = 0; constraintsAboutDevLabel.gridy = 1;
 
668
                                constraintsAboutDevLabel.fill = GridBagConstraints.HORIZONTAL;
 
669
                                constraintsAboutDevLabel.weightx = 1.0;
 
670
                                constraintsAboutDevLabel.insets = new Insets(4, 0, 0, 0);
 
671
                                getAboutInfoPanel().add(getAboutDevLabel(), constraintsAboutDevLabel);
 
672
 
 
673
                                GridBagConstraints constraintsAboutContactLabel = new GridBagConstraints();
 
674
                                constraintsAboutContactLabel.gridx = 0; constraintsAboutContactLabel.gridy = 2;
 
675
                                constraintsAboutContactLabel.fill = GridBagConstraints.HORIZONTAL;
 
676
                                constraintsAboutContactLabel.weightx = 1.0;
 
677
                                constraintsAboutContactLabel.insets = new Insets(2, 0, 4, 0);
 
678
                                getAboutInfoPanel().add(getAboutContactLabel(), constraintsAboutContactLabel);
 
679
                        } catch (Throwable iExc) {
 
680
                                handleException(iExc);
 
681
                        }
 
682
                }
 
683
                return iAboutInfoPanel;
 
684
        }
 
685
        /**
 
686
         * Return the AboutMenuItem property value.
 
687
         * @return java.awt.MenuItem
 
688
         */
 
689
        private MenuItem getAboutMenuItem() {
 
690
                if (iAboutMenuItem == null) {
 
691
                        try {
 
692
                                iAboutMenuItem = new MenuItem();
 
693
                                iAboutMenuItem.setLabel("About...");
 
694
                        } catch (Throwable iExc) {
 
695
                                handleException(iExc);
 
696
                        }
 
697
                }
 
698
                return iAboutMenuItem;
 
699
        }
 
700
        /**
 
701
         * Return the AboutOkButton property value.
 
702
         * @return java.awt.Button
 
703
         */
 
704
        private Button getAboutOkButton() {
 
705
                if (iAboutOkButton == null) {
 
706
                        try {
 
707
                                iAboutOkButton = new Button();
 
708
                                iAboutOkButton.setName("AboutOkButton");
 
709
                                iAboutOkButton.setLabel("OK");
 
710
                        } catch (Throwable iExc) {
 
711
                                handleException(iExc);
 
712
                        }
 
713
                }
 
714
                return iAboutOkButton;
 
715
        }
 
716
        /**
 
717
         * Return the AboutTitleLabel property value.
 
718
         * @return java.awt.Label
 
719
         */
 
720
        private Label getAboutTitleLabel() {
 
721
                if (iAboutTitleLabel == null) {
 
722
                        try {
 
723
                                iAboutTitleLabel = new Label();
 
724
                                iAboutTitleLabel.setName("AboutTitleLabel");
 
725
                                iAboutTitleLabel.setFont(new Font("Arial", 1, 12));
 
726
                                iAboutTitleLabel.setAlignment(Label.CENTER);
 
727
                                iAboutTitleLabel.setText("Ant VisualAge for Java Tool-Integration");
 
728
                        } catch (Throwable iExc) {
 
729
                                handleException(iExc);
 
730
                        }
 
731
                }
 
732
                return iAboutTitleLabel;
 
733
        }
 
734
        /**
 
735
         * Return the AntMakeMenuBar property value.
 
736
         * @return java.awt.MenuBar
 
737
         */
 
738
        private MenuBar getAntMakeMenuBar() {
 
739
                if (iAntMakeMenuBar == null) {
 
740
                        try {
 
741
                                iAntMakeMenuBar = new MenuBar();
 
742
                                iAntMakeMenuBar.add(getFileMenu());
 
743
                                iAntMakeMenuBar.add(getHelpMenu());
 
744
                        } catch (Throwable iExc) {
 
745
                                handleException(iExc);
 
746
                        }
 
747
                }
 
748
                return iAntMakeMenuBar;
 
749
        }
 
750
        /**
 
751
         * Return the BrowseButton property value.
 
752
         * @return Button
 
753
         */
 
754
        private Button getBrowseButton() {
 
755
                if (iBrowseButton == null) {
 
756
                        try {
 
757
                                iBrowseButton = new Button();
 
758
                                iBrowseButton.setName("BrowseButton");
 
759
                                iBrowseButton.setLabel("...");
 
760
                        } catch (Throwable iExc) {
 
761
                                handleException(iExc);
 
762
                        }
 
763
                }
 
764
                return iBrowseButton;
 
765
        }
 
766
        /**
 
767
         * Return the BuildButton property value.
 
768
         * @return java.awt.Button
 
769
         */
 
770
        private Button getBuildButton() {
 
771
                if (iBuildButton == null) {
 
772
                        try {
 
773
                                iBuildButton = new Button();
 
774
                                iBuildButton.setName("BuildButton");
 
775
                                iBuildButton.setLabel("Build");
 
776
                        } catch (Throwable iExc) {
 
777
                                handleException(iExc);
 
778
                        }
 
779
                }
 
780
                return iBuildButton;
 
781
        }
 
782
        /**
 
783
         * Return the BuildFileLabel property value.
 
784
         * @return java.awt.Label
 
785
         */
 
786
        private Label getBuildFileLabel() {
 
787
                if (iBuildFileLabel == null) {
 
788
                        try {
 
789
                                iBuildFileLabel = new Label();
 
790
                                iBuildFileLabel.setName("BuildFileLabel");
 
791
                                iBuildFileLabel.setText("Ant-Buildfile:");
 
792
                        } catch (Throwable iExc) {
 
793
                                handleException(iExc);
 
794
                        }
 
795
                }
 
796
                return iBuildFileLabel;
 
797
        }
 
798
        /**
 
799
         * Return the BuildFileTextField property value.
 
800
         * @return java.awt.TextField
 
801
         */
 
802
        private TextField getBuildFileTextField() {
 
803
                if (iBuildFileTextField == null) {
 
804
                        try {
 
805
                                iBuildFileTextField = new TextField();
 
806
                                iBuildFileTextField.setName("BuildFileTextField");
 
807
                                iBuildFileTextField.setBackground(SystemColor.textHighlightText);
 
808
                        } catch (Throwable iExc) {
 
809
                                handleException(iExc);
 
810
                        }
 
811
                }
 
812
                return iBuildFileTextField;
 
813
        }
 
814
        /**
 
815
         * Return the BuildInfo property value.
 
816
         * @return org.apache.tools.ant.taskdefs.optional.ide.VAJBuildInfo
 
817
         */
 
818
        private VAJBuildInfo getBuildInfo() {
 
819
                return iBuildInfo;
 
820
        }
 
821
        /**
 
822
         * Return the CloseButton property value.
 
823
         * @return java.awt.Button
 
824
         */
 
825
        private Button getCloseButton() {
 
826
                if (iCloseButton == null) {
 
827
                        try {
 
828
                                iCloseButton = new Button();
 
829
                                iCloseButton.setName("CloseButton");
 
830
                                iCloseButton.setLabel("Close");
 
831
                        } catch (Throwable iExc) {
 
832
                                handleException(iExc);
 
833
                        }
 
834
                }
 
835
                return iCloseButton;
 
836
        }
 
837
        /**
 
838
         * Return the CommandButtonPanel property value.
 
839
         * @return java.awt.Panel
 
840
         */
 
841
        private Panel getCommandButtonPanel() {
 
842
                if (iCommandButtonPanel == null) {
 
843
                        try {
 
844
                                iCommandButtonPanel = new Panel();
 
845
                                iCommandButtonPanel.setName("CommandButtonPanel");
 
846
                                iCommandButtonPanel.setLayout(getCommandButtonPanelFlowLayout());
 
847
                                iCommandButtonPanel.setBackground(SystemColor.control);
 
848
                                iCommandButtonPanel.add(getReloadButton());
 
849
                                getCommandButtonPanel().add(getBuildButton(), getBuildButton().getName());
 
850
                                getCommandButtonPanel().add(getCloseButton(), getCloseButton().getName());
 
851
                        } catch (Throwable iExc) {
 
852
                                handleException(iExc);
 
853
                        }
 
854
                }
 
855
                return iCommandButtonPanel;
 
856
        }
 
857
        /**
 
858
         * Return the CommandButtonPanelFlowLayout property value.
 
859
         * @return java.awt.FlowLayout
 
860
         */
 
861
        private FlowLayout getCommandButtonPanelFlowLayout() {
 
862
                FlowLayout iCommandButtonPanelFlowLayout = null;
 
863
                try {
 
864
                        /* Create part */
 
865
                        iCommandButtonPanelFlowLayout = new FlowLayout();
 
866
                        iCommandButtonPanelFlowLayout.setAlignment(FlowLayout.RIGHT);
 
867
                } catch (Throwable iExc) {
 
868
                        handleException(iExc);
 
869
                };
 
870
                return iCommandButtonPanelFlowLayout;
 
871
        }
 
872
        /**
 
873
         * Return the ContentsPane property value.
 
874
         * @return java.awt.Panel
 
875
         */
 
876
        private Panel getContentsPane() {
 
877
                if (iContentsPane == null) {
 
878
                        try {
 
879
                                iContentsPane = new Panel();
 
880
                                iContentsPane.setName("ContentsPane");
 
881
                                iContentsPane.setLayout(new BorderLayout());
 
882
                                getContentsPane().add(getCommandButtonPanel(), "South");
 
883
                                getContentsPane().add(getOptionenPanel(), "Center");
 
884
                        } catch (Throwable iExc) {
 
885
                                handleException(iExc);
 
886
                        }
 
887
                }
 
888
                return iContentsPane;
 
889
        }
 
890
        /**
 
891
         * Return the FileDialog property value.
 
892
         * @return java.awt.FileDialog
 
893
         */
 
894
        private FileDialog getFileDialog() {
 
895
                if (iFileDialog == null) {
 
896
                        try {
 
897
                                iFileDialog = new FileDialog(this);
 
898
                                iFileDialog.setName("FileDialog");
 
899
                                iFileDialog.setLayout(null);
 
900
                                centerDialog(iFileDialog);
 
901
                        } catch (Throwable iExc) {
 
902
                                handleException(iExc);
 
903
                        }
 
904
                }
 
905
                return iFileDialog;
 
906
        }
 
907
        /**
 
908
         * Return the FileMenu property value.
 
909
         * @return java.awt.Menu
 
910
         */
 
911
        private Menu getFileMenu() {
 
912
                if (iFileMenu == null) {
 
913
                        try {
 
914
                                iFileMenu = new Menu();
 
915
                                iFileMenu.setLabel("File");
 
916
                                iFileMenu.add(getSaveMenuItem());
 
917
                                iFileMenu.add(getMenuSeparator());
 
918
                                iFileMenu.add(getShowLogMenuItem());
 
919
                        } catch (Throwable iExc) {
 
920
                                handleException(iExc);
 
921
                        }
 
922
                }
 
923
                return iFileMenu;
 
924
        }
 
925
        /**
 
926
         * Return the HelpMenu property value.
 
927
         * @return java.awt.Menu
 
928
         */
 
929
        private Menu getHelpMenu() {
 
930
                if (iHelpMenu == null) {
 
931
                        try {
 
932
                                iHelpMenu = new Menu();
 
933
                                iHelpMenu.setLabel("Help");
 
934
                                iHelpMenu.add(getAboutMenuItem());
 
935
                        } catch (Throwable iExc) {
 
936
                                handleException(iExc);
 
937
                        }
 
938
                }
 
939
                return iHelpMenu;
 
940
        }
 
941
        /**
 
942
         * Return the MenuSeparator1 property value.
 
943
         * @return java.awt.MenuItem
 
944
         */
 
945
        private MenuItem getMenuSeparator() {
 
946
                if (iMenuSeparator == null) {
 
947
                        try {
 
948
                                iMenuSeparator = new MenuItem();
 
949
                                iMenuSeparator.setLabel("-");
 
950
                        } catch (Throwable iExc) {
 
951
                                handleException(iExc);
 
952
                        }
 
953
                }
 
954
                return iMenuSeparator;
 
955
        }
 
956
        /**
 
957
         * Return the MessageClearLogButton property value.
 
958
         * @return java.awt.Button
 
959
         */
 
960
        private Button getMessageClearLogButton() {
 
961
                if (iMessageClearLogButton == null) {
 
962
                        try {
 
963
                                iMessageClearLogButton = new Button();
 
964
                                iMessageClearLogButton.setName("MessageClearLogButton");
 
965
                                iMessageClearLogButton.setLabel("Clear Log");
 
966
                        } catch (Throwable iExc) {
 
967
                                handleException(iExc);
 
968
                        }
 
969
                }
 
970
                return iMessageClearLogButton;
 
971
        }
 
972
        /**
 
973
         * Return the MessageCommandPanel property value.
 
974
         * @return java.awt.Panel
 
975
         */
 
976
        private Panel getMessageCommandPanel() {
 
977
                if (iMessageCommandPanel == null) {
 
978
                        try {
 
979
                                iMessageCommandPanel = new Panel();
 
980
                                iMessageCommandPanel.setName("MessageCommandPanel");
 
981
                                iMessageCommandPanel.setLayout(new FlowLayout());
 
982
                                getMessageCommandPanel().add(getMessageClearLogButton(), getMessageClearLogButton().getName());
 
983
                                getMessageCommandPanel().add(getMessageOkButton(), getMessageOkButton().getName());
 
984
                        } catch (Throwable iExc) {
 
985
                                handleException(iExc);
 
986
                        }
 
987
                }
 
988
                return iMessageCommandPanel;
 
989
        }
 
990
        /**
 
991
         * Return the MessageContentPanel property value.
 
992
         * @return java.awt.Panel
 
993
         */
 
994
        private Panel getMessageContentPanel() {
 
995
                if (iMessageContentPanel == null) {
 
996
                        try {
 
997
                                iMessageContentPanel = new Panel();
 
998
                                iMessageContentPanel.setName("MessageContentPanel");
 
999
                                iMessageContentPanel.setLayout(new BorderLayout());
 
1000
                                iMessageContentPanel.setBackground(SystemColor.control);
 
1001
                                getMessageContentPanel().add(getMessageTextArea(), "Center");
 
1002
                                getMessageContentPanel().add(getMessageCommandPanel(), "South");
 
1003
                        } catch (Throwable iExc) {
 
1004
                                handleException(iExc);
 
1005
                        }
 
1006
                }
 
1007
                return iMessageContentPanel;
 
1008
        }
 
1009
        /**
 
1010
         * Return the MessageFrame property value.
 
1011
         * @return java.awt.Frame
 
1012
         */
 
1013
        private Frame getMessageFrame() {
 
1014
                if (iMessageFrame == null) {
 
1015
                        try {
 
1016
                                iMessageFrame = new Frame();
 
1017
                                iMessageFrame.setName("MessageFrame");
 
1018
                                iMessageFrame.setLayout(new BorderLayout());
 
1019
                                iMessageFrame.setBounds(0, 0, 750, 250);
 
1020
                                iMessageFrame.setTitle("Message Log");
 
1021
                                iMessageFrame.add(getMessageContentPanel(), "Center");
 
1022
                                iMessageFrame.setLocation((Toolkit.getDefaultToolkit().getScreenSize().width / 2) - (iMessageFrame.getSize().width / 2), (java.awt.Toolkit.getDefaultToolkit().getScreenSize().height / 2));
 
1023
                        } catch (Throwable iExc) {
 
1024
                                handleException(iExc);
 
1025
                        }
 
1026
                }
 
1027
                return iMessageFrame;
 
1028
        }
 
1029
        /**
 
1030
         * Return the MessageOkButton property value.
 
1031
         * @return java.awt.Button
 
1032
         */
 
1033
        private Button getMessageOkButton() {
 
1034
                if (iMessageOkButton == null) {
 
1035
                        try {
 
1036
                                iMessageOkButton = new Button();
 
1037
                                iMessageOkButton.setName("MessageOkButton");
 
1038
                                iMessageOkButton.setLabel("Close");
 
1039
                        } catch (Throwable iExc) {
 
1040
                                handleException(iExc);
 
1041
                        }
 
1042
                }
 
1043
                return iMessageOkButton;
 
1044
        }
 
1045
        /**
 
1046
         * Return the MessageOutputLevelChoice property value.
 
1047
         * @return java.awt.Choice
 
1048
         */
 
1049
        private Choice getMessageOutputLevelChoice() {
 
1050
                if (iMessageOutputLevelChoice == null) {
 
1051
                        try {
 
1052
                                iMessageOutputLevelChoice = new Choice();
 
1053
                                iMessageOutputLevelChoice.setName("MessageOutputLevelChoice");
 
1054
                                iMessageOutputLevelChoice.add("Error");
 
1055
                                iMessageOutputLevelChoice.add("Warning");
 
1056
                                iMessageOutputLevelChoice.add("Info");
 
1057
                                iMessageOutputLevelChoice.add("Verbose");
 
1058
                                iMessageOutputLevelChoice.add("Debug");
 
1059
                                iMessageOutputLevelChoice.select(2);
 
1060
                        } catch (Throwable iExc) {
 
1061
                                handleException(iExc);
 
1062
                        }
 
1063
                }
 
1064
                return iMessageOutputLevelChoice;
 
1065
        }
 
1066
        /**
 
1067
         * Return the MessageOutputLevelLabel property value.
 
1068
         * @return java.awt.Label
 
1069
         */
 
1070
        private Label getMessageOutputLevelLabel() {
 
1071
                if (iMessageOutputLevelLabel == null) {
 
1072
                        try {
 
1073
                                iMessageOutputLevelLabel = new Label();
 
1074
                                iMessageOutputLevelLabel.setName("MessageOutputLevelLabel");
 
1075
                                iMessageOutputLevelLabel.setText("Message Level:");
 
1076
                        } catch (Throwable iExc) {
 
1077
                                handleException(iExc);
 
1078
                        }
 
1079
                }
 
1080
                return iMessageOutputLevelLabel;
 
1081
        }
 
1082
        /**
 
1083
         * Return the MessageTextArea property value.
 
1084
         * @return java.awt.TextArea
 
1085
         */
 
1086
        private TextArea getMessageTextArea() {
 
1087
                if (iMessageTextArea == null) {
 
1088
                        try {
 
1089
                                iMessageTextArea = new TextArea();
 
1090
                                iMessageTextArea.setName("MessageTextArea");
 
1091
                                iMessageTextArea.setFont(new Font("monospaced", 0, 12));
 
1092
                                iMessageTextArea.setText("");
 
1093
                                iMessageTextArea.setEditable(false);
 
1094
                                iMessageTextArea.setEnabled(true);
 
1095
                        } catch (Throwable iExc) {
 
1096
                                handleException(iExc);
 
1097
                        }
 
1098
                }
 
1099
                return iMessageTextArea;
 
1100
        }
 
1101
        /**
 
1102
         * Return the Panel1 property value.
 
1103
         * @return java.awt.Panel
 
1104
         */
 
1105
        private Panel getOptionenPanel() {
 
1106
                if (iOptionenPanel == null) {
 
1107
                        try {
 
1108
                                iOptionenPanel = new Panel();
 
1109
                                iOptionenPanel.setName("OptionenPanel");
 
1110
                                iOptionenPanel.setLayout(new GridBagLayout());
 
1111
                                iOptionenPanel.setBackground(SystemColor.control);
 
1112
 
 
1113
                                GridBagConstraints constraintsProjectLabel = new GridBagConstraints();
 
1114
                                constraintsProjectLabel.gridx = 0; constraintsProjectLabel.gridy = 0;
 
1115
                                constraintsProjectLabel.anchor = GridBagConstraints.WEST;
 
1116
                                constraintsProjectLabel.insets = new Insets(4, 4, 4, 4);
 
1117
                                getOptionenPanel().add(getProjectLabel(), constraintsProjectLabel);
 
1118
 
 
1119
                                GridBagConstraints constraintsBuildFileLabel = new GridBagConstraints();
 
1120
                                constraintsBuildFileLabel.gridx = 0; constraintsBuildFileLabel.gridy = 1;
 
1121
                                constraintsBuildFileLabel.anchor = GridBagConstraints.WEST;
 
1122
                                constraintsBuildFileLabel.insets = new Insets(4, 4, 4, 4);
 
1123
                                getOptionenPanel().add(getBuildFileLabel(), constraintsBuildFileLabel);
 
1124
 
 
1125
                                GridBagConstraints constraintsTargetLabel = new GridBagConstraints();
 
1126
                                constraintsTargetLabel.gridx = 0; constraintsTargetLabel.gridy = 2;
 
1127
                                constraintsTargetLabel.anchor = GridBagConstraints.NORTHWEST;
 
1128
                                constraintsTargetLabel.insets = new Insets(4, 4, 4, 4);
 
1129
                                getOptionenPanel().add(getTargetLabel(), constraintsTargetLabel);
 
1130
 
 
1131
                                GridBagConstraints constraintsProjectText = new GridBagConstraints();
 
1132
                                constraintsProjectText.gridx = 1; constraintsProjectText.gridy = 0;
 
1133
                                constraintsProjectText.gridwidth = 2;
 
1134
                                constraintsProjectText.fill = GridBagConstraints.HORIZONTAL;
 
1135
                                constraintsProjectText.anchor = GridBagConstraints.WEST;
 
1136
                                constraintsProjectText.insets = new Insets(4, 4, 4, 4);
 
1137
                                getOptionenPanel().add(getProjectText(), constraintsProjectText);
 
1138
 
 
1139
                                GridBagConstraints constraintsBuildFileTextField = new GridBagConstraints();
 
1140
                                constraintsBuildFileTextField.gridx = 1; constraintsBuildFileTextField.gridy = 1;
 
1141
                                constraintsBuildFileTextField.fill = GridBagConstraints.HORIZONTAL;
 
1142
                                constraintsBuildFileTextField.anchor = GridBagConstraints.WEST;
 
1143
                                constraintsBuildFileTextField.weightx = 1.0;
 
1144
                                constraintsBuildFileTextField.insets = new Insets(4, 4, 4, 4);
 
1145
                                getOptionenPanel().add(getBuildFileTextField(), constraintsBuildFileTextField);
 
1146
 
 
1147
                                GridBagConstraints constraintsBrowseButton = new GridBagConstraints();
 
1148
                                constraintsBrowseButton.gridx = 2; constraintsBrowseButton.gridy = 1;
 
1149
                                constraintsBrowseButton.insets = new Insets(4, 4, 4, 4);
 
1150
                                getOptionenPanel().add(getBrowseButton(), constraintsBrowseButton);
 
1151
 
 
1152
                                GridBagConstraints constraintsTargetList = new GridBagConstraints();
 
1153
                                constraintsTargetList.gridx = 1; constraintsTargetList.gridy = 2;
 
1154
                                constraintsTargetList.gridheight = 2;
 
1155
                                constraintsTargetList.fill = GridBagConstraints.BOTH;
 
1156
                                constraintsTargetList.weightx = 1.0;
 
1157
                                constraintsTargetList.weighty = 1.0;
 
1158
                                constraintsTargetList.insets = new Insets(4, 4, 4, 4);
 
1159
                                getOptionenPanel().add(getTargetList(), constraintsTargetList);
 
1160
 
 
1161
                                GridBagConstraints constraintsMessageOutputLevelLabel = new GridBagConstraints();
 
1162
                                constraintsMessageOutputLevelLabel.gridx = 0; constraintsMessageOutputLevelLabel.gridy = 4;
 
1163
                                constraintsMessageOutputLevelLabel.anchor = GridBagConstraints.WEST;
 
1164
                                constraintsMessageOutputLevelLabel.insets = new Insets(4, 4, 4, 4);
 
1165
                                getOptionenPanel().add(getMessageOutputLevelLabel(), constraintsMessageOutputLevelLabel);
 
1166
 
 
1167
                                GridBagConstraints constraintsMessageOutputLevelChoice = new GridBagConstraints();
 
1168
                                constraintsMessageOutputLevelChoice.gridx = 1; constraintsMessageOutputLevelChoice.gridy = 4;
 
1169
                                constraintsMessageOutputLevelChoice.fill = GridBagConstraints.HORIZONTAL;
 
1170
                                constraintsMessageOutputLevelChoice.anchor = GridBagConstraints.WEST;
 
1171
                                constraintsMessageOutputLevelChoice.weightx = 1.0;
 
1172
                                constraintsMessageOutputLevelChoice.insets = new Insets(4, 4, 4, 4);
 
1173
                                getOptionenPanel().add(getMessageOutputLevelChoice(), constraintsMessageOutputLevelChoice);
 
1174
                        } catch (Throwable iExc) {
 
1175
                                handleException(iExc);
 
1176
                        }
 
1177
                }
 
1178
                return iOptionenPanel;
 
1179
        }
 
1180
        /**
 
1181
         * Return the ProjectLabel property value.
 
1182
         * @return java.awt.Label
 
1183
         */
 
1184
        private Label getProjectLabel() {
 
1185
                if (iProjectLabel == null) {
 
1186
                        try {
 
1187
                                iProjectLabel = new Label();
 
1188
                                iProjectLabel.setName("ProjectLabel");
 
1189
                                iProjectLabel.setText("Projectname:");
 
1190
                        } catch (Throwable iExc) {
 
1191
                                handleException(iExc);
 
1192
                        }
 
1193
                }
 
1194
                return iProjectLabel;
 
1195
        }
 
1196
        /**
 
1197
         * Return the ProjectText property value.
 
1198
         * @return java.awt.Label
 
1199
         */
 
1200
        private Label getProjectText() {
 
1201
                if (iProjectText == null) {
 
1202
                        try {
 
1203
                                iProjectText = new Label();
 
1204
                                iProjectText.setName("ProjectText");
 
1205
                                iProjectText.setText(" ");
 
1206
                        } catch (Throwable iExc) {
 
1207
                                handleException(iExc);
 
1208
                        }
 
1209
                }
 
1210
                return iProjectText;
 
1211
        }
 
1212
        /**
 
1213
         * Return the ReloadButton property value.
 
1214
         * @return java.awt.Button
 
1215
         */
 
1216
        private Button getReloadButton() {
 
1217
                if (iReloadButton == null) {
 
1218
                        try {
 
1219
                                iReloadButton = new Button();
 
1220
                                iReloadButton.setName("ReloadButton");
 
1221
                                iReloadButton.setLabel("(Re)Load");
 
1222
                        } catch (Throwable iExc) {
 
1223
                                handleException(iExc);
 
1224
                        }
 
1225
                }
 
1226
                return iReloadButton;
 
1227
        }
 
1228
        /**
 
1229
         * Return the SaveMenuItem property value.
 
1230
         * @return java.awt.MenuItem
 
1231
         */
 
1232
        private MenuItem getSaveMenuItem() {
 
1233
                if (iSaveMenuItem == null) {
 
1234
                        try {
 
1235
                                iSaveMenuItem = new MenuItem();
 
1236
                                iSaveMenuItem.setLabel("Save BuildInfo To Repository");
 
1237
                        } catch (Throwable iExc) {
 
1238
                                handleException(iExc);
 
1239
                        }
 
1240
                }
 
1241
                return iSaveMenuItem;
 
1242
        }
 
1243
        /**
 
1244
         * Return the ShowLogMenuItem property value.
 
1245
         * @return java.awt.MenuItem
 
1246
         */
 
1247
        private MenuItem getShowLogMenuItem() {
 
1248
                if (iShowLogMenuItem == null) {
 
1249
                        try {
 
1250
                                iShowLogMenuItem = new MenuItem();
 
1251
                                iShowLogMenuItem.setLabel("Log");
 
1252
                        } catch (Throwable iExc) {
 
1253
                                handleException(iExc);
 
1254
                        }
 
1255
                }
 
1256
                return iShowLogMenuItem;
 
1257
        }
 
1258
        /**
 
1259
         * Return the TargetLabel property value.
 
1260
         * @return java.awt.Label
 
1261
         */
 
1262
        private Label getTargetLabel() {
 
1263
                if (iTargetLabel == null) {
 
1264
                        try {
 
1265
                                iTargetLabel = new Label();
 
1266
                                iTargetLabel.setName("TargetLabel");
 
1267
                                iTargetLabel.setText("Target:");
 
1268
                                iTargetLabel.setEnabled(true);
 
1269
                        } catch (Throwable iExc) {
 
1270
                                handleException(iExc);
 
1271
                        }
 
1272
                }
 
1273
                return iTargetLabel;
 
1274
        }
 
1275
        /**
 
1276
         * Return the TargetList property value.
 
1277
         * @return java.awt.List
 
1278
         */
 
1279
        private List getTargetList() {
 
1280
                if (iTargetList == null) {
 
1281
                        try {
 
1282
                                iTargetList = new List();
 
1283
                                iTargetList.setName("TargetList");
 
1284
                                iTargetList.setEnabled(true);
 
1285
                        } catch (Throwable iExc) {
 
1286
                                handleException(iExc);
 
1287
                        }
 
1288
                }
 
1289
                return iTargetList;
 
1290
        }
 
1291
        /**
 
1292
         * Called whenever the part throws an exception.
 
1293
         * @param exception Throwable
 
1294
         */
 
1295
        private void handleException(Throwable exception) {
 
1296
                // Write exceptions to the log-window
 
1297
                getMessageTextArea().append(lineSeparator + lineSeparator + exception.getMessage());
 
1298
                getMessageFrame().show();
 
1299
                
 
1300
        }
 
1301
        /**
 
1302
         * Initializes connections
 
1303
         * @exception Exception The exception description.
 
1304
         */
 
1305
        private void initConnections() throws Exception {
 
1306
                this.addWindowListener(iEventHandler);
 
1307
                getBrowseButton().addActionListener(iEventHandler);
 
1308
                getCloseButton().addActionListener(iEventHandler);
 
1309
                getBuildButton().addActionListener(iEventHandler);
 
1310
                getSaveMenuItem().addActionListener(iEventHandler);
 
1311
                getAboutOkButton().addActionListener(iEventHandler);
 
1312
                getAboutMenuItem().addActionListener(iEventHandler);
 
1313
                getMessageOkButton().addActionListener(iEventHandler);
 
1314
                getMessageClearLogButton().addActionListener(iEventHandler);
 
1315
                getMessageOkButton().addActionListener(iEventHandler);
 
1316
                getShowLogMenuItem().addActionListener(iEventHandler);
 
1317
                getAboutDialog().addWindowListener(iEventHandler);
 
1318
                getMessageFrame().addWindowListener(iEventHandler);
 
1319
                getReloadButton().addActionListener(iEventHandler);
 
1320
                getTargetList().addItemListener(iEventHandler);
 
1321
                getMessageOutputLevelChoice().addItemListener(iEventHandler);
 
1322
                getBuildFileTextField().addTextListener(iEventHandler);
 
1323
                connectProjectNameToLabel();
 
1324
                connectBuildFileNameToTextField();
 
1325
        }
 
1326
        /**
 
1327
         * Initialize the class.
 
1328
         */
 
1329
        private void initialize() {
 
1330
                try {
 
1331
                        setName("AntMake");
 
1332
                        setMenuBar(getAntMakeMenuBar());
 
1333
                        setLayout(new java.awt.BorderLayout());
 
1334
                        setSize(389, 222);
 
1335
                        setTitle("Ant VisualAge for Java Tool-Integration");
 
1336
                        add(getContentsPane(), "Center");
 
1337
                        initConnections();
 
1338
                } catch (Throwable iExc) {
 
1339
                        handleException(iExc);
 
1340
                }
 
1341
                setLocation((Toolkit.getDefaultToolkit().getScreenSize().width / 2) - (getSize().width / 2), (java.awt.Toolkit.getDefaultToolkit().getScreenSize().height / 2) - (getSize().height));
 
1342
                if ((getTargetList().getItemCount() == 0) || (getTargetList().getSelectedIndex() < 0)) {
 
1343
                        getBuildButton().setEnabled(false);
 
1344
                }
 
1345
        }
 
1346
        /**
 
1347
         * Saves the build-informations to repository
 
1348
         */
 
1349
        private void saveBuildInfo() {
 
1350
                try {
 
1351
                        VAJAntTool.saveBuildData(getBuildInfo());
 
1352
                }
 
1353
                catch (Throwable exc) {
 
1354
                        // This Exception occurs when you try to write into a versioned project
 
1355
                        handleException( exc );
 
1356
                }
 
1357
                return;
 
1358
        }
 
1359
        /**
 
1360
         * Set the BuildInfo to a new value.
 
1361
         * @param newValue org.apache.tools.ant.taskdefs.optional.vaj.VAJBuildInfo
 
1362
         */
 
1363
        private void setBuildInfo(VAJBuildInfo newValue) {
 
1364
                if (iBuildInfo != newValue) {
 
1365
                        try {
 
1366
                                /* Stop listening for events from the current object */
 
1367
                                if (iBuildInfo != null) {
 
1368
                                        iBuildInfo.removePropertyChangeListener(iEventHandler);
 
1369
                                }
 
1370
                                iBuildInfo = newValue;
 
1371
 
 
1372
                                /* Listen for events from the new object */
 
1373
                                if (iBuildInfo != null) {
 
1374
                                        iBuildInfo.addPropertyChangeListener(iEventHandler);
 
1375
                                }
 
1376
                                connectProjectNameToLabel();
 
1377
                                connectBuildFileNameToTextField();
 
1378
 
 
1379
                                // Select the log-level given by BuildInfo
 
1380
                                getMessageOutputLevelChoice().select(iBuildInfo.getOutputMessageLevel());
 
1381
                                fillList();
 
1382
                                // BuildInfo can conly be saved to a VAJ project if tool API is called via the projects context-menu
 
1383
                                if ((iBuildInfo.getVAJProjectName() == null) || (iBuildInfo.getVAJProjectName().equals(""))) {
 
1384
                                        getSaveMenuItem().setEnabled(false);
 
1385
                                }
 
1386
                        } catch (Throwable iExc) {
 
1387
                                handleException(iExc);
 
1388
                        }
 
1389
                }
 
1390
        }
 
1391
}