Skip to content

Creating a New Plugin Module for CollaboRhythm

johnomoore edited this page Jan 21, 2013 · 7 revisions

Before creating a plugin, you will need to have an editable version of the CollaboRhythm repository. You will probably want to get a copy by Forking CollaboRhythm and then Cloning and Using a Fork of CollaboRhythm. Alternatively, you can get someone to make you a contributor (give you editing permission) for an existing CollaboRhythm repository, and then Cloning and Using a Fork of CollaboRhythm.

Note that these instructions are for creating a new plugin that will be part of the main CollaboRhythm repository, with a corresponding name under CollaboRhythm.Plugins.* (with packages and file names to match). If you wanted to create a plugin that you maintained and distributed independent of CollaboRhythm itself, the steps would be slightly different.

  1. Determine the name for your plugin and the corresponding package. Plugins that are (or will be) owned and maintained as part of the main CollaboRhythm distribution should start with "CollaboRhythm.Plugins.*" whereas third-party plugins should be prefixed with the name of the group, organization, or project. Examples:

    a. Plugin owned by CollaboRhythm

    CollaboRhythm.Plugins.Problems.AsthmaManagement (project name)

    collaboRhythm.plugins.problems.asthmaManagement (package name)

    b. Plugin owned by a third-party

    AsthmaNoMore.CollaboRhythm.Plugins.Problems.AsthmaManagement (project name)

    asthmaNoMore.collaboRhythm.plugins.problems.asthmaManagement (package name)

  2. Right click on the Plugins group in the project

  3. Choose New > Module from the menu

  4. Choose "Flash Module" from the list of module types on the left of the "New Module" dialog

  5. Use the name for your project from step 1 in the "Module name:" text area.

  6. Name the plugin module using the name for you project that you picked in step 1.

  7. Choose "Desktop" from the "Target platform:" drop-down

  8. Choose "Runtime-loaded module" from the "Output type:" drop-down

  9. Choose "4.6.0" from the "Flex SDK" drop-down

  10. Click the Finish button

  11. Now your plugin module will be added to the project in the "Plugins" group. (If you accidentally added your plugin to the root of the project, right click on your plugin and choose "Move Module to Group" and then choose to move it to the "Plugins" group.

  12. When IntelliJ asks to add your plugin module to Git, respond with the Yes button. This may happen at any time.

  13. Copy the “libs” folder from CollaboRhythm.Plugins.Messages to the root of your plugin module.

  14. Right click on you plugin module and choose Open Module Settings from the menu

  15. Select your module and select its (RLM) child from the tree view.

  16. In the Dependencies tab, click the + button and choose Build Configuration... and then hold control and select all of the following:

    • ChartBackgroundsLib
    • CollaboRhythm.Plugins.Schedule.Shared
    • CollaboRhythm.Shared
    • CollaboRhythm.Shared.Collaboration
    • CollaboRhythm.Shared.Messages
    • CollaboRhythm.Shared.Model
    • CollaboRhythm.Shared.PluginsSupport
    • CollaboRhythm.Shared.UI.Buttons
    • CollaboRhythm.Shared.UI.HealthCharts
    • McCuneChart
  17. In the Dependencies tab, click the + button and choose New Library… and select the "libs" folder from your module.

  18. Click the + button again and choose New Library… and select "frameworks\libs\mobile\mobilecomponents.swc" from your flex sdk.

  19. Click the + button again and choose New Library… and select "frameworks\themes\Mobile\mobile.swc" from your flex sdk.

  20. Click the OK button for the “Project Structure” dialog in which you are working.

  21. Select the “src” folder for your plugin.

  22. Right click on the “src” directory and choose New > ActionScript Class and name the class the name of your plugin in PascalCase appended with PluginModule. For the package, specify your plugin package appended with .controller. For the template, specify CollaboRhythm Plugin Module Class. For example

    • Name: HypertensionHelpExamplePluginModule
    • Package: exampleOrg.collaboRhythm.plugins.problems.hypertensionHelpExample.controller
    • Template: CollaboRhythm Plugin Module Class

    Note: if you do not see "CollaboRhythm Plugin Module Class" you probably did not successfully import the settings containing the templates. See the instructions "In IntelliJ, import settings" in Preparing Your Machine for CollaboRhythm Development.

  23. Click Create

  24. Confirm Yes when prompted to create the package.

  25. Your new plugin class should now be open. And the first highlighted error should be for the non-existent *AppController class, such as HypertensionHelpExampleAppController. If you have any other errors before this, such as IPlugin could not be resolved, check the previous steps or contact one of the CollaboRhythm developers for help.

  26. Navigate to the Next Highlighted Error (F2). The insertion point should move to the non-existent *AppController class.

  27. Use the “Show Intention Actions” command (Alt+Enter) to bring up a list of actions. Select *Create Class ‘AppController’

  28. Leave the name and package as specified, and choose template CollaboRhythm App Controller Class.

  29. Click Create

  30. Right click on the “src” directory and choose New > MXML Component and name the component the name of your plugin in PascalCase appended with ButtonWidgetView. For the package, specify your plugin package appended with .view. For the template, specify CollaboRhythm Button Widget Component. For example

    • Name: HypertensionHelpExampleButtonWidgetView
    • Package: exampleOrg.collaboRhythm.plugins.problems.hypertensionHelpExample.view
    • Template: CollaboRhythm Button Widget Component
  31. Navigate to the Next Highlighted Error (F2). The insertion point should move to the non-existent *Model class.

  32. Use the “Show Intention Actions” command (Alt+Enter) to bring up a list of actions. Select *Create Class ‘Model’

  33. Leave the name as specified. Change the package to end with .model instead of .view, and choose template 'Class'.

  34. Click Create. This will create an empty model class in the model package.

  35. You will now create the main *View component, similar how you created the *ButtonWidgetView in a previous step. Right click on the “view” directory and choose New > MXML Component and name the component the name of your plugin in PascalCase appended with View. For the package, specify your plugin package appended with .view. For the template, specify CollaboRhythm App View. For example

    • Name: HypertensionHelpExampleView
    • Package: exampleOrg.collaboRhythm.plugins.problems.hypertensionHelpExample.view
    • Template: CollaboRhythm Button Widget Component
  36. Navigate back to your AppController class.

  37. Notice some highlighted errors for unresolved types. Insert missing imports by pressing Alt+Enter when you see the action popup for each error.

  38. Navigate back to your PluginModule class.

  39. Block comment the four statements for registering factory components that do not exist. You may return to these and create them at a later time.

  40. Right click on you plugin module and choose Open Module Settings from the menu

  41. Select your module and select its (RLM) child from the tree view.

  42. In the General tab, for the "Main Class", select the “PluginModule” class that you created.

  43. Click the OK button in the "Project Structure" dialog.

  44. Make the project. The project, including your new plugin module, should build successfully. If not, consult the steps above or consult the CollaboRhythm Developers mailing list.

  45. Right click on you plugin module and choose Open Module Settings from the menu

  46. In the "Project Structure" dialog, under Modules, navigate to CollaboRhythm -> Modalities -> CollaboRhythm.Tablet -> CollaboRhythm.Tablet Release (app).

  47. Select the "Android" tab.

  48. In the "Files and folders to package" click the Add + button (far right side).

  49. Navigate to the compiled plugin module (SWF) that you created. It should be in a folder under the /out/production folder of the project, such as /out/production/ExampleOrg.CollaboRhythm.Plugins.Problems.HypertensionHelpExample/ExampleOrg_CollaboRhythm_Plugins_Problems_HypertensionHelpExample.swf

  50. An item should be added to the "Files and folders to package". Double-click on the second column of the item you added under "Its relative path in package" and add "plugins\" to the beginning of the value, such as "plugins\ExampleOrg_CollaboRhythm_Plugins_Problems_HypertensionHelpExample.swf"

  51. Click the OK button in the "Project Structure" dialog.

  52. Navigate to CollaboRhythm.Tablet/src/resources/settings.xml (Control-Shift-N and then specify the file name).

  53. Find the following line after : <!-- This path is for the plugins that are installed with the application -->

  54. Add a pluginSearchPath for your plugin, such as <pluginSearchPath> $APPLICATION_DIRECTORY$/../../out/production/CollaboRhythm.Plugins.Problems.AsthmaManagement </pluginSearchPath>

  55. Make the project. The project, including your new plugin module, should build successfully. If not, consult the steps above or consult the CollaboRhythm Developers mailing list.

  56. Run "CollaboRhythm.Tablet - Emulator (Tab 1280 x 752)" or one of the other emulator configurations.