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