01: /*
02: $Header: /cvsroot/xorm/xorm/tools/src/org/xorm/tools/editor/CreateAction.java,v 1.3 2002/04/26 22:01:05 wbiggs Exp $
03:
04: This file is part of XORM.
05:
06: XORM is free software; you can redistribute it and/or modify
07: it under the terms of the GNU General Public License as published by
08: the Free Software Foundation; either version 2 of the License, or
09: (at your option) any later version.
10:
11: XORM is distributed in the hope that it will be useful,
12: but WITHOUT ANY WARRANTY; without even the implied warranty of
13: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14: GNU General Public License for more details.
15:
16: You should have received a copy of the GNU General Public License
17: along with Foobar; if not, write to the Free Software
18: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19: */
20: package org.xorm.tools.editor;
21:
22: import org.xorm.XORM;
23: import javax.jdo.PersistenceManager;
24:
25: public class CreateAction extends Action {
26: public CreateAction(PersistenceManager mgr) {
27: super (mgr);
28: }
29:
30: public Object go() {
31: System.out.println("CREATE NEW OBJECT");
32: Class clazz = null;
33: while (clazz == null) {
34: System.out.print("Enter Interface Class: ");
35: clazz = readClass();
36: }
37:
38: Object obj = XORM.newInstance(mgr, clazz);
39: mgr.makePersistent(obj);
40: EditAction action = new EditAction(mgr, obj);
41: action.go();
42: return obj;
43: }
44: }
|