01: package org.apache.ojb.tools.mapping.reversedb2.actions;
02:
03: import org.apache.ojb.broker.metadata.DescriptorRepository;
04: import org.apache.ojb.tools.mapping.reversedb2.gui.JIFrmOJBRepository;
05:
06: /* Copyright 2002-2005 The Apache Software Foundation
07: *
08: * Licensed under the Apache License, Version 2.0 (the "License");
09: * you may not use this file except in compliance with the License.
10: * You may obtain a copy of the License at
11: *
12: * http://www.apache.org/licenses/LICENSE-2.0
13: *
14: * Unless required by applicable law or agreed to in writing, software
15: * distributed under the License is distributed on an "AS IS" BASIS,
16: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: * See the License for the specific language governing permissions and
18: * limitations under the License.
19: */
20:
21: /**
22: * Opens a new JIFrmOBJRepository in the specified frame.
23: * @author Administrator
24: */
25: public class ActionNewOJBRepository extends javax.swing.AbstractAction {
26: private javax.swing.JFrame containingFrame;
27:
28: /** Creates a new instance of ActionOpenOJBRepository */
29: public ActionNewOJBRepository(javax.swing.JFrame pcontainingFrame) {
30: this .containingFrame = pcontainingFrame;
31: putValue(NAME, "New OJB Repository");
32: putValue(MNEMONIC_KEY,
33: new Integer(java.awt.event.KeyEvent.VK_N));
34: }
35:
36: public void actionPerformed(java.awt.event.ActionEvent actionEvent) {
37: javax.swing.SwingUtilities.invokeLater(new Runnable() {
38: public void run() {
39: try {
40: // RepositoryPersistor persistor = new RepositoryPersistor ();
41: DescriptorRepository repository = new DescriptorRepository();
42: JIFrmOJBRepository frm = new JIFrmOJBRepository(
43: repository);
44: containingFrame.getContentPane().add(frm);
45: frm.setVisible(true);
46: } catch (Throwable t) {
47: t.printStackTrace();
48: }
49: }
50: });
51: }
52: }
|