Source code: javax/ide/property/PropertyPageRegistry.java
1 package javax.ide.property;
2
3 import javax.ide.spi.ProviderNotFoundException;
4 import javax.ide.Service;
5
6 /**
7 * The <code>PropertyPageRegistry</code> is the registry of information
8 * describing what extension specific property pages have been added to an IDE.
9 * <p>
10 * Extensions register property page information in the extension
11 * manifest using the property-pages-hook tag. The property pages hook
12 * allows extension to declare property pages for the IDE and project
13 * preferences. Extension use the property-page object-class tag to specify
14 * the object class for which the pages are declared. For example, if the
15 * pages are for a project, extension should specify javax.ide.model.Project as
16 * the object class. If the pages are for the IDE, extension should specify
17 * javax.ide.IDE as the object class. Pages registered for the project and
18 * IDE are shown when the project and IDE preference dialogs are displayed.
19 * <p>
20 * Extensions can also use this registry * to associate pages with any object
21 * class. Doing so makes them responsiblefor providing the graphical user
22 * interface to display these pages.
23 * <p>
24 * Propety pages are associated with an object class. In general, extension
25 * writers can define pages for the IDE and/or a project.
26 */
27 public abstract class PropertyPageRegistry extends Service
28 {
29 /**
30 * Constant identifying the project class name.
31 */
32 public static final String PROJECT_CLASS_NAME = "javax.ide.model.Project";
33
34 /**
35 * Constant identifying the IDE class name.
36 */
37 public static final String IDE_CLASS_NAME = "javax.ide.IDE";
38
39 /**
40 * Get the pages associated with the specified <code>objectClassName</code>.
41 *
42 * @param objectClassName The object class whose properties will be edited by
43 * the returned property pages.
44 *
45 * @return The property pages associated with the specified
46 * <code>objectClassName</code>.
47 */
48 public abstract PropertyPage[] getPropertyPages( String objectClassName );
49
50 /**
51 * Get the project property pages. This method just calls the
52 * {@link #getPropertyPages} method passing as argument
53 * {@link #PROJECT_CLASS_NAME}.
54 *
55 * @return An array of property pages associated with a project.
56 */
57 public final PropertyPage[] getProjectPropertyPages()
58 {
59 return getPropertyPages( PROJECT_CLASS_NAME );
60 }
61
62 /**
63 * Get the IDE property pages. This method just calls the
64 * {@link #getPropertyPages} method passing as argument {@link #IDE_CLASS_NAME}.
65 *
66 * @return An array of property pages associated with the IDE.
67 */
68 public final PropertyPage[] getIDEPropertyPages()
69 {
70 return getPropertyPages( IDE_CLASS_NAME );
71 }
72
73 /**
74 * Get the property page registry implementation for this IDE.
75 *
76 * @return the property page registry implementation registered with this
77 * IDE.
78 */
79 public static PropertyPageRegistry getPropertyPageRegistry()
80 {
81 try
82 {
83 return (PropertyPageRegistry) getService( PropertyPageRegistry.class );
84 }
85 catch ( ProviderNotFoundException lnfe )
86 {
87 lnfe.printStackTrace();
88 throw new IllegalStateException( "no property page registry" );
89 }
90 }
91 }