Creating Mylar Connectors

From Eclipsepedia

Jump to: navigation, search

This documentation was contributed for Mylar 0.6.x and is now deprecated. See the Mylar page for up-to-date documentation.

Contents

General Structure of Mylar

Mylar consists of several Eclipse plugins and has two main features:

  • Displays a set of tasks/bugs in Eclipse including the possibility to add or modify tasks (depends on the repository backend).
  • Calculates the degree of interest for Java structures (methods, classes, ...) in the current context and displays only "interesting" ones. The "current context" is defined by an activated task.

Mylar Task List Basics

Internal Structure

Although it is called task list it is a tree which means the task list is able to display hierarchical structures.

Populating the Task List

There are three different mechanisms how to populate the Mylar task list:

  1. Create a new task through Mylar. This task will be ... pushed ... synchronized into the upstream repository.
  2. Add an existing repository task by entering its id (for example a Bugzilla ID may look like "213312" but in general repository bug ids are not restricted to be numeric).
  3. Add a custom repository query. All bugs which match the given condition will be returned and shown.

Currently there is no mechanism to show all existing bugs in Mylar and it doesn't look as a good idea to me because of of the shere number (Mozilla has more than 200,000 bugs) and most of them are not relevant to you anyway. Therefore the Mylar concept is to display only a selected subset of bugs.

Creating a Custom Connector

Your custom connector should extend AbstractRepositoryConnector (org.eclipse.mylar.provisional.tasklist). For basic operation you should first implement importing existing tasks from the repository.

Therefore you need to implement the methods getRepositoryType, canCreateTaskFromKey and createTaskFromExistingKey. Fill all other methods with stubs (returning false, null etc).

You need to implement a custom task (which should inherit from AbstractRepositoryTask). Bugzilla does not hold the real attributes (bug reporter, comments, ...) in this object but treats it as a container which has a reference to the real data (BugReport).

After creating a stub repository connector, you have to connect to the extension point "org.eclipse.mylar.tasklist.repositories". You can just omit an externalizer specification for now.

If your first basic plugins works, you should handle synchronization. Please note that the method for synchronization is called updateOfflineState (AbstractRepositoryConnector) instead of just synchronize().

The next step is writing a TaskExternalizer (extend DelegatingTaskExternalizer and add the declaration to your plugin.xml).