Configure a user-defined editor to specify the Java™ code that the editor uses and to specify
configuration values and notifications used by the code.
About this task
To configure a user-defined editor for a pattern parameter,
select a Java code project and
a Java class within that project.
The code in the Java class is
run when the editor is used by a pattern user. You can create a new
code project and Java class
if required.
You can use your code project
for user-defined editor code and for Java and
PHP code to modify pattern instances. For more information about using Java and PHP to modify pattern instances,
see Modifying pattern instances by using Java or PHP. By including user-defined
editor and pattern instance modification code in the same code project
for patterns that use both types of code, you need to distribute fewer
projects to pattern users.
You can specify configuration values
when you configure your user-defined editor. These values can be used
by your user-defined editor code. For example, you can enter a list
of configuration values that are used to populate a list in your user-defined
editor.
You can select parameters in your user-defined pattern
that send change notifications to the user-defined editor. Your editor
code can use change notifications to update the value of the parameter
to which the user-defined editor is assigned when other pattern parameter
values change.
Procedure
To configure a user-defined editor, complete the following
steps:
- In the Pattern
Configuration tab of
the Pattern Authoring editor, select the parameter to which you have
assigned a user-defined editor. Click Edit.
The Edit parameter window opens.
- Click the Editor tab. In the Parameter
editor field, confirm that User-Defined Editor is
selected, then click Configure Editor.
- In the Project name field, select
the project that contains the Java code
for your user-defined editor. To create a new code project, click New
Project and complete the following steps:
- Enter a plug-in ID for the new code plug-in.
After
the plug-in is created, the plug-in ID is shown in the Projects section
of the Application Development view. The plug-in
ID is also used to identify the plug-in when you distribute it to
pattern users.
- Clear Add an example pattern authoring Java
class to the project.
- Clear Add PHP support to the project.
- Click Finish.
- In the Class name field,
select the class in the code project you want to run when the user-defined
editor is used.
- Optional: You can create a new Java class by completing the following steps:
- Click New Java Class.
The New Pattern Authoring Property Editor window
opens.
- In the Source folder field, click Browse and
select the folder in which to store the new Java class file.
- Optional: In the Package field,
enter the name of the Java package
for the new class.
If you leave this field blank, the default
package is used.
- Optional: To add an interface for the new Java class, click Add.
The Implemented Interfaces Selection window opens.
In the Choose interfaces field, enter the name
of the interface that you want to add, select the interface in the Matching
items list and click OK. The Implemented
Interfaces Selection window closes.
- Optional: To remove an interface for the Java class, select the interface
in the Interfaces list and click Remove.
- Optional: Click Next to
view information about the Pattern Authoring Property Editor template,
which is used to create the Java class.
- Click Finish.
- In the Configuration values field,
enter any values that you want to be available in the Java code for your user-defined editor.
For example, if your editor displays a list of values to
a pattern user, you can enter the list of values in this field. Your
editor code can then use the configuration values to display them
in the editor.
- In the Select the visible parameters which will
send change notifications to this user-defined editor field,
select all parameters in your user-defined pattern from which you
want change notifications to be sent.
- Click OK.
What to do next
Write the Java code
for your user-defined editor; see Writing Java code for a user-defined editor.