Mylyn Trac connector does not show "Severity" attribute in query editor

518 Views Asked by At

We recently decided to start using the Severity field in our Trac project. However, I can't figure out a way to make the field appear in the query editor for the Mylyn plugin to Eclipse - whatever I try, the field is not there.

It does show up in the web interface, and if I open a task in Mylyn I can set a severity there (so at some point Mylyn does understand that the attribute is being used) but it doesn't appear in the query dialog.

I have

  • Made sure all tasks have a severity set.
  • Restarted Eclipse
  • Synchronized with the repository
  • Hit "Update attributes from repository" several times
  • Reinstalled Mylyn

without success. What more is there to try?

Clarification: This is not about editing tickets. It's about querying tickets from the repository, using right-click in the task list -> "new query...".

This is what the form I see looks like:

enter image description here

I want a field for the severity in there somewhere too.

3

There are 3 best solutions below

1
On

It does not have a labeled field in the form editor, but there is an icon next to the name. Clicking on that icon you can define the severity.

enter image description here

0
On

Looking at the code, it appears it is not possible to query based on severity. You may want to open a feature request at https://bugs.eclipse.org/bugs. Even better would be if you provided a patch. :)

0
On

You have to obtain the source for the TracQueryPage.java and add the list for "severity".

  1. http://grepcode.com/file/repository.grepcode.com/java/eclipse.org/3.6.2/org.eclipse.mylyn.trac/ui/3.4.2/org/eclipse/mylyn/internal/trac/ui/wizard/TracQueryPage.java?av=f

  2. Create an empty plugin project in Eclipse (e.g. named trac-connector-patch)

  3. Locate the org.eclipse.mylyn.trac.ui_3.6.0.v20110608-1400.jar in the plugin folder and copy the MANIFEST.MF to the plugin project's META-INF folder. Remove all lines starting with "Name:" and "SHA1-Digest:", then change Bundle-Symbolic-Name to

    Bundle-SymbolicName: org.eclipse.mylyn.trac.ui-patched;singleton:=true

  4. Copy the source for TracQueryPage.java into the source folder as

    src\org\eclipse\mylyn\internal\trac\ui\wizard\TracQueryPage.java

  5. Fix the projects build path:

    • remove the exports from the MANIFEST.MF for org.eclipse.mylyn.internal.trac.ui and org.eclipse.mylyn.internal.trac.ui.editor
    • use the context menu "PDE Tools -> update classpath"
    • if there are still errors for org.eclipse.swt stuff, add the swt jar from the eclipse plugin folder as external jar to the projects build bpath (e.g. org.eclipse.swt.win32.win32.x86_64_3.7.1.v3738a.jar)
  6. Modify the TracQueryPage

    // add a new list search field
    private ListSearchField severityField;
    ...
    
    protected Control createTicketAttributes(Composite control) {
        Composite group = new Composite(control, SWT.NONE);
        GridLayout layout = new GridLayout();
    
        layout.numColumns = 5; // add a column
    
        group.setLayout(layout);
        GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
        gd.horizontalSpan = 1;
        group.setLayoutData(gd);
    
        Label label = new Label(group, SWT.LEFT);
        label.setText(Messages.TracQueryPage_Status);
    
        label = new Label(group, SWT.LEFT);
        label.setText(Messages.TracQueryPage_Resolution);
    
        label = new Label(group, SWT.LEFT);
        label.setText(Messages.TracQueryPage_Type);
    
        label = new Label(group, SWT.LEFT);
        label.setText(Messages.TracQueryPage_Priority);
    
        label = new Label(group, SWT.LEFT);
        label.setText("Severity"); // TODO use a property
    
        statusField = new ListSearchField("status"); //$NON-NLS-1$
        statusField.createControls(group, STATUS_HEIGHT);
    
        resolutionField = new ListSearchField("resolution"); //$NON-NLS-1$
        resolutionField.createControls(group, STATUS_HEIGHT);
    
        typeField = new ListSearchField("type"); //$NON-NLS-1$
        typeField.createControls(group, STATUS_HEIGHT);
    
        priorityField = new ListSearchField("priority"); //$NON-NLS-1$
        priorityField.createControls(group, STATUS_HEIGHT);
    
        // add the severityField
        severityField = new ListSearchField("severity"); //$NON-NLS-1$
        severityField.createControls(group, STATUS_HEIGHT);
    
        return group;
    }
    
    private void updateAttributesFromRepository(final boolean force) {
        ...
    
        statusField.setValues(client.getTicketStatus());
        resolutionField.setValues(client.getTicketResolutions());
        typeField.setValues(client.getTicketTypes());
        priorityField.setValues(client.getPriorities());
    
        // also update the severities
        severityField.setValues(client.getSeverities());
    
        componentField.setValues(client.getComponents());
        versionField.setValues(client.getVersions());
        milestoneField.setValues(client.getMilestones());    
    }
    
  7. Now you are ready to path the plugin jar (e.g. org.eclipse.mylyn.trac.ui_3.6.0.v20110608-1400.jar):

    • overwrite the TracQueryPage.class with your modified class
    • remove the "Name:" and "SHA1-Digest:" lines for the TracQueryPage.class from the MANIFEST.MF
  8. Replace the plugin with your patched plugin. And restart eclipse.

  9. Or download an already patched plugin: http://franke.ms/download/org.eclipse.mylyn.trac.ui_3.6.0.v20110608-1400-patched.zip