KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > jawe > actions > New


1 /*
2  * Authors:
3  * Stefanovic Nenad chupo@iis.ns.ac.yu
4  * Bojanic Sasa sasaboy@neobee.net
5  * Puskas Vladimir vpuskas@eunet.yu
6  * Pilipovic Goran zboniek@uns.ac.yu
7  *
8  */

9
10 package org.enhydra.jawe.actions;
11
12 import org.enhydra.jawe.*;
13
14 import java.awt.event.ActionEvent JavaDoc;
15
16
17 /**
18  * Class that realizes <B>new</B> action.
19  */

20 public class New extends ActionBase {
21
22    public New (PackageEditor editor) {
23       super(editor);
24    }
25
26    public void actionPerformed(ActionEvent JavaDoc e) {
27       if (JaWE.getInstance().close()) {
28          openNewPackage();
29          PackageEditor pe=(PackageEditor)editor;
30          if (!pe.isInitialized()) {
31             pe.enterPackageID();
32          }
33          pe.update();
34       }
35    }
36
37    public static void openNewPackage () {
38       PackageEditor pe=JaWE.getInstance().getPackageEditor();
39       if (JaWE.getInstance().getRealXMLPackage()!=null) {
40          pe.displayPackage(JaWE.getInstance().getRealXMLPackage());
41       }
42       org.enhydra.jawe.xml.elements.Package pkg=
43             JaWE.getInstance().openDocument(null,true,false);
44       pe.setNewPackage(pkg,true);
45    }
46
47 }
48
Popular Tags