KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > genimen > djeneric > tools > modeler > ModelEditor


1 /*
2  * Copyright (c) 2001-2005 by Genimen BV (www.genimen.com) All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, is permitted provided that the following conditions are met: -
6  * Redistributions of source code must retain the above copyright notice, this
7  * list of conditions and the following disclaimer. - Redistributions in binary
8  * form must reproduce the above copyright notice, this list of conditions and
9  * the following disclaimer in the documentation and/or other materials
10  * provided with the distribution. - All advertising materials mentioning
11  * features or use of this software must display the following acknowledgment:
12  * "This product includes Djeneric." - Products derived from this software may
13  * not be called "Djeneric" nor may "Djeneric" appear in their names without
14  * prior written permission of Genimen BV. - Redistributions of any form
15  * whatsoever must retain the following acknowledgment: "This product includes
16  * Djeneric."
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
19  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED. IN NO EVENT SHALL GENIMEN BV, DJENERIC.ORG, OR CONTRIBUTORS
22  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28  * POSSIBILITY OF SUCH DAMAGE.
29  */

30
31 package com.genimen.djeneric.tools.modeler;
32
33 import java.awt.AWTEvent JavaDoc;
34 import java.awt.BorderLayout JavaDoc;
35 import java.awt.Color JavaDoc;
36 import java.awt.Component JavaDoc;
37 import java.awt.Dimension JavaDoc;
38 import java.awt.Font JavaDoc;
39 import java.awt.Image JavaDoc;
40 import java.awt.Toolkit JavaDoc;
41 import java.awt.event.ActionEvent JavaDoc;
42 import java.awt.event.AdjustmentEvent JavaDoc;
43 import java.awt.event.InputEvent JavaDoc;
44 import java.awt.event.KeyEvent JavaDoc;
45 import java.awt.event.KeyListener JavaDoc;
46 import java.awt.event.MouseEvent JavaDoc;
47 import java.awt.event.WindowEvent JavaDoc;
48 import java.awt.print.PageFormat JavaDoc;
49 import java.awt.print.PrinterJob JavaDoc;
50 import java.io.BufferedReader JavaDoc;
51 import java.io.BufferedWriter JavaDoc;
52 import java.io.ByteArrayOutputStream JavaDoc;
53 import java.io.File JavaDoc;
54 import java.io.FileOutputStream JavaDoc;
55 import java.io.FileReader JavaDoc;
56 import java.io.FileWriter JavaDoc;
57 import java.io.IOException JavaDoc;
58 import java.net.URL JavaDoc;
59 import java.util.ArrayList JavaDoc;
60
61 import javax.imageio.ImageIO JavaDoc;
62 import javax.swing.ButtonGroup JavaDoc;
63 import javax.swing.ImageIcon JavaDoc;
64 import javax.swing.JButton JavaDoc;
65 import javax.swing.JFileChooser JavaDoc;
66 import javax.swing.JLabel JavaDoc;
67 import javax.swing.JMenu JavaDoc;
68 import javax.swing.JMenuBar JavaDoc;
69 import javax.swing.JMenuItem JavaDoc;
70 import javax.swing.JOptionPane JavaDoc;
71 import javax.swing.JPanel JavaDoc;
72 import javax.swing.JRadioButtonMenuItem JavaDoc;
73 import javax.swing.JScrollBar JavaDoc;
74 import javax.swing.JScrollPane JavaDoc;
75 import javax.swing.JSlider JavaDoc;
76 import javax.swing.JTabbedPane JavaDoc;
77 import javax.swing.JTextArea JavaDoc;
78 import javax.swing.RepaintManager JavaDoc;
79 import javax.swing.event.ChangeEvent JavaDoc;
80
81 import com.genimen.djeneric.language.Messages;
82 import com.genimen.djeneric.repository.DjDomain;
83 import com.genimen.djeneric.repository.DjExtent;
84 import com.genimen.djeneric.repository.DjModelView;
85 import com.genimen.djeneric.repository.DjPackage;
86 import com.genimen.djeneric.repository.DjPersistenceManager;
87 import com.genimen.djeneric.repository.DjPersistenceManagerFactory;
88 import com.genimen.djeneric.repository.DjSession;
89 import com.genimen.djeneric.repository.exceptions.CatalogException;
90 import com.genimen.djeneric.repository.exceptions.DjenericException;
91 import com.genimen.djeneric.structure.EditorDefinition;
92 import com.genimen.djeneric.structure.ResourceDefinition;
93 import com.genimen.djeneric.structure.ScriptDefinition;
94 import com.genimen.djeneric.tools.common.AboutDialog;
95 import com.genimen.djeneric.tools.common.DjenericTool;
96 import com.genimen.djeneric.tools.common.ExportSelectionDialog;
97 import com.genimen.djeneric.tools.io.DjenericDocumentHandler;
98 import com.genimen.djeneric.tools.modeler.diagrammer.ColorChooserDialog;
99 import com.genimen.djeneric.tools.modeler.diagrammer.ExtentViewer;
100 import com.genimen.djeneric.tools.modeler.diagrammer.PaintPanel;
101 import com.genimen.djeneric.tools.modeler.dialogs.CreateRelationDialog;
102 import com.genimen.djeneric.tools.modeler.dialogs.ExtentSelectorDialog;
103 import com.genimen.djeneric.tools.modeler.dialogs.ImportModeDialog;
104 import com.genimen.djeneric.tools.modeler.dialogs.MergeViewDialog;
105 import com.genimen.djeneric.tools.modeler.dialogs.ModelVersionDialog;
106 import com.genimen.djeneric.tools.modeler.dialogs.OpenDialog;
107 import com.genimen.djeneric.tools.modeler.dialogs.PackageEditorDialog;
108 import com.genimen.djeneric.tools.modeler.dialogs.RoleEditorDialog;
109 import com.genimen.djeneric.tools.modeler.dialogs.SaveAsDialog;
110 import com.genimen.djeneric.tools.modeler.domaineditor.DomainEditor;
111 import com.genimen.djeneric.tools.modeler.extenteditor.ExtentEditor;
112 import com.genimen.djeneric.tools.modeler.io.ModelDocumentHandler;
113 import com.genimen.djeneric.tools.modeler.schemagenerator.SchemaGeneratorDlg;
114 import com.genimen.djeneric.tools.modeler.userperspective.ViewEditor;
115 import com.genimen.djeneric.tools.modeler.util.ModelChecker;
116 import com.genimen.djeneric.tools.modeler.util.ModelDescriber;
117 import com.genimen.djeneric.ui.DjCloseable;
118 import com.genimen.djeneric.ui.DjStatusListener;
119 import com.genimen.djeneric.ui.DjTabbedPane;
120 import com.genimen.djeneric.ui.DjVerticalFlowLayout;
121 import com.genimen.djeneric.ui.Util;
122 import com.genimen.djeneric.util.DjEnvironment;
123 import com.genimen.djeneric.util.DjFileFilter;
124 import com.genimen.djeneric.util.DjLogPrintStream;
125 import com.genimen.djeneric.util.DjLogger;
126 import com.genimen.djeneric.util.DjProgressDisplayer;
127 import com.genimen.djeneric.util.DjVersion;
128
129 class CloseableScrollPane extends JScrollPane JavaDoc implements DjCloseable
130 {
131   private static final long serialVersionUID = 1L;
132   JTabbedPane JavaDoc _owner;
133
134   public CloseableScrollPane(JTabbedPane JavaDoc owner)
135   {
136     _owner = owner;
137   }
138
139   public boolean canClose()
140   {
141     return true;
142   }
143
144   public boolean close()
145   {
146     _owner.remove(this);
147     return true;
148   }
149 }
150 public class ModelEditor extends DjenericTool implements DjStatusListener, DjProgressDisplayer, KeyListener JavaDoc
151 {
152   private static final long serialVersionUID = 1L;
153   private final String JavaDoc PROPERTIES_FILE_NAME = DjEnvironment.getAbsoluteFileName("modeleditor.properties");
154   private final static String JavaDoc LOG_FILE_NAME = DjEnvironment.getAbsoluteFileName("modeleditor.log");
155   private final String JavaDoc NOT_MODELER_MSG = Messages.getString("ModelEditor.ModelReadOnlyNoPrivs");
156   public static final String JavaDoc DUMP_EXTENSION = "dmp";
157   public static final String JavaDoc MODEL_EXTENSION = "djmm";
158   public static final String JavaDoc VIEW_EXTENSION = "djvw";
159   public Font JavaDoc _largerFont = new Font JavaDoc("Arial", Font.BOLD, 14);
160   public Font JavaDoc _font = new Font JavaDoc("Arial", Font.BOLD, 11);
161   // do not change this size (plus in box)
162
public Font JavaDoc _smallfont = new Font JavaDoc("Arial", Font.BOLD, 11);
163   public Color JavaDoc _relationColor = new Color JavaDoc(0x00, 0x00, 0x00);
164   public Color JavaDoc _selectionColor = Color.red;
165   public final static String JavaDoc OK_MSG = Messages.getString("global.Ok");
166   final static int A4 = 150;
167   final static int A3 = (new Double JavaDoc(A4 / Math.sqrt(2))).intValue();
168   final static int A5 = (new Double JavaDoc(A4 * Math.sqrt(2) * Math.sqrt(2))).intValue();
169   public final static String JavaDoc NEW_EXTENT_PREFIX = Messages.getString("ModelEditor.NewExtent1");
170   JPanel JavaDoc contentPane;
171   BorderLayout JavaDoc borderLayout1 = new BorderLayout JavaDoc();
172   boolean _inRelationAddMode = false;
173   ExtentViewer _relationMaster = null;
174   ExtentViewer _lastPressedExtentViewer = null;
175   int _lastPressedX = -1;
176   int _lastPressedY = -1;
177   int _lastCorner = -1;
178   DjPersistenceManager _mgr;
179   DjTabbedPane _tabs = new DjTabbedPane();
180   JPanel JavaDoc _diagramPanel = new JPanel JavaDoc();
181   BorderLayout JavaDoc borderLayout2 = new BorderLayout JavaDoc();
182   PaintPanel _paintPanel = new PaintPanel();
183   private JLabel JavaDoc _lblStatus = new JLabel JavaDoc();
184   ArrayList JavaDoc _allEditorsOpen = new ArrayList JavaDoc();
185   int _newCounter = 1;
186   DjModelView _theView = null;
187   int _selectionBoxX1 = -1;
188   int _selectionBoxY1 = -1;
189   int _selectionBoxX2 = -1;
190   int _selectionBoxY2 = -1;
191   int _newIncrement = 0;
192   ViewEditor _viewEditor = new ViewEditor(this);
193   JMenuBar JavaDoc _mainMenu = new JMenuBar JavaDoc();
194   JMenu JavaDoc _mnuFile = new JMenu JavaDoc();
195   JMenuItem JavaDoc _mnuExit = new JMenuItem JavaDoc();
196   JMenuItem JavaDoc _mnuSave = new JMenuItem JavaDoc();
197   JMenuItem JavaDoc _mnuExport2Image = new JMenuItem JavaDoc();
198   JMenuItem JavaDoc _mnuSaveAs = new JMenuItem JavaDoc();
199   JMenuItem JavaDoc _mnuDeleteView = new JMenuItem JavaDoc();
200   JMenu JavaDoc _mnuTools = new JMenu JavaDoc();
201   JMenu JavaDoc _mnuExport = new JMenu JavaDoc();
202   JMenuItem JavaDoc _mnuExportModel = new JMenuItem JavaDoc();
203   JMenuItem JavaDoc _mnuExportView = new JMenuItem JavaDoc();
204   JMenu JavaDoc _mnuImport = new JMenu JavaDoc();
205   JMenuItem JavaDoc _mnuImportView = new JMenuItem JavaDoc();
206   JMenuItem JavaDoc _mnuImportModel = new JMenuItem JavaDoc();
207   JMenuItem JavaDoc _mnuOpenView = new JMenuItem JavaDoc();
208   JMenuItem JavaDoc _mnuNewView = new JMenuItem JavaDoc();
209   JMenuItem JavaDoc _mnuSaveModelOnly = new JMenuItem JavaDoc();
210   JPanel JavaDoc jPanel1 = new JPanel JavaDoc();
211   BorderLayout JavaDoc borderLayout3 = new BorderLayout JavaDoc();
212   JButton JavaDoc _butAdd = new JButton JavaDoc();
213   JButton JavaDoc _butEdit = new JButton JavaDoc();
214   JButton JavaDoc _butAddRelation = new JButton JavaDoc();
215   JButton JavaDoc _butDelete = new JButton JavaDoc();
216   JButton JavaDoc _butPrint = new JButton JavaDoc();
217   JPanel JavaDoc _buttonPanel = new JPanel JavaDoc();
218   JLabel JavaDoc _spaceHolder = new JLabel JavaDoc();
219   JButton JavaDoc _butColor = new JButton JavaDoc();
220   JButton JavaDoc _butViewEditor = new JButton JavaDoc();
221   DjVerticalFlowLayout verticalFlowLayout1 = new DjVerticalFlowLayout();
222   JButton JavaDoc _butDomains = new JButton JavaDoc();
223   JSlider JavaDoc _zoomSlider = new JSlider JavaDoc();
224   JButton JavaDoc _butHideExtent = new JButton JavaDoc();
225   JButton JavaDoc _butCreate = new JButton JavaDoc();
226   JLabel JavaDoc _spaceHolder1 = new JLabel JavaDoc();
227   JButton JavaDoc _butSave = new JButton JavaDoc();
228   JPanel JavaDoc jPanel2 = new JPanel JavaDoc();
229   JLabel JavaDoc _imgLocked = new JLabel JavaDoc();
230   JMenu JavaDoc _mnuShow = new JMenu JavaDoc();
231   JRadioButtonMenuItem JavaDoc _mnuShowAlias = new JRadioButtonMenuItem JavaDoc();
232   JRadioButtonMenuItem JavaDoc _mnuShowQualified = new JRadioButtonMenuItem JavaDoc();
233   JRadioButtonMenuItem JavaDoc _mnuShowExtent = new JRadioButtonMenuItem JavaDoc();
234   JRadioButtonMenuItem JavaDoc _mnuShowClass = new JRadioButtonMenuItem JavaDoc();
235   JMenuItem JavaDoc _mnuPrint = new JMenuItem JavaDoc();
236   JMenu JavaDoc _mnuHelp = new JMenu JavaDoc();
237   JMenuItem JavaDoc _mnuAbout = new JMenuItem JavaDoc();
238   JMenuItem JavaDoc _mnuScript = new JMenuItem JavaDoc();
239   JMenuItem JavaDoc _mnuQualityCheck = new JMenuItem JavaDoc();
240   JMenuItem JavaDoc _mnuModelDescr = new JMenuItem JavaDoc();
241   JMenu JavaDoc _mnuTabs = new JMenu JavaDoc();
242   JMenuItem JavaDoc _mnuRemoveTab = new JMenuItem JavaDoc();
243   JMenuItem JavaDoc _mnuNextTab = new JMenuItem JavaDoc();
244   JMenuItem JavaDoc _mnuPrevTab = new JMenuItem JavaDoc();
245   JMenuItem JavaDoc _mnuValidateRepository = new JMenuItem JavaDoc();
246   JMenu JavaDoc _mnuEdit = new JMenu JavaDoc();
247   JMenuItem JavaDoc _mnuNewExtent = new JMenuItem JavaDoc();
248   JMenuItem JavaDoc _mnuEditExtent = new JMenuItem JavaDoc();
249   JMenuItem JavaDoc _mnuDeleteExtent = new JMenuItem JavaDoc();
250   JMenuItem JavaDoc _mnuNewRelation = new JMenuItem JavaDoc();
251   JMenuItem JavaDoc _mnuAddExtentFromModel = new JMenuItem JavaDoc();
252   JMenuItem JavaDoc _mnuDomains = new JMenuItem JavaDoc();
253   JMenuItem JavaDoc _mnuPackages = new JMenuItem JavaDoc();
254   JMenuItem JavaDoc _mnuDefineEditors = new JMenuItem JavaDoc();
255   JMenuItem JavaDoc _mnuModelHistory = new JMenuItem JavaDoc();
256   JMenuItem JavaDoc _mnuKeyboard = new JMenuItem JavaDoc();
257   JMenuItem JavaDoc _mnuSelectAll = new JMenuItem JavaDoc();
258   JMenuItem JavaDoc _mnuHideExtent = new JMenuItem JavaDoc();
259   String JavaDoc _lastOpenedViewName = "";
260   JMenuItem JavaDoc mnuMergeView = new JMenuItem JavaDoc();
261   JPanel JavaDoc jPanel3 = new JPanel JavaDoc();
262   BorderLayout JavaDoc borderLayout4 = new BorderLayout JavaDoc();
263   JScrollBar JavaDoc _xscroller = new JScrollBar JavaDoc();
264   JScrollBar JavaDoc _yscroller = new JScrollBar JavaDoc();
265   JMenuItem JavaDoc _mnuReloadModel = new JMenuItem JavaDoc();
266   String JavaDoc _originalViewDefinition = "";
267
268   /**
269    * Construct the frame
270    *
271    * @param repositories
272    * Description of the Parameter
273    */

274   public ModelEditor(String JavaDoc repositories)
275   {
276     enableEvents(AWTEvent.WINDOW_EVENT_MASK);
277     setIconImage(getImage("modeler.gif"));
278     try
279     {
280       setStatusLabel(_lblStatus);
281       DjPersistenceManagerFactory fact = new DjPersistenceManagerFactory(this, repositories);
282       _mgr = fact.createInstance();
283       if (!_mgr.getCurrentUser().isAdministrator())
284       {
285         throw new Exception JavaDoc(Messages.getString("ModelEditor.YouNeedAdminPrivs"));
286       }
287       if (_mgr.getSchemaLoadLog().length() > 0)
288       {
289         JOptionPane.showMessageDialog(this, _mgr.getSchemaLoadLog(), Messages.getString("ModelEditor.SeriousWarnings"),
290                                       JOptionPane.ERROR_MESSAGE);
291       }
292       _theView = _mgr.createModelView();
293       _paintPanel.setManager(_mgr);
294       jbInit();
295       _butSave.setIcon(getImageIcon("save.gif"));
296       _butAdd.setIcon(getImageIcon("add.gif"));
297       _butCreate.setIcon(getImageIcon("new.gif"));
298       _butDelete.setIcon(getImageIcon("delete.gif"));
299       _butHideExtent.setIcon(getImageIcon("remove.gif"));
300       _butEdit.setIcon(getImageIcon("edit.gif"));
301       _butColor.setIcon(getImageIcon("colors.gif"));
302       _butPrint.setIcon(getImageIcon("print.gif"));
303       _butDomains.setIcon(getImageIcon("domain.gif"));
304       _butAddRelation.setIcon(getImageIcon("relation.gif"));
305       _butViewEditor.setIcon(getImageIcon("modelview.gif"));
306       _imgLocked.setIcon(getImageIcon("locked.gif"));
307       _imgLocked.setVisible(false);
308       loadProps(PROPERTIES_FILE_NAME);
309
310       _paintPanel.setViewMode(Integer.parseInt(getProperty("diagrammer.show", String.valueOf(PaintPanel.SHOW_CLASS))));
311
312       switch (_paintPanel.getViewMode())
313       {
314         case PaintPanel.SHOW_ALIAS :
315           _mnuShowAlias.setSelected(true);
316           break;
317         case PaintPanel.SHOW_CLASS :
318           _mnuShowClass.setSelected(true);
319           break;
320         case PaintPanel.SHOW_EXTENT :
321           _mnuShowExtent.setSelected(true);
322           break;
323         case PaintPanel.SHOW_QUALIFIED :
324           _mnuShowQualified.setSelected(true);
325           break;
326         default :
327           break;
328       }
329
330       int width = Integer.parseInt(getProperty("window.width", "400"));
331       int height = Integer.parseInt(getProperty("window.height", "400"));
332       setSize(new Dimension JavaDoc(width, height));
333       checkBordersAndSizes();
334       addKeyListener(this);
335       _butAddRelation.addKeyListener(this);
336       _diagramPanel.addKeyListener(this);
337       updateTitle();
338       clear();
339       if (!_mgr.getCurrentUser().isModeler())
340       {
341         setStatusMessage(NOT_MODELER_MSG);
342       }
343       _originalViewDefinition = getViewDefinition();
344     }
345     catch (Exception JavaDoc e)
346     {
347       handleException(e);
348       System.exit(-1);
349     }
350   }
351
352   public void clear()
353   {
354     _viewEditor.clear();
355   }
356
357   private void updateTitle()
358   {
359     String JavaDoc title = Messages.getString("ModelEditor.DjenericModeler", DjVersion.getVersion(), _theView.getCode());
360     try
361     {
362       title += " - " + _mgr.getConnectionTitle();
363     }
364     catch (Exception JavaDoc x)
365     {
366       DjLogger.log(x);
367     }
368     setTitle(title);
369   }
370
371   /**
372    * Component initialization
373    *
374    * @exception Exception
375    * Description of the Exception
376    */

377   private void jbInit() throws Exception JavaDoc
378   {
379     contentPane = (JPanel JavaDoc) this.getContentPane();
380     contentPane.setLayout(borderLayout1);
381     this.setSize(new Dimension JavaDoc(549, 584));
382     _diagramPanel.setLayout(borderLayout2);
383     _paintPanel.setPreferredSize(new Dimension JavaDoc(100, 100));
384     _paintPanel.addMouseMotionListener(new java.awt.event.MouseMotionAdapter JavaDoc()
385     {
386       public void mouseDragged(MouseEvent JavaDoc e)
387       {
388         _paintPanel_mouseDragged(e);
389       }
390
391       public void mouseMoved(MouseEvent JavaDoc e)
392       {
393         _paintPanel_mouseMoved(e);
394       }
395     });
396     _paintPanel.addMouseListener(new java.awt.event.MouseAdapter JavaDoc()
397     {
398       public void mousePressed(MouseEvent JavaDoc e)
399       {
400         _paintPanel_mousePressed(e);
401       }
402
403       public void mouseReleased(MouseEvent JavaDoc e)
404       {
405         _paintPanel_mouseReleased(e);
406       }
407
408       public void mouseClicked(MouseEvent JavaDoc e)
409       {
410         _paintPanel_mouseClicked(e);
411       }
412     });
413     setStatusMessage(OK_MSG);
414     _mnuFile.setMnemonic('F');
415     _mnuFile.setText(Messages.getString("global.File"));
416     _mnuExit.setMnemonic('X');
417     _mnuExit.setText(Messages.getString("global.Exit"));
418     _mnuExit.addActionListener(new java.awt.event.ActionListener JavaDoc()
419     {
420       public void actionPerformed(ActionEvent JavaDoc e)
421       {
422         mnuExit(e);
423       }
424     });
425     _mnuSave.setToolTipText(Messages.getString("ModelEditor.SavesModelAndDiag"));
426     _mnuSave.setMnemonic('S');
427     _mnuSave.setText(Messages.getString("ModelEditor.SaveAll"));
428     _mnuSave.setAccelerator(javax.swing.KeyStroke.getKeyStroke(83, java.awt.event.KeyEvent.CTRL_MASK, false));
429     _mnuSave.addActionListener(new java.awt.event.ActionListener JavaDoc()
430     {
431       public void actionPerformed(ActionEvent JavaDoc e)
432       {
433         mnuSave(e);
434       }
435     });
436     _mnuExport2Image.setToolTipText(Messages.getString("ModelEditor.ExportDiagram"));
437     _mnuExport2Image.setMnemonic('J');
438     _mnuExport2Image.setText(Messages.getString("ModelEditor.ExportDiagram"));
439     _mnuExport2Image.addActionListener(new java.awt.event.ActionListener JavaDoc()
440     {
441       public void actionPerformed(ActionEvent JavaDoc e)
442       {
443         mnuExportPng(e);
444       }
445     });
446     _mnuSaveAs.setMnemonic('A');
447     _mnuSaveAs.setText(Messages.getString("ModelEditor.SaveViewAs"));
448     _mnuSaveAs.addActionListener(new java.awt.event.ActionListener JavaDoc()
449     {
450       public void actionPerformed(ActionEvent JavaDoc e)
451       {
452         mnuSaveAs(e);
453       }
454     });
455     _mnuDeleteView.setMnemonic('D');
456     _mnuDeleteView.setText(Messages.getString("ModelEditor.DeleteView"));
457     _mnuDeleteView.addActionListener(new java.awt.event.ActionListener JavaDoc()
458     {
459       public void actionPerformed(ActionEvent JavaDoc e)
460       {
461         mnuDeleteView(e);
462       }
463     });
464     _mnuTools.setMnemonic('T');
465     _mnuTools.setText(Messages.getString("global.Tools"));
466     _mnuExport.setMnemonic('E');
467     _mnuExport.setText(Messages.getString("ModelEditor.Export"));
468     _mnuExportModel.setMnemonic('M');
469     _mnuExportModel.setText(Messages.getString("ModelEditor.Model"));
470     _mnuExportModel.addActionListener(new java.awt.event.ActionListener JavaDoc()
471     {
472       public void actionPerformed(ActionEvent JavaDoc e)
473       {
474         mnuExportModel(e);
475       }
476     });
477     _mnuExportView.setMnemonic('V');
478     _mnuExportView.setText(Messages.getString("ModelEditor.View"));
479     _mnuExportView.addActionListener(new java.awt.event.ActionListener JavaDoc()
480     {
481       public void actionPerformed(ActionEvent JavaDoc e)
482       {
483         mnuExportView(e);
484       }
485     });
486     _mnuImport.setMnemonic('I');
487     _mnuImport.setText(Messages.getString("ModelEditor.Import"));
488     mnuMergeView.setText(Messages.getString("ModelEditor.MergeView"));
489     mnuMergeView.addActionListener(new java.awt.event.ActionListener JavaDoc()
490     {
491       public void actionPerformed(ActionEvent JavaDoc e)
492       {
493         mnuMergeView(e);
494       }
495     });
496     _mnuImportView.setMnemonic('V');
497     _mnuImportView.setText(Messages.getString("ModelEditor.View"));
498     _mnuImportView.addActionListener(new java.awt.event.ActionListener JavaDoc()
499     {
500       public void actionPerformed(ActionEvent JavaDoc e)
501       {
502         mnuImportView(e);
503       }
504     });
505     _mnuImportModel.setMnemonic('M');
506     _mnuImportModel.setText(Messages.getString("ModelEditor.Model"));
507     _mnuImportModel.addActionListener(new java.awt.event.ActionListener JavaDoc()
508     {
509       public void actionPerformed(ActionEvent JavaDoc e)
510       {
511         mnuImportModel(e);
512       }
513     });
514     _mnuOpenView.setMnemonic('O');
515     _mnuOpenView.setText(Messages.getString("ModelEditor.OpenView"));
516     _mnuOpenView.setAccelerator(javax.swing.KeyStroke.getKeyStroke(79, java.awt.event.KeyEvent.CTRL_MASK, false));
517     _mnuOpenView.addActionListener(new java.awt.event.ActionListener JavaDoc()
518     {
519       public void actionPerformed(ActionEvent JavaDoc e)
520       {
521         mnuOpenView(e);
522       }
523     });
524     _mnuNewView.setMnemonic('N');
525     _mnuNewView.setText(Messages.getString("ModelEditor.NewView"));
526     _mnuNewView.setAccelerator(javax.swing.KeyStroke.getKeyStroke(78, java.awt.event.KeyEvent.CTRL_MASK, false));
527     _mnuNewView.addActionListener(new java.awt.event.ActionListener JavaDoc()
528     {
529       public void actionPerformed(ActionEvent JavaDoc e)
530       {
531         mnuNewView(e);
532       }
533     });
534     _mnuSaveModelOnly.setMnemonic('M');
535     _mnuSaveModelOnly.setText(Messages.getString("ModelEditor.SaveModelOnly"));
536     _mnuSaveModelOnly.addActionListener(new java.awt.event.ActionListener JavaDoc()
537     {
538       public void actionPerformed(ActionEvent JavaDoc e)
539       {
540         mnuSaveModel(e);
541       }
542     });
543     _lblStatus.setToolTipText(Messages.getString("ModelEditor.DblClick"));
544     _lblStatus.setText(Messages.getString("global.Ok"));
545     _lblStatus.addMouseListener(new java.awt.event.MouseAdapter JavaDoc()
546     {
547       public void mouseClicked(MouseEvent JavaDoc e)
548       {
549         _status_mouseClicked(e);
550       }
551     });
552     jPanel1.setLayout(borderLayout3);
553     _butAdd.setPreferredSize(new Dimension JavaDoc(24, 24));
554     _butAdd.setToolTipText(Messages.getString("ModelEditor.AddExtent"));
555     _butAdd.addActionListener(new java.awt.event.ActionListener JavaDoc()
556     {
557       public void actionPerformed(ActionEvent JavaDoc e)
558       {
559         _butAdd(e);
560       }
561     });
562     _butEdit.addActionListener(new java.awt.event.ActionListener JavaDoc()
563     {
564       public void actionPerformed(ActionEvent JavaDoc e)
565       {
566         _butEdit(e);
567       }
568     });
569     _butEdit.setPreferredSize(new Dimension JavaDoc(24, 24));
570     _butEdit.setToolTipText(Messages.getString("global.Edit"));
571     _butAddRelation.setToolTipText(Messages.getString("ModelEditor.CreateNewRel"));
572     _butAddRelation.setPreferredSize(new Dimension JavaDoc(24, 24));
573     _butAddRelation.addActionListener(new java.awt.event.ActionListener JavaDoc()
574     {
575       public void actionPerformed(ActionEvent JavaDoc e)
576       {
577         _butAddRelation(e);
578       }
579     });
580     _butDelete.addActionListener(new java.awt.event.ActionListener JavaDoc()
581     {
582       public void actionPerformed(ActionEvent JavaDoc e)
583       {
584         _butDelete(e);
585       }
586     });
587     _butDelete.setPreferredSize(new Dimension JavaDoc(24, 24));
588     _butDelete.setToolTipText(Messages.getString("ModelEditor.DeleteExtentFromModel"));
589     _butPrint.setToolTipText(Messages.getString("ModelEditor.PrintDiagram"));
590     _butPrint.setPreferredSize(new Dimension JavaDoc(24, 24));
591     _butPrint.addActionListener(new java.awt.event.ActionListener JavaDoc()
592     {
593       public void actionPerformed(ActionEvent JavaDoc e)
594       {
595         _butPrint(e);
596       }
597     });
598     _buttonPanel.setLayout(verticalFlowLayout1);
599     _spaceHolder.setText(" ");
600     _butColor.setToolTipText(Messages.getString("ModelEditor.EditDisplayColors"));
601     _butColor.setPreferredSize(new Dimension JavaDoc(24, 24));
602     _butColor.addActionListener(new java.awt.event.ActionListener JavaDoc()
603     {
604       public void actionPerformed(ActionEvent JavaDoc e)
605       {
606         _butColor(e);
607       }
608     });
609     _butViewEditor.setToolTipText(Messages.getString("ModelEditor.ShowHideUP"));
610     _butViewEditor.setPreferredSize(new Dimension JavaDoc(24, 24));
611     _butViewEditor.addActionListener(new java.awt.event.ActionListener JavaDoc()
612     {
613       public void actionPerformed(ActionEvent JavaDoc e)
614       {
615         _butViewEditor(e);
616       }
617     });
618     _butDomains.addActionListener(new java.awt.event.ActionListener JavaDoc()
619     {
620       public void actionPerformed(ActionEvent JavaDoc e)
621       {
622         _butDomains(e);
623       }
624     });
625     _butDomains.setPreferredSize(new Dimension JavaDoc(24, 24));
626     _butDomains.setToolTipText(Messages.getString("ModelEditor.ShowHideDomains"));
627     _zoomSlider.setMinimum(5);
628     _zoomSlider.setOrientation(JSlider.VERTICAL);
629     _zoomSlider.setMaximum(100);
630     _zoomSlider.setValue(100);
631     _zoomSlider.setPreferredSize(new Dimension JavaDoc(24, 110));
632     _zoomSlider.setToolTipText(Messages.getString("ModelEditor.ZoomDiagram"));
633     _zoomSlider.addChangeListener(new javax.swing.event.ChangeListener JavaDoc()
634     {
635       public void stateChanged(ChangeEvent JavaDoc e)
636       {
637         _zoomSlider_stateChanged(e);
638       }
639     });
640     _butHideExtent.addActionListener(new java.awt.event.ActionListener JavaDoc()
641     {
642       public void actionPerformed(ActionEvent JavaDoc e)
643       {
644         _butHideExtent(e);
645       }
646     });
647     _butHideExtent.setPreferredSize(new Dimension JavaDoc(24, 24));
648     _butHideExtent.setToolTipText(Messages.getString("ModelEditor.HideExtentDescr"));
649     _butCreate.addActionListener(new java.awt.event.ActionListener JavaDoc()
650     {
651       public void actionPerformed(ActionEvent JavaDoc e)
652       {
653         _butCreate(e);
654       }
655     });
656     _butCreate.setPreferredSize(new Dimension JavaDoc(24, 24));
657     _butCreate.setToolTipText(Messages.getString("ModelEditor.CreateNewExtent"));
658     _spaceHolder1.setText(" ");
659     _butSave.setPreferredSize(new Dimension JavaDoc(24, 24));
660     _butSave.setToolTipText(Messages.getString("ModelEditor.SaveViewAndModel"));
661     _butSave.addActionListener(new java.awt.event.ActionListener JavaDoc()
662     {
663       public void actionPerformed(ActionEvent JavaDoc e)
664       {
665         _butSave(e);
666       }
667     });
668     _imgLocked.setPreferredSize(new Dimension JavaDoc(24, 24));
669     _imgLocked.setToolTipText(Messages.getString("ModelEditor.ModelLocked"));
670     _mnuShow.setText(Messages.getString("ModelEditor.Show"));
671     _mnuShowAlias.setText(Messages.getString("global.Alias"));
672     _mnuShowAlias.addActionListener(new java.awt.event.ActionListener JavaDoc()
673     {
674       public void actionPerformed(ActionEvent JavaDoc e)
675       {
676         mnuShowAlias(e);
677       }
678     });
679     _mnuShowQualified.setText(Messages.getString("global.Qualified"));
680     _mnuShowQualified.addActionListener(new java.awt.event.ActionListener JavaDoc()
681     {
682       public void actionPerformed(ActionEvent JavaDoc e)
683       {
684         mnuShowQualified(e);
685       }
686     });
687     _mnuShowExtent.setText(Messages.getString("global.Extent"));
688     _mnuShowExtent.addActionListener(new java.awt.event.ActionListener JavaDoc()
689     {
690       public void actionPerformed(ActionEvent JavaDoc e)
691       {
692         mnuShowExtent(e);
693       }
694     });
695     _mnuShowClass.setText(Messages.getString("ModelEditor.Class"));
696     _mnuShowClass.setActionCommand(Messages.getString("ModelEditor.Class"));
697     _mnuShowClass.addActionListener(new java.awt.event.ActionListener JavaDoc()
698     {
699       public void actionPerformed(ActionEvent JavaDoc e)
700       {
701         mnuShowClass(e);
702       }
703     });
704     _mnuPrint.setText(Messages.getString("ModelEditor.Print"));
705     _mnuPrint.setAccelerator(javax.swing.KeyStroke.getKeyStroke(80, java.awt.event.KeyEvent.CTRL_MASK, false));
706     _mnuPrint.addActionListener(new java.awt.event.ActionListener JavaDoc()
707     {
708       public void actionPerformed(ActionEvent JavaDoc e)
709       {
710         mnuPrintDiagram(e);
711       }
712     });
713     _mnuHelp.setMnemonic('H');
714     _mnuHelp.setText(Messages.getString("global.Help"));
715     _mnuAbout.setText(Messages.getString("global.About"));
716     _mnuAbout.addActionListener(new java.awt.event.ActionListener JavaDoc()
717     {
718       public void actionPerformed(ActionEvent JavaDoc e)
719       {
720         mnuAbout(e);
721       }
722     });
723     _mnuScript.setText(Messages.getString("ModelEditor.GenerateScript"));
724     _mnuScript.addActionListener(new java.awt.event.ActionListener JavaDoc()
725     {
726       public void actionPerformed(ActionEvent JavaDoc e)
727       {
728         mnuScript(e);
729       }
730     });
731     _mnuQualityCheck.setText(Messages.getString("ModelEditor.QualityCheck"));
732     _mnuQualityCheck.setAccelerator(javax.swing.KeyStroke.getKeyStroke(123, 0, false));
733     _mnuQualityCheck.addActionListener(new java.awt.event.ActionListener JavaDoc()
734     {
735       public void actionPerformed(ActionEvent JavaDoc e)
736       {
737         mnuQualityCheck(e);
738       }
739     });
740
741     _mnuModelDescr.setText(Messages.getString("ModelEditor.ModelDescription"));
742     _mnuModelDescr.addActionListener(new java.awt.event.ActionListener JavaDoc()
743     {
744       public void actionPerformed(ActionEvent JavaDoc e)
745       {
746         mnuDescribeModel(e);
747       }
748     });
749     _mnuTabs.setMnemonic('A');
750     _mnuTabs.setText(Messages.getString("global.Tabs"));
751     _mnuRemoveTab.setActionCommand(Messages.getString("global.CloseTab"));
752     _mnuRemoveTab.setText(Messages.getString("global.CloseTab"));
753     _mnuRemoveTab.setAccelerator(javax.swing.KeyStroke.getKeyStroke(115, java.awt.event.KeyEvent.CTRL_MASK, false));
754     _mnuRemoveTab.addActionListener(new java.awt.event.ActionListener JavaDoc()
755     {
756       public void actionPerformed(ActionEvent JavaDoc e)
757       {
758         mnuRemoveTab(e);
759       }
760     });
761     _mnuNextTab.setText(Messages.getString("global.NextTab"));
762     _mnuNextTab.setAccelerator(javax.swing.KeyStroke.getKeyStroke(117, java.awt.event.KeyEvent.CTRL_MASK, false));
763     _mnuNextTab.addActionListener(new java.awt.event.ActionListener JavaDoc()
764     {
765       public void actionPerformed(ActionEvent JavaDoc e)
766       {
767         mnuNextTab(e);
768       }
769     });
770     _mnuPrevTab.setText(Messages.getString("global.PreviousTab"));
771     _mnuPrevTab.setAccelerator(javax.swing.KeyStroke.getKeyStroke(117, java.awt.event.KeyEvent.CTRL_MASK
772                                                                       | java.awt.event.KeyEvent.SHIFT_MASK, false));
773     _mnuPrevTab.addActionListener(new java.awt.event.ActionListener JavaDoc()
774     {
775       public void actionPerformed(ActionEvent JavaDoc e)
776       {
777         mnuPrevTab(e);
778       }
779     });
780     _mnuValidateRepository.setText(Messages.getString("ModelEditor.ValidateRepositoryContents"));
781     _mnuValidateRepository.addActionListener(new java.awt.event.ActionListener JavaDoc()
782     {
783       public void actionPerformed(ActionEvent JavaDoc e)
784       {
785         mnuValidateRepository(e);
786       }
787     });
788     _mnuEdit.setMnemonic('E');
789     _mnuEdit.setText(Messages.getString("global.Edit"));
790     _mnuNewExtent.setText(Messages.getString("ModelEditor.NewExtent"));
791     _mnuNewExtent.setAccelerator(javax.swing.KeyStroke.getKeyStroke(155, java.awt.event.KeyEvent.CTRL_MASK, false));
792     _mnuNewExtent.addActionListener(new java.awt.event.ActionListener JavaDoc()
793     {
794       public void actionPerformed(ActionEvent JavaDoc e)
795       {
796         mnuNewExtent(e);
797       }
798     });
799     _mnuEditExtent.setText(Messages.getString("ModelEditor.EditExtent"));
800     _mnuEditExtent.setAccelerator(javax.swing.KeyStroke.getKeyStroke(10, 0, false));
801     _mnuEditExtent.addActionListener(new java.awt.event.ActionListener JavaDoc()
802     {
803       public void actionPerformed(ActionEvent JavaDoc e)
804       {
805         mnuEditExtent(e);
806       }
807     });
808     _mnuDeleteExtent.setText(Messages.getString("ModelEditor.DeleteExtent"));
809     _mnuDeleteExtent.setAccelerator(javax.swing.KeyStroke.getKeyStroke(127, java.awt.event.KeyEvent.CTRL_MASK, false));
810     _mnuDeleteExtent.addActionListener(new java.awt.event.ActionListener JavaDoc()
811     {
812       public void actionPerformed(ActionEvent JavaDoc e)
813       {
814         mnuDeleteExtent(e);
815       }
816     });
817     _mnuNewRelation.setText(Messages.getString("ModelEditor.NewRelation"));
818     _mnuNewRelation.addActionListener(new java.awt.event.ActionListener JavaDoc()
819     {
820       public void actionPerformed(ActionEvent JavaDoc e)
821       {
822         mnuNewRelation(e);
823       }
824     });
825     _mnuAddExtentFromModel.setText(Messages.getString("ModelEditor.ShowExtent"));
826     _mnuAddExtentFromModel.setAccelerator(javax.swing.KeyStroke.getKeyStroke(155, 0, false));
827     _mnuAddExtentFromModel.addActionListener(new java.awt.event.ActionListener JavaDoc()
828     {
829       public void actionPerformed(ActionEvent JavaDoc e)
830       {
831         mnuAddExtentFromModel(e);
832       }
833     });
834     _mnuDomains.setText(Messages.getString("global.Domains"));
835     _mnuDomains.setAccelerator(javax.swing.KeyStroke.getKeyStroke(68, java.awt.event.KeyEvent.CTRL_MASK, false));
836     _mnuDomains.addActionListener(new java.awt.event.ActionListener JavaDoc()
837     {
838       public void actionPerformed(ActionEvent JavaDoc e)
839       {
840         mnuDomains(e);
841       }
842     });
843     _mnuPackages.setText(Messages.getString("global.Packages"));
844     _mnuPackages.addActionListener(new java.awt.event.ActionListener JavaDoc()
845     {
846       public void actionPerformed(ActionEvent JavaDoc e)
847       {
848         mnuPackages(e);
849       }
850     });
851     _mnuDefineEditors.setText(Messages.getString("ModelEditor.ShowHideUP"));
852     _mnuDefineEditors.addActionListener(new java.awt.event.ActionListener JavaDoc()
853     {
854       public void actionPerformed(ActionEvent JavaDoc e)
855       {
856         mnuDefineEditors(e);
857       }
858     });
859     _mnuModelHistory.setText(Messages.getString("ModelEditor.VersionHistory"));
860     _mnuModelHistory.addActionListener(new java.awt.event.ActionListener JavaDoc()
861     {
862       public void actionPerformed(ActionEvent JavaDoc e)
863       {
864         mnuModelHistory(e);
865       }
866     });
867     _mnuKeyboard.setText(Messages.getString("ModelEditor.KeyboardMappings"));
868     _mnuKeyboard.addActionListener(new java.awt.event.ActionListener JavaDoc()
869     {
870       public void actionPerformed(ActionEvent JavaDoc e)
871       {
872         mnuKeyHelp(e);
873       }
874     });
875     _mnuSelectAll.setText(Messages.getString("ModelEditor.SelectAll"));
876     _mnuSelectAll.setAccelerator(javax.swing.KeyStroke.getKeyStroke(65, java.awt.event.KeyEvent.CTRL_MASK, false));
877     _mnuSelectAll.addActionListener(new java.awt.event.ActionListener JavaDoc()
878     {
879       public void actionPerformed(ActionEvent JavaDoc e)
880       {
881         mnuSelectAll(e);
882       }
883     });
884     _mnuHideExtent.setText(Messages.getString("ModelEditor.Hide_extent"));
885     _mnuHideExtent.setAccelerator(javax.swing.KeyStroke.getKeyStroke(127, 0, false));
886     _mnuHideExtent.addActionListener(new java.awt.event.ActionListener JavaDoc()
887     {
888       public void actionPerformed(ActionEvent JavaDoc e)
889       {
890         mnuRemoveExtent(e);
891       }
892     });
893     jPanel3.setLayout(borderLayout4);
894     _xscroller.setOrientation(JScrollBar.HORIZONTAL);
895     _xscroller.addAdjustmentListener(new java.awt.event.AdjustmentListener JavaDoc()
896     {
897       public void adjustmentValueChanged(AdjustmentEvent JavaDoc e)
898       {
899         _hscroller_adjustmentValueChanged(e);
900       }
901     });
902     _yscroller.addAdjustmentListener(new java.awt.event.AdjustmentListener JavaDoc()
903     {
904       public void adjustmentValueChanged(AdjustmentEvent JavaDoc e)
905       {
906         _vscroller_adjustmentValueChanged(e);
907       }
908     });
909     _mnuReloadModel.setText(Messages.getString("ModelEditor.ReloadModel"));
910     _mnuReloadModel.addActionListener(new java.awt.event.ActionListener JavaDoc()
911     {
912       public void actionPerformed(ActionEvent JavaDoc e)
913       {
914         mnuReloadModel(e);
915       }
916     });
917     _diagramPanel.add(jPanel1, BorderLayout.WEST);
918     jPanel1.add(_buttonPanel, BorderLayout.CENTER);
919     _buttonPanel.add(_butSave, null);
920     _buttonPanel.add(_butPrint, null);
921     _buttonPanel.add(_butDomains, null);
922     _buttonPanel.add(_butViewEditor, null);
923     _buttonPanel.add(_spaceHolder1, null);
924     _buttonPanel.add(_butEdit, null);
925     _buttonPanel.add(_butColor, null);
926     _buttonPanel.add(_butAdd, null);
927     _buttonPanel.add(_butHideExtent, null);
928     _buttonPanel.add(_butAddRelation, null);
929     _buttonPanel.add(_spaceHolder, null);
930     _buttonPanel.add(_butCreate, null);
931     _buttonPanel.add(_butDelete, null);
932     _buttonPanel.add(_zoomSlider, null);
933     jPanel1.add(jPanel2, BorderLayout.SOUTH);
934     jPanel2.add(_imgLocked, null);
935     _diagramPanel.add(jPanel3, BorderLayout.CENTER);
936     jPanel3.add(_xscroller, BorderLayout.SOUTH);
937     jPanel3.add(_yscroller, BorderLayout.EAST);
938     jPanel3.add(_paintPanel, BorderLayout.CENTER);
939     _tabs.addTab(Messages.getString("ModelEditor.Diagram"), getImageIcon("diagram.gif"), _diagramPanel);
940     contentPane.add(_tabs, BorderLayout.CENTER);
941     contentPane.add(_lblStatus, BorderLayout.SOUTH);
942     _mainMenu.add(_mnuFile);
943     _mainMenu.add(_mnuEdit);
944     _mainMenu.add(_mnuTools);
945     _mainMenu.add(_mnuTabs);
946     _mainMenu.add(_mnuHelp);
947     _mnuFile.add(_mnuOpenView);
948     _mnuFile.add(_mnuNewView);
949     _mnuFile.addSeparator();
950     _mnuFile.add(_mnuSave);
951     _mnuFile.add(_mnuSaveAs);
952     _mnuFile.add(_mnuSaveModelOnly);
953     _mnuFile.addSeparator();
954     _mnuFile.add(_mnuDeleteView);
955     _mnuFile.addSeparator();
956     _mnuFile.add(_mnuReloadModel);
957     _mnuFile.addSeparator();
958     _mnuFile.add(_mnuPrint);
959     _mnuFile.add(_mnuExport2Image);
960     _mnuFile.addSeparator();
961     _mnuFile.add(_mnuExit);
962     _mnuTools.add(_mnuShow);
963     _mnuTools.addSeparator();
964     _mnuTools.add(_mnuQualityCheck);
965     _mnuTools.add(_mnuModelDescr);
966     _mnuTools.add(_mnuValidateRepository);
967     _mnuTools.add(_mnuScript);
968     _mnuTools.addSeparator();
969     _mnuTools.add(mnuMergeView);
970     _mnuTools.add(_mnuImport);
971     _mnuTools.add(_mnuExport);
972     _mnuExport.add(_mnuExportView);
973     _mnuExport.add(_mnuExportModel);
974     _mnuImport.add(_mnuImportView);
975     _mnuImport.add(_mnuImportModel);
976     _mnuShow.add(_mnuShowClass);
977     _mnuShow.add(_mnuShowQualified);
978     _mnuShow.add(_mnuShowExtent);
979     _mnuShow.add(_mnuShowAlias);
980     ButtonGroup JavaDoc group = new ButtonGroup JavaDoc();
981     group.add(_mnuShowExtent);
982     group.add(_mnuShowClass);
983     group.add(_mnuShowQualified);
984     group.add(_mnuShowAlias);
985     _mnuHelp.add(_mnuKeyboard);
986     _mnuHelp.add(_mnuAbout);
987     _mnuTabs.add(_mnuNextTab);
988     _mnuTabs.add(_mnuPrevTab);
989     _mnuTabs.add(_mnuRemoveTab);
990     _mnuEdit.add(_mnuNewExtent);
991     _mnuEdit.add(_mnuEditExtent);
992     _mnuEdit.add(_mnuDeleteExtent);
993     _mnuEdit.addSeparator();
994     _mnuEdit.add(_mnuNewRelation);
995     _mnuEdit.addSeparator();
996     _mnuEdit.add(_mnuAddExtentFromModel);
997     _mnuEdit.add(_mnuHideExtent);
998     _mnuEdit.addSeparator();
999     _mnuEdit.add(_mnuDomains);
1000    _mnuEdit.add(_mnuPackages);
1001    _mnuEdit.add(_mnuDefineEditors);
1002    _mnuEdit.add(_mnuModelHistory);
1003    _mnuEdit.addSeparator();
1004    _mnuEdit.add(_mnuSelectAll);
1005    setJMenuBar(_mainMenu);
1006  }
1007
1008  protected void mnuMergeView(ActionEvent JavaDoc e)
1009  {
1010    try
1011    {
1012      OpenDialog od = new OpenDialog(this, Messages.getString("ModelEditor.MergeView"), _theView);
1013      DjModelView view2merge = od.getModelView();
1014      DjenericDocumentHandler dh = new DjenericDocumentHandler(view2merge.getDefinition());
1015      MergeViewDialog mvd = new MergeViewDialog(this, dh.getEditors(_mgr), dh.getResources(), dh.getScripts(this));
1016      if (!mvd.wasCanceled())
1017      {
1018        ArrayList JavaDoc editors = mvd.getSelectedEditors();
1019        ArrayList JavaDoc resources = mvd.getSelectedResources();
1020        ArrayList JavaDoc scripts = mvd.getSelectedScripts();
1021        boolean replaceAll = false;
1022        for (int i = 0; i < editors.size(); i++)
1023        {
1024          EditorDefinition editor = (EditorDefinition) editors.get(i);
1025          EditorDefinition existing = getViewEditor().getEditorByName(editor.getName());
1026          if (existing != null)
1027          {
1028            int result = 0;
1029            if (!replaceAll)
1030            {
1031              result = JOptionPane.showOptionDialog(this, Messages.getString("ModelEditor.ReplaceEditor", existing
1032                  .getName()), Messages.getString("ModelEditor.ReplaceEditorTitle"), JOptionPane.DEFAULT_OPTION,
1033                                                    JOptionPane.WARNING_MESSAGE, null, new String JavaDoc[]{
1034                                                        Messages.getString("global.Replace"),
1035                                                        Messages.getString("global.ReplaceAll"),
1036                                                        Messages.getString("global.Skip")}, null);
1037              replaceAll = result == 1;
1038              if (replaceAll) result = 0;
1039            }
1040            if (result != 0) continue;
1041            existing.copyFrom(editor);
1042          }
1043          else
1044          {
1045            getViewEditor().addEditor(editor);
1046          }
1047        }
1048        replaceAll = false;
1049        for (int i = 0; i < resources.size(); i++)
1050        {
1051          ResourceDefinition res = (ResourceDefinition) resources.get(i);
1052          ResourceDefinition existing = getViewEditor().getResourceByName(res.getAbsolutePath());
1053          if (existing != null)
1054          {
1055            int result = 0;
1056            if (!replaceAll)
1057            {
1058              result = JOptionPane.showOptionDialog(this, Messages.getString("ModelEditor.ReplaceResource", existing
1059                  .getName()), Messages.getString("ModelEditor.ReplaceResourceTitle"), JOptionPane.DEFAULT_OPTION,
1060                                                    JOptionPane.WARNING_MESSAGE, null, new String JavaDoc[]{
1061                                                        Messages.getString("global.Replace"),
1062                                                        Messages.getString("global.ReplaceAll"),
1063                                                        Messages.getString("global.Skip")}, null);
1064              replaceAll = result == 1;
1065              if (replaceAll) result = 0;
1066            }
1067            if (result != 0) continue;
1068            existing.copyFrom(res);
1069          }
1070          else
1071          {
1072            getViewEditor().addResource(res);
1073          }
1074        }
1075        replaceAll = false;
1076        for (int i = 0; i < scripts.size(); i++)
1077        {
1078          ScriptDefinition script = (ScriptDefinition) scripts.get(i);
1079          ScriptDefinition existing = getViewEditor().getScriptByTitle(script.getTitle());
1080          if (existing != null)
1081          {
1082            int result = 0;
1083            if (!replaceAll)
1084            {
1085              result = JOptionPane.showOptionDialog(this, Messages.getString("ModelEditor.ReplaceScript", existing
1086                  .getTitle()), Messages.getString("ModelEditor.ReplaceScriptTitle"), JOptionPane.DEFAULT_OPTION,
1087                                                    JOptionPane.WARNING_MESSAGE, null, new String JavaDoc[]{
1088                                                        Messages.getString("global.Replace"),
1089                                                        Messages.getString("global.ReplaceAll"),
1090                                                        Messages.getString("global.Skip")}, null);
1091              replaceAll = result == 1;
1092              if (replaceAll) result = 0;
1093            }
1094            if (result != 0) continue;
1095            existing.setCode(script.getCode());
1096            existing.setTitle(script.getTitle());
1097          }
1098          else
1099          {
1100            getViewEditor().addScript(script);
1101          }
1102        }
1103        getViewEditor().sortEditors();
1104        getViewEditor().sortResources();
1105        getViewEditor().synchronize();
1106      }
1107    }
1108    catch (Exception JavaDoc x)
1109    {
1110      setStatusMessage(x);
1111    }
1112  }
1113
1114  protected void mnuDeleteView(ActionEvent JavaDoc e)
1115  {
1116    try
1117    {
1118      OpenDialog od = new OpenDialog(this, Messages.getString("ModelEditor.DeleteView"));
1119      DjModelView view2del = od.getModelView();
1120      int result = JOptionPane.showOptionDialog(this, Messages.getString("ModelEditor.DeleteViewAssert", view2del
1121          .getCode()), Messages.getString("ModelEditor.DeleteViewAssertTitle", view2del.getCode()),
1122                                                JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null,
1123                                                new String JavaDoc[]{Messages.getString("global.Delete"),
1124                                                    Messages.getString("global.Cancel")}, null);
1125      if (result == 0)
1126      {
1127        DjSession session = _mgr.createSession();
1128        try
1129        {
1130          view2del.delete(session);
1131          session.commit();
1132          setStatusMessage(Messages.getString("ModelEditor.ViewDeleted", view2del.getCode()));
1133        }
1134        finally
1135        {
1136          session.close();
1137        }
1138      }
1139    }
1140    catch (Exception JavaDoc x)
1141    {
1142      setStatusMessage(x);
1143    }
1144  }
1145
1146  protected void mnuDescribeModel(ActionEvent JavaDoc e)
1147  {
1148    describeModel();
1149  }
1150
1151  boolean isOkToAbandon() throws Exception JavaDoc
1152  {
1153    if (isModified())
1154    {
1155      int result = JOptionPane.showOptionDialog(this, Messages.getString("ModelEditor.SaveView") + "\n", Messages
1156          .getString("ModelEditor.ChangesMade"), JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null,
1157                                                new String JavaDoc[]{Messages.getString("global.Save"),
1158                                                    Messages.getString("global.Discard"),
1159                                                    Messages.getString("global.Cancel")}, null);
1160      if ((result != 0) && (result != 1))
1161      {
1162        return false;
1163      }
1164      // cancel or closed
1165
if (result == 0)
1166      {
1167        saveAll();
1168      }
1169    }
1170    return true;
1171  }
1172
1173  public void newView()
1174  {
1175    try
1176    {
1177      if (_paintPanel.getExtentViewerCount() != 0)
1178      {
1179        if (!isOkToAbandon())
1180        {
1181          return;
1182        }
1183      }
1184      _paintPanel.clear();
1185      _viewEditor.clear();
1186      checkBordersAndSizes();
1187      _theView = _mgr.createModelView();
1188      _lastOpenedViewName = "";
1189      updateTitle();
1190    }
1191    catch (Exception JavaDoc x)
1192    {
1193      setStatusMessage(x);
1194    }
1195  }
1196
1197  public void loadView(String JavaDoc xmlString) throws DjenericException
1198  {
1199    try
1200    {
1201      ModelDocumentHandler dh = new ModelDocumentHandler(xmlString);
1202      _paintPanel.clear();
1203      _viewEditor.clear();
1204      _zoomSlider.setValue(100);
1205      _xscroller.setValue(0);
1206      _yscroller.setValue(0);
1207      ExtentViewer[] viewers = dh.getExtentViewers(_mgr);
1208      for (int i = 0; i < viewers.length; i++)
1209      {
1210        viewers[i].setEditor(this);
1211        addExtentViewer(viewers[i]);
1212      }
1213      checkBordersAndSizes();
1214      _viewEditor.load(dh);
1215    }
1216    catch (Exception JavaDoc x)
1217    {
1218      throw new DjenericException(x);
1219    }
1220  }
1221
1222  public DjPersistenceManager getPersistenceManager()
1223  {
1224    return _mgr;
1225  }
1226
1227  public PaintPanel getPaintPanel()
1228  {
1229    return _paintPanel;
1230  }
1231
1232  public DjExtent getExtent(String JavaDoc extentName) throws Exception JavaDoc
1233  {
1234    return _mgr.getExtent(extentName);
1235  }
1236
1237  public DjExtent getExtentByInternalCode(String JavaDoc alias) throws Exception JavaDoc
1238  {
1239    return _mgr.getExtentByInternalCode(alias);
1240  }
1241
1242  public DjExtent getExtentByObjectType(String JavaDoc type) throws Exception JavaDoc
1243  {
1244    return _mgr.getExtentByObjectType(type);
1245  }
1246
1247  public void removeExtentViewer(ExtentViewer tv)
1248  {
1249    _paintPanel.removeExtentViewer(tv);
1250    _viewEditor.updateSelectedNodeData();
1251  }
1252
1253  public void addExtentViewer(ExtentViewer tv)
1254  {
1255    _paintPanel.addExtentViewer(tv);
1256    _viewEditor.updateSelectedNodeData();
1257  }
1258
1259  public ExtentViewer getExtentViewer(DjExtent ext)
1260  {
1261    return _paintPanel.getExtentViewer(ext);
1262  }
1263
1264  public ExtentViewer getExtentViewer(int idx)
1265  {
1266    return _paintPanel.getExtentViewer(idx);
1267  }
1268
1269  public int getExtentViewerCount()
1270  {
1271    return _paintPanel.getExtentViewerCount();
1272  }
1273
1274  public boolean canExit() throws Exception JavaDoc
1275  {
1276    Component JavaDoc[] comps = _tabs.getComponents();
1277    for (int i = 0; i < comps.length; i++)
1278    {
1279      if (comps[i] instanceof DomainEditor)
1280      {
1281        DomainEditor de = (DomainEditor) comps[i];
1282        de.cleanup();
1283      }
1284      else if (comps[i] instanceof ExtentEditor)
1285      {
1286        ExtentEditor te = (ExtentEditor) comps[i];
1287        _tabs.setSelectedComponent(te);
1288        if (!te.canClose())
1289        {
1290          return false;
1291        }
1292      }
1293    }
1294    boolean modelModified = _mgr.isModelModified();
1295    if (isModified() || modelModified)
1296    {
1297      int result = JOptionPane.showOptionDialog(this, Messages.getString("ModelEditor.SaveExit"), Messages
1298          .getString("ModelEditor.ExitEditor"), JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null,
1299                                                new String JavaDoc[]{Messages.getString("global.Save"),
1300                                                    Messages.getString("global.Discard"),
1301                                                    Messages.getString("global.Cancel")}, null);
1302      if ((result != 0) && (result != 1))
1303      {
1304        return false;
1305      }
1306      if (result == 0)
1307      {
1308        if (modelModified) tryLockModel();
1309        saveAll();
1310      }
1311    }
1312    updateProperties();
1313    saveProps();
1314    return true;
1315  }
1316
1317  /**
1318   * Overridden so we can exit when window is closed
1319   *
1320   * @param e
1321   * Description of the Parameter
1322   */

1323  protected void processWindowEvent(WindowEvent JavaDoc e)
1324  {
1325    try
1326    {
1327      if (e.getID() == WindowEvent.WINDOW_CLOSING)
1328      {
1329        if (canExit())
1330        {
1331          cleanup();
1332          System.exit(0);
1333        }
1334      }
1335      else
1336      {
1337        super.processWindowEvent(e);
1338      }
1339    }
1340    catch (Exception JavaDoc x)
1341    {
1342      setStatusMessage(x);
1343    }
1344  }
1345
1346  private void cleanup()
1347  {
1348    getPersistenceManager().close();
1349  }
1350
1351  protected void updateProperties()
1352  {
1353    setProperty("window.width", "" + getWidth());
1354    setProperty("window.height", "" + getHeight());
1355    setProperty("diagrammer.show", "" + _paintPanel.getViewMode());
1356  }
1357
1358  public void displayProgress(String JavaDoc msg)
1359  {
1360    setStatusMessage(msg);
1361    RepaintManager JavaDoc rm = RepaintManager.currentManager(this);
1362    if (rm != null)
1363    {
1364      rm.validateInvalidComponents();
1365      rm.paintDirtyRegions();
1366    }
1367  }
1368
1369  public void validateModel(boolean strictChecking) throws CatalogException
1370  {
1371    _mgr.validateModel(strictChecking);
1372  }
1373
1374  public void fixInvalidReferences() throws DjenericException
1375  {
1376    _viewEditor.fixInvalidReferences();
1377  }
1378
1379  public static ImageIcon JavaDoc getImageIcon(String JavaDoc fileName)
1380  {
1381    URL JavaDoc url = ModelEditor.class.getResource("images/" + fileName);
1382    if (url != null)
1383    {
1384      return new ImageIcon JavaDoc(url);
1385    }
1386    else
1387    {
1388      return new ImageIcon JavaDoc("");
1389    }
1390    // Default to empty image
1391
}
1392
1393  public static Image JavaDoc getImage(String JavaDoc fileName)
1394  {
1395    URL JavaDoc url = ModelEditor.class.getResource("images/" + fileName);
1396    if (url != null)
1397    {
1398      return Toolkit.getDefaultToolkit().getImage(url);
1399    }
1400    else
1401    {
1402      return Toolkit.getDefaultToolkit().getImage("");
1403    }
1404  }
1405
1406  void paintView()
1407  {
1408    paint(getGraphics());
1409  }
1410
1411  void paintViewQuickly()
1412  {
1413    if (_paintPanel.getGraphics() != null)
1414    {
1415      _paintPanel.paint(_paintPanel.getGraphics());
1416    }
1417  }
1418
1419  void checkBordersAndSizes()
1420  {
1421    Dimension JavaDoc d = _paintPanel.getDiagramSizeScaled();
1422    _xscroller.setValues(_xscroller.getValue(), _paintPanel.scaleDown(_paintPanel.getWidth()), 0, _paintPanel
1423        .scaleDown(d.width));
1424    _yscroller.setValues(_yscroller.getValue(), _paintPanel.scaleDown(_paintPanel.getHeight()), 0, _paintPanel
1425        .scaleDown(d.height));
1426  }
1427
1428  void _paintPanel_mousePressed(MouseEvent JavaDoc e)
1429  {
1430    int x = _paintPanel.getRealX(e.getX());
1431    int y = _paintPanel.getRealY(e.getY());
1432    ExtentViewer u = _paintPanel.getExtentViewerAt(x, y);
1433    if (u != null)
1434    {
1435      StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
1436      sb.append(u.getExtent().getName());
1437      DjExtent sup = u.getExtent().getSuper();
1438      while (sup != null)
1439      {
1440        sb.append("->");
1441        sb.append(sup.getName());
1442        sup = sup.getSuper();
1443      }
1444      setStatusMessage(sb.toString());
1445    }
1446    if (_inRelationAddMode && u != null)
1447    {
1448      if (_relationMaster != null)
1449      {
1450        _inRelationAddMode = false;
1451        createRelation(_relationMaster, u);
1452        _relationMaster = null;
1453      }
1454      else
1455      {
1456        _relationMaster = u;
1457        _paintPanel.deselectExtentViewers();
1458        setStatusMessage(Messages.getString("ModelEditor.NowClickDetail_extent"));
1459      }
1460      return;
1461    }
1462    if (!e.isControlDown() && !e.isShiftDown() && !(u != null && u.isSelected()))
1463    {
1464      _paintPanel.deselectExtentViewers();
1465    }
1466    _lastPressedExtentViewer = u;
1467    _lastPressedX = x;
1468    _lastPressedY = y;
1469    if (u != null)
1470    {
1471      _selectionBoxX1 = -1;
1472      // this can't be something to do with a selection box, mark it invalid
1473
// then
1474

1475      if (e.isControlDown())
1476      {
1477        u.setSelected(!u.isSelected());
1478      }
1479      else
1480      {
1481        u.setSelected(true);
1482        _paintPanel.moveToFront(u);
1483      }
1484      if (!u.isSelected())
1485      {
1486        _lastPressedExtentViewer = null;
1487      }
1488      _lastCorner = u.getCorner(x, y);
1489    }
1490    else
1491    {
1492      _lastCorner = -1;
1493
1494      // Nothing was hit by this click. It might be the start of a selection
1495
// box drag than, so:
1496
_selectionBoxX1 = x;
1497      _selectionBoxY1 = y;
1498    }
1499    paintViewQuickly();
1500  }
1501
1502  void _paintPanel_mouseDragged(MouseEvent JavaDoc e)
1503  {
1504    if (_inRelationAddMode) return;
1505    int x = _paintPanel.getRealX(e.getX());
1506    int y = _paintPanel.getRealY(e.getY());
1507    if (_lastPressedExtentViewer != null)
1508    {
1509      if (_lastCorner != -1)
1510      {
1511        // a resize?
1512
int widthDelta = x - _lastPressedX;
1513        int heightDelta = y - _lastPressedY;
1514        if (_lastCorner == 1)
1515        {
1516          _lastPressedExtentViewer.setX(_lastPressedExtentViewer.getX() + widthDelta);
1517          _lastPressedExtentViewer.setY(_lastPressedExtentViewer.getY() + heightDelta);
1518          widthDelta = 0 - widthDelta;
1519          heightDelta = 0 - heightDelta;
1520        }
1521        if (_lastCorner == 2)
1522        {
1523          _lastPressedExtentViewer.setY(_lastPressedExtentViewer.getY() + heightDelta);
1524          heightDelta = 0 - heightDelta;
1525        }
1526        if (_lastCorner == 3)
1527        {
1528          _lastPressedExtentViewer.setX(_lastPressedExtentViewer.getX() + widthDelta);
1529          widthDelta = 0 - widthDelta;
1530        }
1531        _lastPressedExtentViewer.setWidth(_lastPressedExtentViewer.getWidth() + widthDelta);
1532        _lastPressedExtentViewer.setHeight(_lastPressedExtentViewer.getHeight() + heightDelta);
1533      }
1534      else
1535      {
1536        // a move
1537
int dx = x - _lastPressedX;
1538        int dy = y - _lastPressedY;
1539        ExtentViewer[] sels = _paintPanel.getSelectedExtentViewers();
1540        for (int i = 0; i < sels.length; i++)
1541        {
1542          int newX = sels[i].getX() + dx;
1543          int newY = sels[i].getY() + dy;
1544          sels[i].setX(newX);
1545          sels[i].setY(newY);
1546        }
1547      }
1548      _lastPressedX = x;
1549      _lastPressedY = y;
1550    }
1551    else
1552    {
1553      // might be a selectionbox drag then
1554
if (_selectionBoxX1 != -1)
1555      {
1556        // Yup, start drawing the box!
1557
_selectionBoxX2 = x;
1558        _selectionBoxY2 = y;
1559        _paintPanel.setSelectionBox(_selectionBoxX1, _selectionBoxY1, _selectionBoxX2, _selectionBoxY2);
1560      }
1561    }
1562    paintViewQuickly();
1563  }
1564
1565  void _paintPanel_mouseClicked(MouseEvent JavaDoc e)
1566  {
1567    if (e.getClickCount() >= 2)
1568    {
1569      int x = _paintPanel.getRealX(e.getX());
1570      int y = _paintPanel.getRealY(e.getY());
1571      ExtentViewer u = _paintPanel.getExtentViewerAt(x, y);
1572      if (u != null)
1573      {
1574        editExtent(u);
1575      }
1576    }
1577  }
1578
1579  void _paintPanel_mouseReleased(MouseEvent JavaDoc e)
1580  {
1581    checkBordersAndSizes();
1582    if (_selectionBoxX1 != -1)
1583    {
1584      if (!e.isShiftDown()) _paintPanel.deselectExtentViewers();
1585      _paintPanel.selectUsingSelectionBox();
1586      _selectionBoxX1 = -1;
1587      _paintPanel.clearSelectionBox();
1588    }
1589    paintViewQuickly();
1590  }
1591
1592  public boolean isModelLocked()
1593  {
1594    return getPersistenceManager().isModelLocked();
1595  }
1596
1597  private void lockModel() throws Exception JavaDoc
1598  {
1599    if (!_mgr.getCurrentUser().isModeler())
1600    {
1601      throw new Exception JavaDoc(NOT_MODELER_MSG);
1602    }
1603    if (!getPersistenceManager().isModelLocked()) getPersistenceManager().lockModel();
1604    _imgLocked.setVisible(true);
1605  }
1606
1607  private void unlockModel() throws CatalogException
1608  {
1609    if (getPersistenceManager().isModelLocked()) getPersistenceManager().unlockModel();
1610    _imgLocked.setVisible(false);
1611  }
1612
1613  private void tryLockModel()
1614  {
1615    try
1616    {
1617      lockModel();
1618    }
1619    catch (Exception JavaDoc x)
1620    {
1621      setStatusMessage(x);
1622    }
1623  }
1624
1625  private boolean isAnyEditorOpen()
1626  {
1627    Component JavaDoc[] comps = _tabs.getComponents();
1628    for (int i = 0; i < comps.length; i++)
1629    {
1630      if (comps[i] instanceof DomainEditor)
1631      {
1632        return true;
1633      }
1634    }
1635    return _allEditorsOpen.size() > 0;
1636  }
1637
1638  public ExtentEditor editExtent(ExtentViewer extentViewer)
1639  {
1640    tryLockModel();
1641    ExtentEditor te = null;
1642    for (int i = 0; i < _allEditorsOpen.size(); i++)
1643    {
1644      ExtentEditor t = (ExtentEditor) _allEditorsOpen.get(i);
1645      if (t.getExtent() == extentViewer.getExtent())
1646      {
1647        te = t;
1648        break;
1649      }
1650    }
1651    if (te == null)
1652    {
1653      te = new ExtentEditor(this, extentViewer);
1654      _tabs.addTab(extentViewer.getExtent().getName(), getImageIcon("extent.gif"), te);
1655      _allEditorsOpen.add(te);
1656    }
1657    _tabs.setSelectedComponent(te);
1658    te.requestFocus();
1659    return te;
1660  }
1661
1662  public void closeCloseable(DjCloseable edt)
1663  {
1664    getPersistenceManager().rebuildDependancies();
1665    _allEditorsOpen.remove(edt);
1666    _tabs.remove((Component JavaDoc) edt);
1667    _tabs.setSelectedIndex(0);
1668    setStatusMessage(OK_MSG);
1669  }
1670
1671  void _butSave(ActionEvent JavaDoc e)
1672  {
1673    try
1674    {
1675      saveAll();
1676    }
1677    catch (Exception JavaDoc x)
1678    {
1679      setStatusMessage(x);
1680      JOptionPane.showMessageDialog(this, x.getMessage(), Messages.getString("ModelEditor.UnableToSave"),
1681                                    JOptionPane.ERROR_MESSAGE);
1682    }
1683  }
1684
1685  void editExtent()
1686  {
1687    ExtentViewer sel[] = _paintPanel.getSelectedExtentViewers();
1688    if (sel.length == 0)
1689    {
1690      setStatusMessage(Messages.getString("ModelEditor.SelectExtent2edite"));
1691      return;
1692    }
1693    for (int i = 0; i < sel.length; i++)
1694    {
1695      if (sel[i].isSelected())
1696      {
1697        editExtent(sel[i]);
1698      }
1699    }
1700    setStatusMessage(OK_MSG);
1701  }
1702
1703  void _butEdit(ActionEvent JavaDoc e)
1704  {
1705    editExtent();
1706  }
1707
1708  public DjExtent[] getExtents()
1709  {
1710    return _mgr.getExtents();
1711  }
1712
1713  void addExtentFromModel()
1714  {
1715    try
1716    {
1717      ArrayList JavaDoc all = new ArrayList JavaDoc(_mgr.getExtentsAsArrayList());
1718      for (int i = 0; i < _paintPanel.getExtentViewerCount(); i++)
1719      {
1720        all.remove(_paintPanel.getExtentViewer(i).getExtent());
1721      }
1722      if (all.size() == 0)
1723      {
1724        setStatusMessage(Messages.getString("ModelEditor.AllExtentsVisible"));
1725      }
1726      else
1727      {
1728        ExtentSelectorDialog ts = new ExtentSelectorDialog(this, Messages.getString("ModelEditor.SelectExtent(s)"),
1729            getPackages(), (DjExtent[]) all.toArray(new DjExtent[0]), _paintPanel.getSelectedExtents());
1730        ts.setVisible(true);
1731
1732        if (!ts.wasCancelled())
1733        {
1734          DjExtent[] sels = ts.getSelectedExtents();
1735          for (int i = 0; i < sels.length; i++)
1736          {
1737            ExtentViewer tv = new ExtentViewer(sels[i]);
1738            tv.setEditor(this);
1739            tv.setWidth(178);
1740            tv.setHeight(100);
1741            autoPlaceExtentViewer(tv);
1742            if (_lastPressedX != -1 && _lastPressedY != -1)
1743            {
1744              _lastPressedX += 10;
1745              _lastPressedY += 10;
1746            }
1747            else _newIncrement += 10;
1748            addExtentViewer(tv);
1749          }
1750          checkBordersAndSizes();
1751        }
1752        setStatusMessage(OK_MSG);
1753        paintViewQuickly();
1754      }
1755    }
1756    catch (Exception JavaDoc x)
1757    {
1758      setStatusMessage(x);
1759    }
1760  }
1761
1762  public DjPackage[] getPackages()
1763  {
1764    return _mgr.getPackages();
1765  }
1766
1767  void _butAdd(ActionEvent JavaDoc e)
1768  {
1769    addExtentFromModel();
1770  }
1771
1772  void createExtent()
1773  {
1774    tryLockModel();
1775    if (!isModelLocked()) return;
1776    try
1777    {
1778      String JavaDoc newName = NEW_EXTENT_PREFIX + _newCounter++;
1779      DjExtent ext = _mgr.createExtent(newName, newName, newName, newName, newName, newName, newName);
1780      ext.fixAlias();
1781      ext.createIdProperty(_mgr);
1782      _mgr.addExtent(ext);
1783      ExtentViewer tv = new ExtentViewer(ext);
1784      tv.setEditor(this);
1785      _newIncrement += 10;
1786      tv.setWidth(178);
1787      tv.setHeight(100);
1788      autoPlaceExtentViewer(tv);
1789      addExtentViewer(tv);
1790      _paintPanel.moveToFront(tv);
1791      ExtentEditor ee = editExtent(tv);
1792      ee.notifyNewExtent();
1793      _paintPanel.deselectExtentViewers();
1794      tv.setSelected(true);
1795      setStatusMessage(OK_MSG);
1796    }
1797    catch (Exception JavaDoc x)
1798    {
1799      setStatusMessage(x);
1800    }
1801    paintViewQuickly();
1802  }
1803
1804  private void autoPlaceExtentViewer(ExtentViewer tv)
1805  {
1806    if (_lastPressedX != -1 && _lastPressedY != -1)
1807    {
1808      int x = _lastPressedX;
1809      int y = _lastPressedY;
1810      if (x < _xscroller.getValue()) x = _xscroller.getValue();
1811      if (y < _yscroller.getValue()) y = _yscroller.getValue();
1812      int ww = _paintPanel.getWidth();
1813      int hh = _paintPanel.getHeight();
1814      if (x + tv.getWidth() > _xscroller.getValue() + ww) x = _xscroller.getValue() + ww - tv.getWidth();
1815      if (y + tv.getHeight() > _yscroller.getValue() + hh) y = _yscroller.getValue() + hh - tv.getHeight();
1816      tv.setX(x);
1817      tv.setY(y);
1818    }
1819    else
1820    {
1821      tv.setX(_xscroller.getValue() + 10 + _newIncrement);
1822      tv.setY(_yscroller.getValue() + 10 + _newIncrement);
1823    }
1824  }
1825
1826  void _butCreate(ActionEvent JavaDoc e)
1827  {
1828    createExtent();
1829  }
1830
1831  void deleteExtent() throws DjenericException
1832  {
1833    tryLockModel();
1834    if (!isModelLocked()) return;
1835    ExtentViewer sel[] = _paintPanel.getSelectedExtentViewers();
1836    if (sel.length == 0)
1837    {
1838      setStatusMessage(Messages.getString("ModelEditor.SelectExtent2delete"));
1839      return;
1840    }
1841    int selCount = 0;
1842    for (int i = 0; i < sel.length; i++)
1843    {
1844      if (sel[i].isSelected())
1845      {
1846        selCount++;
1847      }
1848    }
1849    boolean ask = true;
1850    for (int i = 0; i < sel.length; i++)
1851    {
1852      int OPT_DEL = 0;
1853      int OPT_ALL = 99;
1854      if (sel[i].isSelected())
1855      {
1856        String JavaDoc[] buts;
1857        if (selCount > 1)
1858        {
1859          buts = new String JavaDoc[]{Messages.getString("global.Delete"), Messages.getString("ModelEditor.AllSelected"),
1860              Messages.getString("global.Cancel")};
1861          OPT_ALL = 1;
1862        }
1863        else
1864        {
1865          buts = new String JavaDoc[]{Messages.getString("global.Delete"), Messages.getString("global.Cancel")};
1866        }
1867        int result;
1868        if (!ask)
1869        {
1870          result = OPT_DEL;
1871        }
1872        else
1873        {
1874          result = JOptionPane.showOptionDialog(this, Messages.getString("ModelEditor.AboutToDeleteExtent", sel[i]
1875              .getExtent().getName()), Messages.getString("ModelEditor.DeleteFromModel"), JOptionPane.DEFAULT_OPTION,
1876                                                JOptionPane.INFORMATION_MESSAGE, null, buts, null);
1877        }
1878        if (result == OPT_ALL)
1879        {
1880          ask = false;
1881        }
1882        if (result != OPT_ALL && result != OPT_DEL)
1883        {
1884          break;
1885        }
1886
1887        // Now check for any specifications in the repository
1888
DjSession session = null;
1889        try
1890        {
1891          session = _mgr.createSession();
1892          if (!sel[i].getExtent().isEmpty(session))
1893          {
1894            JOptionPane.showConfirmDialog(this, Messages.getString("ModelEditor.ProblemExtent", sel[i].getExtent()
1895                .getName()), Messages.getString("ModelEditor.ExtentContainsData"), JOptionPane.DEFAULT_OPTION,
1896                                          JOptionPane.WARNING_MESSAGE);
1897            continue;
1898            // continue with next extent
1899
}
1900        }
1901        catch (DjenericException x)
1902        {
1903          // deliberate fall through: ignore errors here bacause a common error
1904
// here is that the user entered a reserved wordt for an extent name
1905
// recovering from this error is kind of pointless since he tried to
1906
// delete it anyway. Take the risk of deleting an extent with data in
1907
// it for granted.
1908
// Just print the stacktrace and continue:
1909
DjLogger.log(x);
1910        }
1911        finally
1912        {
1913          if (session != null)
1914          {
1915            session.close();
1916          }
1917        }
1918        removeExtentViewer(sel[i]);
1919        _mgr.removeExtent(sel[i].getExtent());
1920      }
1921    }
1922    paintViewQuickly();
1923    setStatusMessage(OK_MSG);
1924    try
1925    {
1926      fixInvalidReferences();
1927    }
1928    catch (DjenericException de)
1929    {
1930      DjLogger.log(de);
1931      setStatusMessage(Messages.getString("ModelEditor.Warning", de.getMessage()), false);
1932    }
1933  }
1934
1935  void _butDelete(ActionEvent JavaDoc e)
1936  {
1937    try
1938    {
1939      deleteExtent();
1940    }
1941    catch (DjenericException dje)
1942    {
1943      setStatusMessage(dje);
1944    }
1945  }
1946
1947  void removeExtentFromDiagram()
1948  {
1949    ExtentViewer sel[] = _paintPanel.getSelectedExtentViewers();
1950    if (sel.length == 0)
1951    {
1952      setStatusMessage(Messages.getString("ModelEditor.SelectExtent2Hide"));
1953      return;
1954    }
1955    for (int i = 0; i < sel.length; i++)
1956    {
1957      if (sel[i].isSelected())
1958      {
1959        removeExtentViewer(sel[i]);
1960      }
1961    }
1962    paintViewQuickly();
1963    setStatusMessage(OK_MSG);
1964  }
1965
1966  void _butHideExtent(ActionEvent JavaDoc e)
1967  {
1968    removeExtentFromDiagram();
1969  }
1970
1971  public void selectAll()
1972  {
1973    if (_tabs.getSelectedIndex() != 0)
1974    {
1975      return;
1976    }
1977    for (int i = 0; i < _paintPanel.getExtentViewerCount(); i++)
1978    {
1979      _paintPanel.getExtentViewer(i).setSelected(true);
1980    }
1981    paintViewQuickly();
1982  }
1983
1984  public void keyPressed(KeyEvent JavaDoc e)
1985  {
1986    if ((e.getKeyCode() == KeyEvent.VK_A) && ((e.getModifiers() & InputEvent.CTRL_MASK) != 0))
1987    {
1988      selectAll();
1989    }
1990    else if ((e.getKeyCode() == KeyEvent.VK_ESCAPE) && _inRelationAddMode)
1991    {
1992      cancelRelationAddMode();
1993    }
1994  }
1995
1996  public void keyTyped(KeyEvent JavaDoc e)
1997  {
1998    if (_tabs.getComponentCount() == 0)
1999    {
2000      return;
2001    }
2002    else if ((e.getKeyCode() == KeyEvent.VK_F6) && ((e.getModifiers() & InputEvent.SHIFT_MASK) != 0)
2003             && ((e.getModifiers() & InputEvent.CTRL_MASK) != 0))
2004    {
2005      prevTab();
2006    }
2007    else if ((e.getKeyCode() == KeyEvent.VK_F6) && ((e.getModifiers() & InputEvent.CTRL_MASK) != 0))
2008    {
2009      nextTab();
2010    }
2011    else if ((e.getKeyCode() == KeyEvent.VK_F4) && ((e.getModifiers() & InputEvent.CTRL_MASK) != 0))
2012    {
2013      closeTab();
2014    }
2015  }
2016
2017  protected void prevTab()
2018  {
2019    int idx = _tabs.getSelectedIndex();
2020    if (idx == -1) return;
2021    if (idx > 0)
2022    {
2023      idx--;
2024    }
2025    else
2026    {
2027      idx = _tabs.getComponentCount() - 1;
2028    }
2029    _tabs.setSelectedIndex(idx);
2030  }
2031
2032  protected void nextTab()
2033  {
2034    int idx = _tabs.getSelectedIndex();
2035    if (idx == -1) return;
2036    if (idx < _tabs.getComponentCount() - 1)
2037    {
2038      idx++;
2039    }
2040    else
2041    {
2042      idx = 0;
2043    }
2044    _tabs.setSelectedIndex(idx);
2045  }
2046
2047  protected void closeTab()
2048  {
2049    if (_tabs.getSelectedComponent() instanceof ExtentEditor)
2050    {
2051      ExtentEditor te = (ExtentEditor) _tabs.getSelectedComponent();
2052      if (te.canClose())
2053      {
2054        closeCloseable(te);
2055      }
2056    }
2057    else if (_tabs.getSelectedComponent() instanceof DomainEditor)
2058    {
2059      _butDomains(null);
2060      // let the button handle the stuff
2061
}
2062    else if (_tabs.getSelectedComponent() instanceof ViewEditor)
2063    {
2064      _butViewEditor(null);
2065      // let the button handle the stuff
2066
}
2067    else if (_tabs.getSelectedIndex() != 0)
2068    {
2069      _tabs.remove(_tabs.getSelectedIndex());
2070    }
2071  }
2072
2073  public void keyReleased(KeyEvent JavaDoc e)
2074  {
2075  }
2076
2077  public boolean isModified() throws DjenericException
2078  {
2079    String JavaDoc now = getViewDefinition();
2080
2081    // try
2082
// {
2083
// FileWriter fw = new FileWriter("c:\\now.txt");
2084
// fw.write(now);
2085
// fw.close();
2086
//
2087
// fw = new FileWriter("c:\\org.txt");
2088
// fw.write(_originalViewDefinition);
2089
// fw.close();
2090
// }
2091
// catch (IOException e)
2092
// {
2093
// DjLogger.log(e);
2094
// }
2095

2096    return !_originalViewDefinition.equals(now);
2097  }
2098
2099  void _butColor(ActionEvent JavaDoc e)
2100  {
2101    boolean atLeastOne = false;
2102    ExtentViewer sel[] = _paintPanel.getSelectedExtentViewers();
2103    ExtentViewer theOne = null;
2104    for (int i = 0; i < sel.length; i++)
2105    {
2106      if (sel[i].isSelected())
2107      {
2108        atLeastOne = true;
2109        theOne = sel[i];
2110      }
2111    }
2112    if (atLeastOne)
2113    {
2114      ColorChooserDialog cd = new ColorChooserDialog(this);
2115      cd.setNameColor(theOne.getNameColor());
2116      cd.setExtentColor(theOne.getExtentColor());
2117      cd.setPropertyColor(theOne.getPropertyColor());
2118      cd.setVisible(true);
2119      if (!cd.isCancelled())
2120      {
2121        for (int i = 0; i < sel.length; i++)
2122        {
2123          if (sel[i].isSelected())
2124          {
2125            sel[i].setExtentColor(cd.getExtentColor());
2126            sel[i].setNameColor(cd.getNameColor());
2127            sel[i].setPropertyColor(cd.getPropertyColor());
2128          }
2129        }
2130      }
2131      paintViewQuickly();
2132    }
2133  }
2134
2135  void _butPrint(ActionEvent JavaDoc e)
2136  {
2137    printDiagram();
2138  }
2139
2140  public void printDiagram()
2141  {
2142    PrinterJob JavaDoc printerJob = PrinterJob.getPrinterJob();
2143    if (printerJob.printDialog())
2144    {
2145      try
2146      {
2147        PageFormat JavaDoc pf = printerJob.pageDialog(printerJob.defaultPage());
2148        double curScale = _paintPanel.getScale();
2149        try
2150        {
2151          _paintPanel.setScale(1.0);
2152          printerJob.setPrintable(_paintPanel, pf);
2153          printerJob.print();
2154        }
2155        finally
2156        {
2157          _paintPanel.setScale(curScale);
2158        }
2159        setStatusMessage(Messages.getString("ModelEditor.PrintingDone"));
2160      }
2161      catch (Exception JavaDoc x)
2162      {
2163        setStatusMessage(x);
2164      }
2165    }
2166  }
2167
2168  void _zoomSlider_stateChanged(ChangeEvent JavaDoc e)
2169  {
2170    _paintPanel.setScale(((double) _zoomSlider.getValue()) / 100);
2171    checkBordersAndSizes();
2172    paintViewQuickly();
2173  }
2174
2175  public void cancelRelationAddMode()
2176  {
2177    _paintPanel.clearRelationLine();
2178    _inRelationAddMode = false;
2179    setStatusMessage(Messages.getString("ModelEditor.Cancelled"));
2180    paintViewQuickly();
2181  }
2182
2183  void addRelation()
2184  {
2185    tryLockModel();
2186    if (!isModelLocked()) return;
2187    _relationMaster = null;
2188    if (_inRelationAddMode) cancelRelationAddMode();
2189    else _inRelationAddMode = true;
2190    if (_inRelationAddMode)
2191    {
2192      setStatusMessage(Messages.getString("ModelEditor.ClickMasterExtent"));
2193      _paintPanel.deselectExtentViewers();
2194    }
2195    paintViewQuickly();
2196  }
2197
2198  void _butAddRelation(ActionEvent JavaDoc e)
2199  {
2200    addRelation();
2201  }
2202
2203  public boolean closeDomainsPanel()
2204  {
2205    Component JavaDoc[] comps = _tabs.getComponents();
2206    for (int i = 0; i < comps.length; i++)
2207    {
2208      if (comps[i] instanceof DomainEditor)
2209      {
2210        DomainEditor cp = (DomainEditor) comps[i];
2211        cp.cleanup();
2212        _tabs.remove(comps[i]);
2213        _butDomains.setIcon(getImageIcon("domain.gif"));
2214        return true;
2215      }
2216    }
2217    return false;
2218  }
2219
2220  public void openDomainsPanel()
2221  {
2222    tryLockModel();
2223    DomainEditor pnlDomains = new DomainEditor(this);
2224    _tabs.addTab(Messages.getString("global.Domains"), getImageIcon("domain.gif"), pnlDomains);
2225    _tabs.setSelectedComponent(pnlDomains);
2226    pnlDomains.requestFocus();
2227    _butDomains.setIcon(getImageIcon("nodomain.gif"));
2228  }
2229
2230  public void toggleDomainsPanel()
2231  {
2232    try
2233    {
2234      if (!closeDomainsPanel())
2235      {
2236        openDomainsPanel();
2237      }
2238      setStatusMessage(OK_MSG);
2239    }
2240    catch (Exception JavaDoc x)
2241    {
2242      setStatusMessage(x);
2243    }
2244  }
2245
2246  void _butDomains(ActionEvent JavaDoc e)
2247  {
2248    toggleDomainsPanel();
2249  }
2250
2251  void _paintPanel_mouseMoved(MouseEvent JavaDoc e)
2252  {
2253    if (_inRelationAddMode && _relationMaster != null)
2254    {
2255      int x = _paintPanel.getRealX(e.getX());
2256      int y = _paintPanel.getRealY(e.getY());
2257      _paintPanel.setRelationLine(_relationMaster, x, y);
2258      paintViewQuickly();
2259    }
2260  }
2261
2262  protected void createRelation(ExtentViewer master, ExtentViewer detail)
2263  {
2264    new CreateRelationDialog(this, master.getExtent(), detail.getExtent());
2265    _inRelationAddMode = false;
2266    _paintPanel.clearRelationLine();
2267    paintViewQuickly();
2268    setStatusMessage(OK_MSG);
2269  }
2270
2271  public void toggleViewDefinitionPanel()
2272  {
2273    try
2274    {
2275      Component JavaDoc[] comps = _tabs.getComponents();
2276      for (int i = 0; i < comps.length; i++)
2277      {
2278        if (comps[i] instanceof ViewEditor)
2279        {
2280          _tabs.remove(comps[i]);
2281          _butViewEditor.setIcon(getImageIcon("modelview.gif"));
2282          return;
2283        }
2284      }
2285      _tabs.addTab(Messages.getString("ModelEditor.UserPerspective"), getImageIcon("modelview.gif"), _viewEditor);
2286      _tabs.setSelectedComponent(_viewEditor);
2287      _viewEditor.requestFocus();
2288      _butViewEditor.setIcon(getImageIcon("nomodelview.gif"));
2289      setStatusMessage(OK_MSG);
2290    }
2291    catch (Exception JavaDoc x)
2292    {
2293      setStatusMessage(x);
2294    }
2295  }
2296
2297  void _butViewEditor(ActionEvent JavaDoc e)
2298  {
2299    toggleViewDefinitionPanel();
2300  }
2301
2302  public ViewEditor getViewEditor()
2303  {
2304    return _viewEditor;
2305  }
2306
2307  void mnuExit(ActionEvent JavaDoc e)
2308  {
2309    try
2310    {
2311      if (canExit())
2312      {
2313        cleanup();
2314        System.exit(0);
2315      }
2316    }
2317    catch (Exception JavaDoc x)
2318    {
2319      setStatusMessage(x);
2320    }
2321  }
2322
2323  void mnuSave(ActionEvent JavaDoc e)
2324  {
2325    _butSave(null);
2326  }
2327
2328  private void mnuExportPng(ActionEvent JavaDoc e)
2329  {
2330    try
2331    {
2332      JFileChooser JavaDoc fc = new JFileChooser JavaDoc();
2333      fc.setDialogTitle(Messages.getString("ModelEditor.ExportDiagram"));
2334      initFileChooser(fc);
2335      fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
2336      if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION)
2337      {
2338        String JavaDoc fileName = fc.getSelectedFile().getAbsolutePath();
2339        if (!fileName.toLowerCase().endsWith(".png"))
2340        {
2341          fileName += ".png";
2342        }
2343        ByteArrayOutputStream JavaDoc boutstream = new ByteArrayOutputStream JavaDoc();
2344        ImageIO.write(_paintPanel.getDiagramImage(), "png", boutstream);
2345        FileOutputStream JavaDoc fimage = new FileOutputStream JavaDoc(new File JavaDoc(fileName));
2346        boutstream.writeTo(fimage);
2347        fimage.close();
2348        setStatusMessage(Messages.getString("ModelEditor.PngExported", fileName));
2349      }
2350    }
2351    catch (Exception JavaDoc x)
2352    {
2353      setStatusMessage(x);
2354    }
2355  }
2356
2357  protected void initFileChooser(JFileChooser JavaDoc fc)
2358  {
2359    fc.setCurrentDirectory(new File JavaDoc(getProperty("filelocation", System.getProperties().getProperty("user.dir"))));
2360  }
2361
2362  protected void recordFileChooserSettings(JFileChooser JavaDoc fc)
2363  {
2364    setProperty("filelocation", fc.getCurrentDirectory().getAbsolutePath());
2365  }
2366
2367  public void exportModelToFile() throws Exception JavaDoc
2368  {
2369    try
2370    {
2371
2372      ExportSelectionDialog esd = new ExportSelectionDialog(this, _mgr.getExtents(), true, true);
2373      if (esd.wasCanceled()) return;
2374
2375      DjExtent[] selection = esd.getSelectedExtents();
2376      // if (selection.length == 0)
2377
// {
2378
// setStatusMessage(Messages.getString("ModelEditor.Nothing2export"),
2379
// false);
2380
// return;
2381
// }
2382

2383      JFileChooser JavaDoc fc = new JFileChooser JavaDoc();
2384      DjFileFilter filter = new DjFileFilter(new String JavaDoc[]{MODEL_EXTENSION}, Messages
2385          .getString("ModelEditor.DjenericModel"));
2386      fc.setFileFilter(filter);
2387      fc.setDialogTitle(Messages.getString("ModelEditor.ExportModel"));
2388      initFileChooser(fc);
2389      fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
2390      if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION)
2391      {
2392        recordFileChooserSettings(fc);
2393        String JavaDoc fileName = fc.getSelectedFile().getAbsolutePath();
2394        if (!fileName.toLowerCase().endsWith("." + MODEL_EXTENSION))
2395        {
2396          fileName += "." + MODEL_EXTENSION;
2397        }
2398        File JavaDoc chk = new File JavaDoc(fileName);
2399        if (chk.exists())
2400        {
2401          if (!Util.isOkToOverwrite(this, chk))
2402          {
2403            return;
2404          }
2405        }
2406
2407        DjDomain[] domains;
2408        if (esd.shouldAddAllDomains()) domains = _mgr.getDomains();
2409        else domains = _mgr.getDomainsUsed(selection);
2410
2411        BufferedWriter JavaDoc w = new BufferedWriter JavaDoc(new FileWriter JavaDoc(fileName));
2412        w.write(_mgr.getModel(selection, domains));
2413        w.close();
2414        setStatusMessage(Messages.getString("ModelEditor.ModelExportedTo", fileName));
2415      }
2416    }
2417    catch (Exception JavaDoc x)
2418    {
2419      setStatusMessage(x.getMessage());
2420    }
2421  }
2422
2423  public void importModelFromFile(boolean mergeModel, boolean replaceExisting) throws Exception JavaDoc
2424  {
2425    lockModel();
2426    try
2427    {
2428      JFileChooser JavaDoc fc = new JFileChooser JavaDoc();
2429      initFileChooser(fc);
2430      DjFileFilter filter = new DjFileFilter(new String JavaDoc[]{MODEL_EXTENSION}, Messages
2431          .getString("ModelEditor.DjenericModel"));
2432      fc.setFileFilter(filter);
2433      fc.setDialogTitle(Messages.getString("ModelEditor.ImportModel"));
2434      fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
2435      if (fc.showOpenDialog(this) != JFileChooser.CANCEL_OPTION)
2436      {
2437        recordFileChooserSettings(fc);
2438        String JavaDoc fileName = fc.getSelectedFile().getAbsolutePath();
2439        File JavaDoc inFile = new File JavaDoc(fileName);
2440        BufferedReader JavaDoc br = new BufferedReader JavaDoc(new FileReader JavaDoc(inFile));
2441        StringBuffer JavaDoc src = new StringBuffer JavaDoc(10000);
2442        String JavaDoc ln;
2443        while ((ln = br.readLine()) != null)
2444        {
2445          src.append(ln);
2446          src.append("\n");
2447        }
2448        br.close();
2449        if (mergeModel) _mgr.mergeModel(src.toString(), replaceExisting);
2450        else _mgr.setModel(src.toString());
2451
2452        String JavaDoc log = _mgr.getSchemaLoadLog();
2453        if (log.length() > 0)
2454        {
2455          showTextTab(Messages.getString("ModelEditor.LoadLog"), log, getImageIcon("check.gif"));
2456        }
2457        paintView();
2458        setStatusMessage(OK_MSG);
2459      }
2460    }
2461    catch (Exception JavaDoc x)
2462    {
2463      setStatusMessage(x.getMessage());
2464    }
2465  }
2466
2467  public void exportViewToFile() throws Exception JavaDoc
2468  {
2469    try
2470    {
2471      JFileChooser JavaDoc fc = new JFileChooser JavaDoc();
2472      initFileChooser(fc);
2473      fc.setDialogTitle(Messages.getString("ModelEditor.ExportView"));
2474      DjFileFilter filter = new DjFileFilter(new String JavaDoc[]{VIEW_EXTENSION}, Messages
2475          .getString("ModelEditor.DjenericView"));
2476      fc.setFileFilter(filter);
2477      fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
2478      if (_theView != null && _theView.getCode().length() > 0)
2479      {
2480        fc.setSelectedFile(new File JavaDoc(_theView.getCode() + "." + VIEW_EXTENSION));
2481      }
2482      if (fc.showSaveDialog(this) != JFileChooser.CANCEL_OPTION)
2483      {
2484        recordFileChooserSettings(fc);
2485        String JavaDoc fileName = fc.getSelectedFile().getAbsolutePath();
2486        if (!fileName.toLowerCase().endsWith("." + VIEW_EXTENSION))
2487        {
2488          fileName += "." + VIEW_EXTENSION;
2489        }
2490        File JavaDoc chk = new File JavaDoc(fileName);
2491        if (chk.exists())
2492        {
2493          if (!Util.isOkToOverwrite(this, chk))
2494          {
2495            return;
2496          }
2497        }
2498        BufferedWriter JavaDoc w = new BufferedWriter JavaDoc(new FileWriter JavaDoc(fileName));
2499        ModelDocumentHandler dh = new ModelDocumentHandler();
2500        w.write(dh.createXmlString(this));
2501        w.close();
2502        setStatusMessage(Messages.getString("ModelEditor.ViewExportedTo", fileName));
2503      }
2504    }
2505    catch (Exception JavaDoc x)
2506    {
2507      setStatusMessage(x.getMessage());
2508    }
2509  }
2510
2511  public void importViewFromFile() throws Exception JavaDoc
2512  {
2513    try
2514    {
2515      JFileChooser JavaDoc fc = new JFileChooser JavaDoc();
2516      initFileChooser(fc);
2517      DjFileFilter filter = new DjFileFilter(new String JavaDoc[]{VIEW_EXTENSION}, Messages
2518          .getString("ModelEditor.DjenericView"));
2519      fc.setFileFilter(filter);
2520      fc.setDialogTitle(Messages.getString("ModelEditor.ImportView"));
2521      fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
2522      if (fc.showOpenDialog(this) != JFileChooser.CANCEL_OPTION)
2523      {
2524        recordFileChooserSettings(fc);
2525        String JavaDoc fileName = fc.getSelectedFile().getAbsolutePath();
2526        File JavaDoc inFile = new File JavaDoc(fileName);
2527        BufferedReader JavaDoc br = new BufferedReader JavaDoc(new FileReader JavaDoc(inFile));
2528        StringBuffer JavaDoc src = new StringBuffer JavaDoc(10000);
2529        String JavaDoc ln;
2530        while ((ln = br.readLine()) != null)
2531        {
2532          src.append(ln);
2533          src.append("\n");
2534        }
2535        br.close();
2536        loadView(src.toString());
2537        paintView();
2538        setStatusMessage(OK_MSG);
2539      }
2540    }
2541    catch (Exception JavaDoc x)
2542    {
2543      setStatusMessage(x.getMessage());
2544    }
2545  }
2546
2547  protected void saveAs() throws Exception JavaDoc
2548  {
2549    DjModelView org = _theView;
2550    try
2551    {
2552      _theView = _mgr.createModelView();
2553      _theView.setDefinition(org.getDefinition());
2554      saveAll();
2555    }
2556    catch (Exception JavaDoc x)
2557    {
2558      _theView = org;
2559      throw x;
2560    }
2561  }
2562
2563  public void saveAll() throws Exception JavaDoc
2564  {
2565    boolean modelWasLocked = _mgr.isModelLocked();
2566    if (_viewEditor.hasEditorsOpen())
2567    {
2568      int result = JOptionPane.showOptionDialog(this, Messages.getString("ModelEditor.EditorOpen"), Messages
2569          .getString("ModelEditor.EditorOrScriptNotApplied"), JOptionPane.DEFAULT_OPTION,
2570                                                JOptionPane.INFORMATION_MESSAGE, null, new String JavaDoc[]{
2571                                                    Messages.getString("ModelEditor.SaveAnyway"),
2572                                                    Messages.getString("global.Cancel")}, null);
2573      if (result != 0)
2574      {
2575        setStatusMessage(Messages.getString("ModelEditor.NOTSaved"), false);
2576        return;
2577      }
2578    }
2579    fixInvalidReferences();
2580    String JavaDoc saved2Message = null;
2581    saveModel();
2582    if (_theView.isUntitled())
2583    {
2584      SaveAsDialog sa = new SaveAsDialog(this, _theView);
2585      sa.setViewName(_lastOpenedViewName);
2586      sa.execute();
2587      // A save as might change the view so assignment is imperative
2588
_theView = sa.getModelView();
2589    }
2590    if (!_viewEditor.isVersionSafeToSave())
2591    {
2592      int result = JOptionPane.showOptionDialog(this, Messages.getString("ModelEditor.OldViewVersion"), Messages
2593          .getString("ModelEditor.ViewVersionDowngrade"), JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE,
2594                                                null, new String JavaDoc[]{Messages.getString("global.Save"),
2595                                                    Messages.getString("global.Cancel")}, null);
2596      if (result != 0) return;
2597    }
2598    String JavaDoc xmlString = getViewDefinition();
2599    _theView.setDefinition(xmlString);
2600    DjSession session = _mgr.createSession();
2601    try
2602    {
2603      if (_theView.isModifiedExternally(session))
2604      {
2605        int result = JOptionPane.showOptionDialog(this, Messages.getString("ModelEditor.SomebodyHasUpdated"), Messages
2606            .getString("ModelEditor.ViewModifiedExternally"), JOptionPane.DEFAULT_OPTION,
2607                                                  JOptionPane.INFORMATION_MESSAGE, null, new String JavaDoc[]{
2608                                                      Messages.getString("global.Overwrite"),
2609                                                      Messages.getString("global.Cancel")}, null);
2610        if (result != 0)
2611        {
2612          setStatusMessage(Messages.getString("ModelEditor.SaveCancelled"));
2613          return;
2614        }
2615      }
2616      _theView.persist(session);
2617      session.commit();
2618      _originalViewDefinition = xmlString;
2619    }
2620    finally
2621    {
2622      session.close();
2623    }
2624    saved2Message = Messages.getString("ModelEditor.SavedTo", _theView.getCode());
2625    if (modelWasLocked) qualityCheck(true);
2626    if (saved2Message != null) setStatusMessage(saved2Message);
2627    updateTitle();
2628  }
2629
2630  protected String JavaDoc getViewDefinition() throws DjenericException
2631  {
2632    try
2633    {
2634      ModelDocumentHandler dh = new ModelDocumentHandler();
2635      return dh.createXmlString(this);
2636    }
2637    catch (Exception JavaDoc x)
2638    {
2639      throw new DjenericException(x);
2640    }
2641  }
2642
2643  public void saveModel() throws Exception JavaDoc
2644  {
2645    // If the model is not locked; don't save it
2646

2647    if (!_mgr.isModelLocked())
2648    {
2649      DjLogger.log(Messages.getString("ModelEditor.NotSavedNoLock"));
2650      return;
2651    }
2652    validateModel(true);
2653    if (!_mgr.isVersionSafeToSave())
2654    {
2655      int result = JOptionPane.showOptionDialog(this, Messages.getString("ModelEditor.NewerModel"), Messages
2656          .getString("ModelEditor.VersionDowngrade"), JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE,
2657                                                null, new String JavaDoc[]{Messages.getString("global.Save"),
2658                                                    Messages.getString("global.Cancel")}, null);
2659      if (result != 0) return;
2660    }
2661    _mgr.saveModel();
2662
2663    // Only release the lock if there is no editor open
2664
if (!isAnyEditorOpen()) unlockModel();
2665    setStatusMessage(Messages.getString("ModelEditor.ModelSaved"));
2666  }
2667
2668  void mnuNewView(ActionEvent JavaDoc e)
2669  {
2670    newView();
2671    paintView();
2672  }
2673
2674  void mnuImportModel(ActionEvent JavaDoc e)
2675  {
2676    ImportModeDialog imd = new ImportModeDialog(this);
2677    if (imd.wasCanceled()) return;
2678
2679    try
2680    {
2681      if (imd.getMode() == ImportModeDialog.REPLACE_ALL) importCompleteModel();
2682      else
2683      {
2684        boolean overwriteExisting = (imd.getMode() == ImportModeDialog.MERGE_OVERWRITE);
2685        importModelFromFile(true, overwriteExisting);
2686      }
2687    }
2688    catch (Exception JavaDoc x)
2689    {
2690      setStatusMessage(x);
2691      JOptionPane.showMessageDialog(this, x.getMessage() + "\n" + Messages.getString("ModelEditor.ImportedButNotSaved")
2692                                          + Messages.getString("ModelEditor.PleaseCorrectBeforeSaving"), Messages
2693          .getString("ModelEditor.SeriousImportWarnings"), JOptionPane.ERROR_MESSAGE);
2694    }
2695  }
2696
2697  private void importCompleteModel() throws Exception JavaDoc
2698  {
2699    int result = JOptionPane.showOptionDialog(this, Messages.getString("ModelEditor.About2Import"), Messages
2700        .getString("ModelEditor.DiscardCurrentModel"), JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null,
2701                                              new String JavaDoc[]{Messages.getString("ModelEditor.ImportNewModel"),
2702                                                  Messages.getString("global.Cancel")}, null);
2703    if (result != 0) return;
2704    newView();
2705    importModelFromFile(false, false);
2706    validateModel(true);
2707  }
2708
2709  void mnuExportModel(ActionEvent JavaDoc e)
2710  {
2711    try
2712    {
2713      validateModel(true);
2714      exportModelToFile();
2715    }
2716    catch (Exception JavaDoc x)
2717    {
2718      setStatusMessage(x);
2719    }
2720  }
2721
2722  void mnuExportView(ActionEvent JavaDoc e)
2723  {
2724    try
2725    {
2726      validateModel(true);
2727      exportViewToFile();
2728    }
2729    catch (Exception JavaDoc x)
2730    {
2731      setStatusMessage(x);
2732    }
2733  }
2734
2735  void mnuImportView(ActionEvent JavaDoc e)
2736  {
2737    try
2738    {
2739      if (_paintPanel.getExtentViewerCount() != 0)
2740      {
2741        if (!isOkToAbandon())
2742        {
2743          return;
2744        }
2745      }
2746      importViewFromFile();
2747    }
2748    catch (Exception JavaDoc x)
2749    {
2750      setStatusMessage(x);
2751    }
2752  }
2753
2754  void mnuSaveAs(ActionEvent JavaDoc e)
2755  {
2756    try
2757    {
2758      saveAs();
2759    }
2760    catch (Exception JavaDoc x)
2761    {
2762      setStatusMessage(x);
2763    }
2764  }
2765
2766  void mnuOpenView(ActionEvent JavaDoc e)
2767  {
2768    try
2769    {
2770      if (_viewEditor.hasEditorsOpen())
2771      {
2772        JOptionPane.showOptionDialog(this, Messages.getString("ModelEditor.EditorOpenPleaseClose"), Messages
2773            .getString("ModelEditor.EditorOrScriptNotApplied"), JOptionPane.DEFAULT_OPTION,
2774                                     JOptionPane.INFORMATION_MESSAGE, null, new String JavaDoc[]{Messages
2775                                         .getString("global.Cancel")}, null);
2776        return;
2777      }
2778      if (_paintPanel.getExtentViewerCount() != 0)
2779      {
2780        if (!isOkToAbandon())
2781        {
2782          return;
2783        }
2784      }
2785      OpenDialog od = new OpenDialog(this);
2786      _theView = od.getModelView();
2787      _lastOpenedViewName = _theView.getCode();
2788      String JavaDoc xmlString = _theView.getDefinition();
2789      loadView(xmlString);
2790      _originalViewDefinition = xmlString;
2791
2792      paintView();
2793      updateTitle();
2794      setStatusMessage(Messages.getString("global.Ok"));
2795    }
2796    catch (Exception JavaDoc x)
2797    {
2798      setStatusMessage(x);
2799    }
2800  }
2801
2802  void mnuSaveModel(ActionEvent JavaDoc e)
2803  {
2804    try
2805    {
2806      saveModel();
2807    }
2808    catch (Exception JavaDoc x)
2809    {
2810      setStatusMessage(x);
2811    }
2812  }
2813
2814  void _status_mouseClicked(MouseEvent JavaDoc e)
2815  {
2816    if (e.getClickCount() > 1)
2817    {
2818      StringBuffer JavaDoc buf = new StringBuffer JavaDoc(_lblStatus.getText().length() + 10);
2819      buf.append(_lblStatus.getText());
2820      int count = 0;
2821      for (int i = 0; i < buf.length(); i++)
2822      {
2823        if (buf.charAt(i) == ' ' && count > 50)
2824        {
2825          buf.setCharAt(i, '\n');
2826          count = 0;
2827        }
2828        count++;
2829      }
2830      JOptionPane.showMessageDialog(this, buf.toString(), Messages.getString("ModelEditor.Status"),
2831                                    JOptionPane.WARNING_MESSAGE);
2832    }
2833  }
2834
2835  void mnuShowClass(ActionEvent JavaDoc e)
2836  {
2837    _paintPanel.setViewMode(PaintPanel.SHOW_CLASS);
2838    paintView();
2839  }
2840
2841  void mnuShowAlias(ActionEvent JavaDoc e)
2842  {
2843    _paintPanel.setViewMode(PaintPanel.SHOW_ALIAS);
2844    paintView();
2845  }
2846
2847  void mnuShowQualified(ActionEvent JavaDoc e)
2848  {
2849    _paintPanel.setViewMode(PaintPanel.SHOW_QUALIFIED);
2850    paintView();
2851  }
2852
2853  void mnuShowExtent(ActionEvent JavaDoc e)
2854  {
2855    _paintPanel.setViewMode(PaintPanel.SHOW_EXTENT);
2856    paintView();
2857  }
2858
2859  void mnuPrintDiagram(ActionEvent JavaDoc e)
2860  {
2861    printDiagram();
2862  }
2863
2864  void mnuAbout(ActionEvent JavaDoc e)
2865  {
2866    new AboutDialog(this);
2867  }
2868
2869  void mnuScript(ActionEvent JavaDoc e)
2870  {
2871    new SchemaGeneratorDlg(this);
2872  }
2873
2874  void mnuQualityCheck(ActionEvent JavaDoc e)
2875  {
2876    try
2877    {
2878      qualityCheck(false);
2879    }
2880    catch (Exception JavaDoc x)
2881    {
2882      setStatusMessage(x);
2883    }
2884  }
2885
2886  private void qualityCheck(boolean ingoreIfNoErrors) throws IOException JavaDoc
2887  {
2888    ModelChecker mc = new ModelChecker();
2889    boolean allOk = mc.check(getPersistenceManager());
2890    if (ingoreIfNoErrors && allOk) return;
2891    showTextTab(Messages.getString("ModelEditor.QualityCheck1"), mc.getReport(), getImageIcon("check.gif"));
2892  }
2893
2894  private void showTextTab(String JavaDoc title, String JavaDoc text, ImageIcon JavaDoc imageIcon)
2895  {
2896    CloseableScrollPane scr = new CloseableScrollPane(_tabs);
2897    JTextArea JavaDoc ta = new JTextArea JavaDoc();
2898    ta.setFont(new java.awt.Font JavaDoc("Monospaced", 0, 11));
2899    ta.setEditable(false);
2900    scr.getViewport().add(ta);
2901    _tabs.addTab(title, imageIcon, scr);
2902    ta.setText(text);
2903    ta.setCaretPosition(0);
2904    _tabs.setSelectedComponent(scr);
2905  }
2906
2907  private void describeModel()
2908  {
2909    ModelDescriber md = new ModelDescriber();
2910    md.describe(getPersistenceManager());
2911    showTextTab(Messages.getString("ModelEditor.ModelDescription"), md.getDescription(), getImageIcon("check.gif"));
2912  }
2913
2914  void mnuRemoveTab(ActionEvent JavaDoc e)
2915  {
2916    closeTab();
2917  }
2918
2919  void mnuNextTab(ActionEvent JavaDoc e)
2920  {
2921    nextTab();
2922  }
2923
2924  void mnuPrevTab(ActionEvent JavaDoc e)
2925  {
2926    prevTab();
2927  }
2928
2929  void mnuValidateRepository(ActionEvent JavaDoc e)
2930  {
2931    try
2932    {
2933      CloseableScrollPane scr = new CloseableScrollPane(_tabs);
2934      JTextArea JavaDoc ta = new JTextArea JavaDoc();
2935      ta.setEditable(false);
2936      scr.getViewport().add(ta);
2937      _tabs.addTab(Messages.getString("ModelEditor.RepositoryContentsValidation"), getImageIcon("check.gif"), scr);
2938      String JavaDoc[] report = _mgr.validateRepositoryContents(this);
2939      for (int i = 0; i < report.length; i++)
2940      {
2941        ta.append(report[i] + "\n");
2942      }
2943      if (report.length == 0)
2944      {
2945        ta.setText(Messages.getString("ModelEditor.NoProblems"));
2946      }
2947      _tabs.setSelectedComponent(scr);
2948    }
2949    catch (Exception JavaDoc x)
2950    {
2951      setStatusMessage(x);
2952    }
2953  }
2954
2955  void mnuNewRelation(ActionEvent JavaDoc e)
2956  {
2957    addRelation();
2958  }
2959
2960  void mnuEditExtent(ActionEvent JavaDoc e)
2961  {
2962    if (isDiagramVisible()) editExtent();
2963  }
2964
2965  void mnuNewExtent(ActionEvent JavaDoc e)
2966  {
2967    if (isDiagramVisible()) createExtent();
2968  }
2969
2970  void mnuDeleteExtent(ActionEvent JavaDoc e)
2971  {
2972    if (isDiagramVisible())
2973    {
2974      try
2975      {
2976        deleteExtent();
2977      }
2978      catch (DjenericException dje)
2979      {
2980        setStatusMessage(dje);
2981      }
2982    }
2983  }
2984
2985  void mnuAddExtentFromModel(ActionEvent JavaDoc e)
2986  {
2987    if (isDiagramVisible()) addExtentFromModel();
2988  }
2989
2990  void mnuHideExtent(ActionEvent JavaDoc e)
2991  {
2992    removeExtentFromDiagram();
2993  }
2994
2995  void mnuDomains(ActionEvent JavaDoc e)
2996  {
2997    toggleDomainsPanel();
2998  }
2999
3000  void mnuPackages(ActionEvent JavaDoc e)
3001  {
3002    new PackageEditorDialog(_mgr);
3003  }
3004
3005  void mnuRoles(ActionEvent JavaDoc e)
3006  {
3007    new RoleEditorDialog(_mgr);
3008  }
3009
3010  void mnuDefineEditors(ActionEvent JavaDoc e)
3011  {
3012    toggleViewDefinitionPanel();
3013  }
3014
3015  void mnuReloadModel(ActionEvent JavaDoc e)
3016  {
3017    try
3018    {
3019      reloadModel();
3020    }
3021    catch (Exception JavaDoc x)
3022    {
3023      setStatusMessage(x);
3024    }
3025  }
3026
3027  protected void reloadModel() throws DjenericException
3028  {
3029    if (_mgr.isModelModified())
3030    {
3031      int result = JOptionPane.showOptionDialog(this, Messages.getString("ModelEditor.DiscardChanges"), Messages
3032          .getString("ModelEditor.ReloadModel"), JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null,
3033                                                new String JavaDoc[]{Messages.getString("global.Discard"),
3034                                                    Messages.getString("global.Cancel")}, null);
3035      if (result != 0)
3036      {
3037        return;
3038      }
3039    }
3040    unlockModel();
3041    String JavaDoc currentView = getViewDefinition();
3042    _mgr.loadModel();
3043    loadView(currentView);
3044    _paintPanel.synchronize();
3045    closeDomainsPanel();
3046    repaint();
3047  }
3048
3049  void mnuModelHistory(ActionEvent JavaDoc e)
3050  {
3051    tryLockModel();
3052    if (!isModelLocked()) return;
3053    new ModelVersionDialog(this, getPersistenceManager());
3054  }
3055
3056  void mnuKeyHelp(ActionEvent JavaDoc e)
3057  {
3058    JOptionPane.showMessageDialog(this, Messages.getString("ModelEditor.GridKeys")
3059                                        + Messages.getString("ModelEditor.DelRow")
3060                                        + Messages.getString("ModelEditor.InDiag")
3061                                        + Messages.getString("ModelEditor.SeeMenuForShotcuts"), Messages
3062        .getString("ModelEditor.KeyboardMappings1"), JOptionPane.INFORMATION_MESSAGE);
3063  }
3064
3065  void mnuSelectAll(ActionEvent JavaDoc e)
3066  {
3067    selectAll();
3068  }
3069
3070  boolean isDiagramVisible()
3071  {
3072    return _tabs.getSelectedIndex() == 0;
3073  }
3074
3075  void mnuRemoveExtent(ActionEvent JavaDoc e)
3076  {
3077    if (isDiagramVisible()) removeExtentFromDiagram();
3078  }
3079
3080  public ArrayList JavaDoc getExtentsOnDiagram()
3081  {
3082    ArrayList JavaDoc onDiagram = new ArrayList JavaDoc();
3083    for (int i = 0; i < getExtentViewerCount(); i++)
3084      onDiagram.add(getExtentViewer(i).getExtent());
3085    return onDiagram;
3086  }
3087
3088  void _vscroller_adjustmentValueChanged(AdjustmentEvent JavaDoc e)
3089  {
3090    _paintPanel.setScrollOffsetY(-_yscroller.getValue());
3091    _paintPanel.repaint();
3092  }
3093
3094  void _hscroller_adjustmentValueChanged(AdjustmentEvent JavaDoc e)
3095  {
3096    _paintPanel.setScrollOffsetX(-_xscroller.getValue());
3097    _paintPanel.repaint();
3098  }
3099
3100  public static void main(String JavaDoc[] args)
3101  {
3102    try
3103    {
3104      DjenericTool.setLookAndFeel();
3105      if (args.length < 1)
3106      {
3107        System.out.println(Messages.getString("global.Usage", ModelEditor.class.getName()));
3108        return;
3109      }
3110      String JavaDoc banner = Messages.getString("global.Version", ModelEditor.class.getName(), DjVersion.getVersion());
3111      DjLogPrintStream.logAll(banner, LOG_FILE_NAME);
3112      System.out.println(Messages.getString("ModelEditor.Reading", args[0]));
3113      new ModelEditor(args[0]).startApp();
3114    }
3115    catch (Exception JavaDoc e)
3116    {
3117      DjLogger.log(e);
3118    }
3119  }
3120
3121  public void notifyModified()
3122  {
3123
3124  }
3125}
Popular Tags