Skip to content

Developer Guide: Plugin

Yosef Raisman edited this page Jul 1, 2017 · 6 revisions

This guide assumes you meet the requirements described in our developer guide, and that you followed the setup instructions that appear there.

Table of contents

Plugin content

Metadata

Plugin projects in Eclipse define their extension points and dependencies in a file called plugin.xml, which, in our case, is located in BugQueryPlugin/plugin.xml. Menus and keyboard shortcuts are also defined here, along with the ID and version of the plugin.

Extracting traces

After a program crashes we want to take its output and forward it to dispatch. We can gather the trace using these methods:

  • Using a command handler (defined in plugin.xml using org.eclipse.ui.handlers and org.eclipse.ui.commands). The commands we currently support, defined in com.bugquery.actions:
    • The Get Trace from Clipboard command, handled in FromClipboard.java. It uses the default toolkit to get the output from the system clipboard (function fromClipboard()), or opens up a ClipboardDialog (in fromClipboardDialog()). A ClipboardDialog, defined in ClipboardDialog.java (in the com.bugquery.stacktrace package), is an extended InputDialog that automatically sends ctrl+v once the text field is in focus. The handler collects the output and sends it to Dispatch.query(String).
    • The Get Trace from Console command, handled in FromConsole.java. It looks for the latest terminated console in the console manager, and dispatches its content.
    • The Get Trace from Input Window command, handled in FromInputDialog.java. It opens a different extended InputDialog, which supports multiple lines, defined in ExtendedDialog.java. The handler takes the input from the user and forwards it to Dispatch.query(String).
  • Using a button above the console, a behavior that's defined in the com.bugquery.console package. It uses the org.eclipse.ui.console.consolePageParticipants extension point for ConsoleExtender.java, which initializes an action - the button defined in ConsoleQuery.java.

Dispatch

After collecting the trace output, we send it to the website and initialize markers in the code. This is initiated in Dispatch.java, an interface with static functions, specifically public static void query(final String) that calls sendBugQuery(String).

sendBugQuery() uses a POST request to the address urlStr = "http://ssdlbugquery.cs.technion.ac.il/stacks", to get the address to which the user needs to be referred for answers. query() opens that link in the browser, and calls markersInit(String, String) that puts markers on the relevant lines.

Test the plugin in Eclipse

To run the plugin in a separate environment, select the plugin project (BugQueryPlugin) in the project explorer, and select Run Configurations... from the Run menu.

Imgur

In the Run Configurations window, locate Eclipse Application and select it. Press the New button (Imgur).

Imgur

Choose a name for the new configuration, then click Apply and Run.

Imgur

The plugin should run in a new workspace now.

Ship a new version

Update the version number in BugQueryPlugin\plugin.xml and BugQueryFeature\feature.xml (also category.xml).

Imgur

Right click the feature project, and select Export...

Imgur

Select Deployable features from Plug-in Development

Imgur

Select a destination.

Imgur

In the Options tab, select category.xml where it says Categorize repository:, and click Finish.

Imgur

The feature project will be exported. To be safe, make sure you can add the destination as a repository; in the Help menu, select Install New Software..., and add your destination as a local repository. BugQuery should show up, categorized correctly - you can test install it too.

Imgur Imgur

Next, replace the files in BugQueryServerSide/src/main/resources/static/feature with your destination folder, and push to git, and publish a new version of the site (see Developer Guide: Server).

Clone this wiki locally