5 Extending Design Studio
About Extending Design Studio
You can extend the functionality of Design Studio. For example, you create custom report designs that are included in the Design Studio installation and you can create custom action commands that you add to a Design Studio menu. You can extend Design Studio functionality by working directly with the Design Studio Exchange Format published XML files or by using the Design Studio Model Java API to access the information in the Exchange Format.
Extending Design Studio with Action Commands
Action commands are custom menu commands that you can add to Design Studio menus and toolbars. When extending Design Studio with action commands, you use the following extension points:
-
org.eclipse.ui.commands
-
org.eclipse.ui.menus
-
eclipse.core.extensions.propertyTester
See the Eclipse Platform Developer Guide for more information about these extension points.
The Design Studio Action Command example includes details about these extension points. See "About the design.studio.example.action.command Example Project" for more information about the Action Command Examples project.
Adding the Design Studio Action Command Example to a Workspace
Design Studio includes the Design Studio Action Command example, which includes example projects that demonstrate how to extend Design Studio with action commands. These example projects are included in the Design Studio installation and can be added to your workspace.
To add the Design Studio Action Command example projects to a workspace:
-
From the Design Studio File menu, select New, and then select Example.
The New Example wizard appears.
-
Expand the Design Studio Examples folder and select Design Studio Action Command Examples.
-
Click Next.
The Example Projects page appears. The Design Studio Action Command example includes three example projects.
-
Click each of the following example projects to read a summary of the example project:
-
The design.studio.example.action. command.update.site project creates a project that demonstrates how to export installable features into an update site.
-
The design.studio.example.action.command.feature project creates a project that demonstrates how action commands can be packaged into a feature for installation into Design Studio.
-
The design.studio.example.action.command project creates a project that contains sample action commands that you can add to Design Studio.
-
-
Click Finish.
The example projects are added to the current workspace.
About the design.studio.example.action.command Example Project
The design.studio.example.action.command example project includes a plug.xml file that illustrates how to create actions that appear in the user interface and that leverage the information published by the Design Studio Exchange Format.
Note:
The examples presented in this chapter are displayed in text form, such as that displayed on the plugin.xml tab of the Plug-in Manifest editor. You can configure extensions in the Plug-in Manifest editor using the form-based representation that appears on the Extensions tab as well. The plugin.xml tab and the Extensions tab display two views of the same information.
The design.studio.example.action.command example project illustrates how to complete the following tasks:
-
Configuring the Visibility of Commands Using the Property Tester
-
Configuring the Visibility of Commands Using the File Extension of Resources
-
Obtaining the Model From a Resource Using the Design Studio Model Java API
-
Obtaining the Model From an Entity Relation Using the Design Studio Model Java API
-
Obtaining the Model From an Element Relation Using the Design Studio Model Java API
Adding Commands to the Studio Menu
The Design Studio Action Command Examples project includes an example that demonstrates how to add a command to the Studio menu.
Example 5-1 displays an example of the configuration of the extensions for the following command class:
design.studio.example.action.command.handler.StudioMenuCommandHandler
In Example 5-1, italics represent code that requires customization to meet your business needs. Add and review the Design Studio Action Command Examples project for more information.
Example 5-1 Adding Commands to the Studio Menu
<extension point="org.eclipse.ui.commands"> <command defaultHandler= "design.studio.example.action.command.handler.StudioMenuCommandHandler" id="design.studio.example.action.command.studioMenuCommand.command" name="Studio menu command"> </command> </extension> <extension point="org.eclipse.ui.menus"> <menuContribution locationURI="menu:studioMenu?after=perspective"> <command commandId="design.studio.example.action.command.studioMenuCommand.command" mnemonic="%contributions.menu.studioMenuCommand.mnemonic" icon="icons/sample.gif" id="design.studio.example.action.command.studioMenuCommand.command"> </command> </menuContribution> </extension>
Adding Commands to the Design Studio Toolbar
The Design Studio Action Command Examples project includes an example that demonstrates how to add a command to the Design Studio toolbar.
Example 5-2 displays an example of the configuration of the extensions for the command class:
design.studio.example.action.command.handler.StudioMenuCommandHandler
.
In Example 5-2, italics represent code that requires customization to meet your business needs. Add and review the Design Studio Action Command Examples project for more information.
Example 5-2 Adding Commands to Design Studio Toolbar
<extension point="org.eclipse.ui.commands"> <command defaultHandler= "design.studio.example.action.command.handler.StudioMenuCommandHandler" id="design.studio.example.action.command.studioMenuCommand.command" name="Studio Menu Command"> </command> </extension> <extension point="org.eclipse.ui.menus"> <menuContribution locationURI="toolbar:org.eclipse.ui.main.toolbar"> <toolbar id="design.studio.example.action.command.toolbar"> <command commandId= "design.studio.example.action.command.studioMenuCommand.command" id="design.studio.example.action.command.menu.studioMenuCommand.command" mnemonic="%contributions.menu.studioMenuCommand.mnemonic" icon="icons/sample.gif" tooltip="Studio menu command"> </command> </toolbar> </menuContribution> </extension>
Adding Commands to the Solution View Context Menu
The Design Studio Action Command Examples project includes an example that demonstrates how to add a command to the Solution view context menu. In the example, the command appears when a Resource, Location, or Product entity is selected in the Solution view.
Example 5-3 displays an example of the configuration of the extensions for the command class:
design.studio.example.action.command.handler.GetModelFromResourceCommandHandler
and for the property tester class:
design.studio.example.action.command.propertytesters.ResourceTester
In Example 5-3, italics represent code that requires customization to meet your business needs. Add and review the Design Studio Action Command Examples project for more information.
Example 5-3 Adding Commands to the Solution View Context Menu
<extension point="org.eclipse.ui.commands"> <command defaultHandler= "design.studio.example.action.command.handler. GetModelFromResourceCommandHandler" id="design.studio.example.action.command.getModelFromResource.command" name="Get Conceptual Model"> </command> </extension> <extension point="org.eclipse.ui.menus"> <menuContribution locationURI="popup:oracle.communications.sce.ui.solution.view?after=additions"> <command commandId= "design.studio.example.action.command.getModelFromResource.command" mnemonic="%contributions.menu.getModelFromResource.mnemonic" tooltip="Get conceptual model from resource" icon="icons/sample.gif" id= "design.studio.example.action.command.menu.getModelFromResource.command"> <visibleWhen checkEnabled="false"> <iterate operator="or"> <adapt type="org.eclipse.core.resources.IResource"> <or> <test forcePluginActivation="true" property= "design.studio.example.action.command. propertytesters.isProduct"> </test> <test forcePluginActivation="true" property= "design.studio.example.action.command. propertytesters.isResource"> </test> <test forcePluginActivation="true" property= "design.studio.example.action.command. propertytesters.isLocation"> </test> </or> </adapt> </iterate> </visibleWhen> </command> </menuContribution> </extension> <extension point="org.eclipse.core.expressions.propertyTesters"> <propertyTester class= "design.studio.example.action.command.propertytesters.ResourceTester" id="design.studio.example.action.command.propertytesters.resourceTester" namespace="design.studio.example.action.command.propertytesters" properties="isResource,isProduct,isLocation" type="org.eclipse.core.resources.IResource"> </propertyTester> </extension>
Adding Commands to the Studio Projects View Context Menu
The Design Studio Action Command Examples project includes an example that demonstrates how to add a command to the Studio Projects view context menu. In the example, the command appears when a Product entity is selected in the Studio Projects view.
Example 5-4 displays an example of the configuration of the extensions for the following command class:
design.studio.example.action.command.handler.GetProductModelFromResourceCommandHandler
and for the property tester class:
design.studio.example.action.command.propertytesters.ResourceTester
In Example 5-4, italics represent code that requires customization to meet your business needs. Add and review the Design Studio Action Command Examples project for more information.
Example 5-4 Adding Commands to the Studio Projects View Context Menu
<extension point="org.eclipse.ui.commands"> <command defaultHandler= "design.studio.example.action.command.handler. GetProductModelFromResourceCommandHandler" id="design.studio.example.action.command. getProductModelFromResource.command" name="Get Product Model"> </command> </extension> <extension point="org.eclipse.ui.menus"> <menuContribution locationURI= "popup:com.mslv.studio.view.StudioView?before=common-additions"> <command commandId= "design.studio.example.action.command. getProductModelFromResource.command" mnemonic="%contributions.menu.getProductModelFromResource.mnemonic" tooltip="Get product model from resource" icon="icons/sample.gif" id= "design.studio.example.action.command. menu.getProductModelFromResource.command"> <visibleWhen checkEnabled="false"> <iterate operator="or"> <adapt type="org.eclipse.core.resources.IResource"> <test forcePluginActivation="true" property= "design.studio.example.action.command. propertytesters.isProduct"> </test> </adapt> </iterate> </visibleWhen> </command> </menuContribution> </extension> <extension point="org.eclipse.core.expressions.propertyTesters"> <propertyTester class= "design.studio.example.action.command.propertytesters.ResourceTester" id="design.studio.example.action.command.propertytesters.resourceTester" namespace= "design.studio.example.action.command.propertytesters" properties="isResource,isProduct,isLocation" type="org.eclipse.core.resources.IResource"> </propertyTester> </extension>
Adding Commands to the Package Explorer View Context Menu
The Design Studio Action Command Examples project includes an example that demonstrates how to add a command to the Package Explorer view context menu.
Example 5-5 displays an example of the configuration of the extensions for the following command class:
design.studio.example.action.command.handler.StudioMenuCommandHandler
In Example 5-5, italics represent code that requires customization to meet your business needs. Add and review the Design Studio Action Command Examples project for more information.
Example 5-5 Adding Commands to the Package Explorer View Context Menu
<extension point="org.eclipse.ui.commands"> <command defaultHandler= "design.studio.example.action.command.handler.StudioMenuCommandHandler" id="design.studio.example.action.command.studioMenuCommand.command" name="Studio Menu Command"> </command> </extension> <extension point="org.eclipse.ui.menus"> <menuContribution locationURI="popup:org.eclipse.jdt.ui.PackageExplorer"> <command commandId= "design.studio.example.action.command.studioMenuCommand.command" mnemonic="%contributions.menu.studioMenuCommand.mnemonic" tooltip="Studio menu command" icon="icons/sample.gif" id= "design.studio.example.action.command.menu.studioMenuCommand.command"> </command> </menuContribution> </extension>
Adding Commands to the Project Explorer View Context Menu
The Design Studio Action Command Examples project includes an example that demonstrates how to add a command to the Project Explorer view context menu.
Example 5-6 displays an example of the configuration of the extensions for the following command class:
design.studio.example.action.command.handler.StudioMenuCommandHandler
In Example 5-6, italics represent code that requires customization to meet your business needs. Add and review the Design Studio Action Command Examples project for more information.
Example 5-6 Adding Commands to the Project Explorer View Context Menu
<extension point="org.eclipse.ui.commands"> <command defaultHandler= "design.studio.example.action.command.handler.StudioMenuCommandHandler" id="design.studio.example.action.command.studioMenuCommand.command" name="Studio Menu Command"> </command> </extension> <extension point="org.eclipse.ui.menus"> <menuContribution locationURI="popup:org.eclipse.ui.navigator.ProjectExplorer#PopupMenu"> <command commandId= "design.studio.example.action.command.studioMenuCommand.command" mnemonic="%contributions.menu.studioMenuCommand.mnemonic" tooltip="Studio menu command" icon="icons/sample.gif" id= "design.studio.example.action.command.menu.studioMenuCommand.command"> </command> </menuContribution> </extension>
Configuring the Visibility of Commands Using the Property Tester
The Design Studio Action Command Examples project includes an example that demonstrates how to configure the visibility of commands using the property tester. In the example, the command appears when a Resource entity is selected in the Studio Projects view.
Example 5-7 displays an example of the configuration of the extensions for the following command class:
design.studio.example.action.command.handler.GetResourceModelFromResourceCommandHandler
and for the property tester class:
design.studio.example.action.command.propertytesters.ResourceTester
In Example 5-7, italics represent code that requires customization to meet your business needs. Add and review the Design Studio Action Command Examples project for more information.
Example 5-7 Configuring the Visibility of Commands Using the Property Tester
<extension point="org.eclipse.ui.commands"> <command defaultHandler= "design.studio.example.action.command.handler. GetResourceModelFromResourceCommandHandler" id= "design.studio.example.action.command. getResourceModelFromResource.command" name="Get Resource Model"> </command> </extension> <extension point="org.eclipse.ui.menus"> <menuContribution locationURI= "popup:com.mslv.studio.view.StudioView?before=common-additions"> <command commandId= "design.studio.example.action.command. getResourceModelFromResource.command" mnemonic="%contributions.menu.getResourceModelFromResource.mnemonic" tooltip="Get resource model from resource" icon="icons/sample.gif" id= "design.studio.example.action.command.menu. getResourceModelFromResource.command"> <visibleWhen checkEnabled="false"> <iterate operator="or"> <adapt type="org.eclipse.core.resources.IResource"> <test forcePluginActivation="true" property= "design.studio.example.action.command. propertytesters.isResource"> </test> </adapt> </iterate> </visibleWhen> </command> </menuContribution> </extension> <extension point="org.eclipse.core.expressions.propertyTesters"> <propertyTester class= "design.studio.example.action.command. propertytesters.ResourceTester" id="design.studio.example.action.command.propertytesters.resourceTester" namespace="design.studio.example.action.command.propertytesters" properties="isResource,isProduct,isLocation" type="org.eclipse.core.resources.IResource"> </propertyTester> </extension>
Configuring the Visibility of Commands Using the File Extension of Resources
The Design Studio Action Command Examples project includes an example that demonstrates how to configure the visibility of commands using the file extension of a resource. In the example, the command appears when a Location entity is selected in the Studio Projects view.
Example 5-8 displays an example of the configuration of the extensions for the following command class:
design.studio.example.action.command.handler.GetLocationModelFromResourceCommandHandler
In Example 5-8, italics represent code that requires customization to meet your business needs. Add and review the Design Studio Action Command Examples project for more information.
Example 5-8 Configuring the Visibility of Commands Using the File Extension of Resources
<extension point="org.eclipse.ui.commands"> <command defaultHandler= "design.studio.example.action.command.handler. GetLocationModelFromResourceCommandHandler" id= "design.studio.example.action.command. getLocationModelFromResource.command" name="Get Location Model"> </command> </extension> <extension point="org.eclipse.ui.menus"> <menuContribution locationURI= "popup:com.mslv.studio.view.StudioView?before=common-additions"> <command commandId= "design.studio.example.action.command. getLocationModelFromResource.command" mnemonic="%contributions.menu.getLocationModelFromResource.mnemonic" tooltip="Get location model from resource" icon="icons/sample.gif" id= "design.studio.example.action.command.menu. getLocationModelFromResource.command"> <visibleWhen checkEnabled="false"> <iterate operator="or"> <adapt type="org.eclipse.core.resources.IResource"> <test property="org.eclipse.core.resources.name" value="*.cmnLocation"> </test> </adapt> </iterate> </visibleWhen> </command> </menuContribution> </extension>
Obtaining the Model From a Resource Using the Design Studio Model Java API
The Design Studio Action Command Examples project includes an example that demonstrates how to obtain a model configuration from a resource using the Design Studio Model Java API.
Example 5-9 displays an example of the configuration of the extensions for the following command class:
design.studio.example.action.command.handler.GetLocationModelFromResourceCommandHandler
In Example 5-9, italics represent code that requires customization to meet your business needs. Add and review the Design Studio Action Command Examples project for more information.
Example 5-9 Obtaining the Model From a Resource Using the Design Studio Model Java API
<extension point="org.eclipse.ui.commands"> <command defaultHandler= "design.studio.example.action.command.handler. GetLocationModelFromResourceCommandHandler" id= "design.studio.example.action.command. getLocationModelFromResource.command" name="Get Location Model"> </command> </extension> <extension point="org.eclipse.ui.menus"> <menuContribution locationURI= "popup:com.mslv.studio.view.StudioView?before=common-additions"> <command commandId= "design.studio.example.action.command. getLocationModelFromResource.command" mnemonic="%contributions.menu.getLocationModelFromResource.mnemonic" tooltip="Get location model from resource" icon="icons/sample.gif" id= "design.studio.example.action.command.menu. getLocationModelFromResource.command"> <visibleWhen checkEnabled="false"> <iterate operator="or"> <adapt type="org.eclipse.core.resources.IResource"> <test property="org.eclipse.core.resources.name" value="*.cmnLocation"> </test> </adapt> </iterate> </visibleWhen> </command> </menuContribution> </extension>
Obtaining the Model From an Entity Relation Using the Design Studio Model Java API
The Design Studio Action Command Examples project includes an example that demonstrates how to obtain a model configuration from an entity relation using the Design Studio Model Java API.
Example 5-10 displays an example of the configuration of the extensions for the following command class:
design.studio.example.action.command.handler.GetCreationTaskModelFromRelationCommandHandler
In Example 5-10, italics represent code that requires customization to meet your business needs. Add and review the Design Studio Action Command Examples project for more information.
Example 5-10 Obtaining the Model From an Entity Relation Using the Design Studio Model Java API
<extension point="org.eclipse.ui.commands"> <command defaultHandler= "design.studio.example.action.command.handler. GetCreationTaskModelFromRelationCommandHandler" id= "design.studio.example.action.command. getCreationTaskModelFromOrder.command" name="Get Creation Task Model From Order"> </command> </extension> <extension point="org.eclipse.ui.menus"> <menuContribution locationURI= "popup:com.mslv.studio.view.StudioView?before=common-additions"> <command commandId= "design.studio.example.action.command. getCreationTaskModelFromOrder.command" mnemonic= "%contributions.menu. getCreationTaskModelFromOrderRelation.mnemonic" tooltip="Get Creation Task Model From Order" icon="icons/sample.gif" id= "design.studio.example.action.command. getCreationTaskModelFromOrder.command"> <visibleWhen checkEnabled="false"> <iterate operator="or"> <adapt type="org.eclipse.core.resources.IResource"> <test property="org.eclipse.core.resources.name" value="*.order"> </test> </adapt> </iterate> </visibleWhen> </command> </menuContribution> </extension>
Obtaining the Model From an Element Relation Using the Design Studio Model Java API
The Design Studio Action Command Examples project includes an example that demonstrates how to obtain a model configuration from an element relation using the Design Studio Model Java API.
Example 5-11 displays an example of the configuration of the extensions for the following command class:
design.studio.example.action.command.handler.GetOrderItemActionPropertyFromRelationCommandHandler
In Example 5-11, italics represent code that requires customization to meet your business needs. Add and review the Design Studio Action Command Examples project for more information.
Example 5-11 Obtaining the Model From an Element Relation Using the Design Studio Model Java API
<extension point="org.eclipse.ui.commands"> <command defaultHandler= "design.studio.example.action.command.handler. GetOrderItemActionPropertyFromRelationCommandHandler" id= "design.studio.example.action.command. getOrderItemActionPropertyFromOrderItemSpec.command" name="Get Order Item Action Property From Order Item Specification"> </command> </extension> <extension point="org.eclipse.ui.menus"> <menuContribution locationURI= "popup:com.mslv.studio.view.StudioView?before=common-additions"> <command commandId= "design.studio.example.action.command. getOrderItemActionPropertyFromOrderItemSpec.command" mnemonic= "%contributions.menu. getOrderItemPropertyModelFromRelation.mnemonic" tooltip="Get Order Item Action Property From Order Item Specification" icon="icons/sample.gif" id= "design.studio.example.action.command. getOrderItemActionPropertyFromOrderItemSpec.command"> <visibleWhen checkEnabled="false"> <iterate operator="or"> <adapt type="org.eclipse.core.resources.IResource"> <test property="org.eclipse.core.resources.name" value="*.orderItemSpec"> </test> </adapt> </iterate> </visibleWhen> </command> </menuContribution> </extension>
About Design Studio View Identifiers
Each Design Studio component is defined with an identifier that you can use when you want to make additions to that component. For example, you can reference the Solution view identifier in Table 5-1 when adding an action command to the Solution view context menu.
Table 5-1 Design Studio View Identifiers
Component | Identifier |
---|---|
Menu |
menu:studioMenu?after=perspective |
Toolbar |
toolbar:org.eclipse.ui.main.toolbar |
Solution View Context Menu |
popup:oracle.communications.sce.ui.solution.view?after=additions |
Studio Project View Context Menu |
popup:com.mslv.studio.view.StudioView?before=common-additions |
Project Explorer Context Menu |
popup:org.eclipse.ui.navigator.ProjectExplorer#PopupMenu |
Package Explorer Context Menu |
popup:org.eclipse.jdt.ui.PackageExplorer |
Adding Custom Logic to Design Studio Builds
You can add custom logic to Design Studio builds by creating an implementation of the IModelProcessor interface, defined in:
oracle.communications.studio.model.processor
You can use model processors to generate custom artifacts to integrate with external systems, product catalogs, reporting features, and so forth.
Note:
This task is intended for advanced users who are familiar with Eclipse plug-in development and Java coding. The Design Studio Action Command Example project includes a simple implementation named ModelProcessorExample.java in the design.studio.example.model.processor package.
See "About the design.studio.example.action.command Example Project" for more information.
To extend Design Studio by adding custom logic to the build:
-
Create a plug-in project.
See "Creating Plug-in Projects" for more information. The plug-in project plugin.xml file is added to the Package Explorer view.
-
Double-click the plug-in project plugin.xml file.
The file opens in the Plug-in Manifest editor.
-
Click the Extensions tab.
-
Click Add.
The New Extension dialog box appears.
-
Locate and select:
oracle.communications.studio.model.processor
If you don't see the oracle.communications.studio.model.processor value, deselect the Show only extension points from the required plug-ins option. If prompted to add dependencies, select Yes.
-
Click Finish.
The extension appears in the Extension area.
-
Select the extension.
-
In the Extension Details area, click Show extension point description.
The Oracle Communications Design Studio Model Processor documentation page appears. Use this documentation to finish creating an implementation of the IModelProcessor interface.