KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > form > FormEditorModule


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.form;
21
22 import java.beans.Beans JavaDoc;
23 import java.beans.Introspector JavaDoc;
24 import java.util.ArrayList JavaDoc;
25 import java.util.Arrays JavaDoc;
26 import java.util.List JavaDoc;
27 import org.openide.modules.ModuleInstall;
28
29 /**
30  * Module installation class for Form Editor
31  */

32 public class FormEditorModule extends ModuleInstall {
33
34     private static final String JavaDoc BEANINFO_PATH_AWT = "org.netbeans.modules.form.beaninfo.awt"; // NOI18N
35
private static final String JavaDoc BEANINFO_PATH_SWING = "org.netbeans.modules.form.beaninfo.swing"; // NOI18N
36

37     public void restored() {
38         Beans.setDesignTime(true);
39
40         FormPropertyEditorManager.registerEditor(
41             javax.swing.KeyStroke JavaDoc.class,
42             org.netbeans.modules.form.editors.KeyStrokeEditor.class);
43
44         // Add beaninfo search path.
45
String JavaDoc[] sp = Introspector.getBeanInfoSearchPath();
46         List JavaDoc paths = new ArrayList JavaDoc(Arrays.asList(sp));
47         if (!paths.contains(BEANINFO_PATH_AWT)) {
48             paths.add(BEANINFO_PATH_AWT);
49         }
50         if (!paths.contains(BEANINFO_PATH_SWING)) {
51             paths.add(BEANINFO_PATH_SWING);
52         }
53         Introspector.setBeanInfoSearchPath((String JavaDoc[])paths.toArray(new String JavaDoc[paths.size()]));
54     }
55
56     public void uninstalled() {
57         // Remove beaninfo search path.
58
String JavaDoc[] sp = Introspector.getBeanInfoSearchPath();
59         List JavaDoc paths = new ArrayList JavaDoc(Arrays.asList(sp));
60         paths.remove(BEANINFO_PATH_AWT);
61         paths.remove(BEANINFO_PATH_SWING);
62         Introspector.setBeanInfoSearchPath((String JavaDoc[])paths.toArray(new String JavaDoc[paths.size()]));
63     }
64
65 }
66
Popular Tags