Configurable Plug-In
Your plug-in can be configurable, meaning that an administrator can click Plug-In Properties Editor and set configuration parameters for the plug-in before running it.
A configurable plug-in implementsIConfigurableSupportPlugin, which defines a set of additional methods for initializing, setting and getting the properties.
The properties to be set are defined as an array ofPluginPropertyobjects.
Procedure
Create a variable for holding the array of properties.
privatestaticPluginProperty[]mmPluginProperties;
ImplementinitializeProperties(), which initializes the properties for this plug-in. This method is called when the Support Platform engine is started.
For example, the following defines one property calledMy Propertythat will be displayed to the administrator in an input field. The value of the property is set tochoice1
publicvoidinitializeProperties(){
mmPluginProperties=newPluginProperty[1];
String[]possibleValues1={""};
String[]selectedValues1={"choice1"};
PluginPropertyproperty1=newPluginProperty("My Property"
"Long description of my property"possibleValues1,
selectedValues1,IPluginProperty.INPUT_FIELD);
mmPluginProperties[0]=property1;
}
ImplementgetSPProperties(), which returns the properties that are configurable by the end user. The method is called when the end user chooses to configure the plug-in by clicking Plug-In Properties Editor in the Task pane.
Simply return the array of properties:
publicPluginProperty[]getSPProperties(){
returnmmPluginProperties;
}
ImplementsetSPProperties(), which sets the configurable properties. The method is passed an array ofPluginPropertyobjects, which contain the plug-in properties as configured by the end user in the plug-in properties editor.
Simply save the array of properties:
publicvoidsetProperties(PluginProperty[]plugInProperties){
mmPluginProperties=plugInProperties;
}
To retrieve the value for a property, call thegetSelectedValues()on thePluginPropertyobject for that property.