Source code: com/memoire/editor/Editor.java
1 /**
2 * @product Alma (Atelier logiciel de modelistion et d'analyse)
3 * @file Editor.java
4 * @version 0.36
5 * @www http://www.memoire.com/guillaume-desnoix/alma/
6 * @modification $Date: 2001/12/03 16:28:08 $
7 * @author Guillaume Desnoix
8 * @email guillaume@desnoix.com
9 * @license GNU General Public License 2 (GPL2)
10 */
11
12 package com.memoire.editor;
13 import com.memoire.editor.*;
14
15
16 public abstract class Editor
17 {
18 public static final EditorInterface editor(String _editor,boolean _extern)
19 {
20 EditorInterface r=null;
21
22 try
23 {
24 // System.err.println("EDITOR="+_editor);
25
26 if(!"".equals(_editor))
27 {
28 if(!_extern)
29 {
30 try
31 {
32 String ein=Editor.class.getName()+ // "Editor"+
33 _editor.substring(0,1).toUpperCase()+
34 _editor.substring(1).toLowerCase();
35 //System.err.println(" -> "+ein);
36 Class eic=Class.forName(ein);
37 Object eii=eic.newInstance();
38 if(eii instanceof EditorInterface) r=(EditorInterface)eii;
39 else System.err.println(" -> "+eii+
40 " is not an EditorInterface.");
41 }
42 catch(Exception ex)
43 {
44 // ex.printStackTrace();
45 System.err.println(""+_editor+" can not be found."+
46 " Please verify your classpath.");
47 }
48 }
49 else
50 {
51 r=new EditorExternal(_editor);
52 }
53 }
54
55 if(r==null)
56 {
57 r=new EditorButextarea();
58 System.err.println(" -> uses default BuTextArea.");
59 }
60 }
61 catch (Exception ex)
62 { r=null; }
63
64 return r;
65 }
66 }