Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

JIRA Plugin to Extend Capabilities of "Link to Issue" Dialog

Phillip Ponzer [Cprime]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 22, 2013

I am currently trying to develop a plugin that extends the capabilities of linking to issues.

I am running JIRA 5.2.5 and so I do see that I can link to other JIRA issues, a Confluence page, or a page via URL.

I would like to extend this to allow links to another issue management tool we use internally that I can interface with via REST.

What action/class/what-have-you do I need to extend/overwrite/etc in order to do this? I've thought up two ways that might work, but have no idea how to implement:

  • Hijack the existing JIRA Issues text field (where it says "Begin typing to find recently viewed issues") to link to an issue in the other issue management tool
  • Add another tab (in addition to the already-existing "JIRA Issue", Confluence Page", and "Web Link" tabs) that shows a form for linking to another issue in the other issue management tool
  • I'd appreciate any ideas that are "outside of the box" too.

I'm currently exploring overwriting the "issue.IssuePicker" action and extending the IssuePicker class (per this tutorial and this older tutorial), but am thinking this is the wrong approach.

5 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Phillip Ponzer [Cprime]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 2, 2013

Still haven't figured out why I get that ClassCastException, although I found a work-around by creating a new project with the same code.

Thankfully, someone else has created an example for extending the Link to Issue dialog:

https://bitbucket.org/shamid/jira-weather-link

Using this as an example, I am now able to extend the capabilities of the Link to Issue dialog.

0 votes
Shhaid Shaikh February 11, 2014

I have been trying the same thing today but i am getting errors in IDE for import com.atlassian.jira.web.action.issue.AbstractIssueLinkAction; .

The steps i have followed are .

The error in IDE is due to class missing in my build path .

  • Install Jira SDK with installer sdk-installer-4.2.13 .
  • Create Jira 5 plugin with command "atlas-create-jira5-plugin"
  • create eclipse configureation for plugin clreated with commnd "atlas-create-jira5-plugin"
  • Import the project in eclipse .
  • Copy the .Java files from the shamid project for plugin downloded and try to resolve the dependencies of compilation error .

Can some one please help me resolve this issue. I am not able to compile this code .

Phillip Ponzer [Cprime]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 11, 2014

Don't copy the java files, just open the project. At least in Netbeans I was able to do it with no problem.

0 votes
Phillip Ponzer [Cprime]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 26, 2013

I am currently receiving a "java.lang.ClassCastException: com.mycompany.jira.mylink cannot be cast to webwork.action.Action" with the following code:

//mylink.java
package com.mycompany.jira;

import com.atlassian.jira.web.action.JiraWebActionSupport;

public class mylink extends JiraWebActionSupport {
    public mylink() {
    }
}
<!-- atlassian-plugin.xml -->
<atlassian-plugin key="${project.groupId}.${project.artifactId}" name="${project.name}" plugins-version="2">
    <plugin-info>
        <description>${project.description}</description>
        <version>${project.version}</version>
        <vendor name="${project.organization.name}" url="${project.organization.url}" />
    </plugin-info>

    <web-item key="attach-link" section="create-issue-link-types" weight="100">
        <label key="My Link"/>
        <link linkId="com.mycompany.jira.mylink">/secure/mylink?id=${issueId}</link>
    </web-item>

    <webwork1 key="mylink" name="My Link" class="java.lang.Object">
        <actions>
            <action name="com.mycompany.jira.mylink" alias="mylink">
                <view name="success">/templates/success.vm</view>
                <view name="error">/templates/error.vm</view>
                <view name="input">/templates/input.vm</view>
            </action>
        </actions>
    </webwork1>
</atlassian-plugin>

The vm files are all simple HTML files:

<html>
    <body>
        text
    </body>
</html>

What am I doing wrong?

0 votes
Phillip Ponzer [Cprime]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 24, 2013

Right now, I'm exploring the second bullet point: Add another tab

Following this tutorial, I was able to add another tab called "My Link" to the "Link Issues" dialog:

But, when I click on it, it gives me the error "The JIRA server was contacted but has returned an error response. We are unsure of the result of this operation. Close this dialog and press refresh in your browser"

My atlassian-plugin.xml looks like this:

<atlassian-plugin key="${project.groupId}.${project.artifactId}" name="${project.name}" plugins-version="2">
    <plugin-info>
        <description>${project.description}</description>
        <version>${project.version}</version>
        <vendor name="${project.organization.name}" url="${project.organization.url}" />
    </plugin-info>

    <web-item key="attach-link" section="create-issue-link-types" weight="100">
        <label key="My Link"/>
        <link linkId="attach-link">/secure/mylink!default.jspa?id=${issueId}</link>
    </web-item>
</atlassian-plugin>

"mylink.jsp" is a copy/rename of the "LinkExistingIssue.jsp" located in my "jira\webapp\secure\views\issue" directory. I've tried the following to get any file to show up with this link:

  • Restarting the instance of JIRA that comes up whenever you run the command "atlas-run"
  • Putting the file into the "secure" base directory
  • Putting the file into the plugin's "secure" directory
  • Pointing the link to an absolute URL on my local web server

All of which give me that error.

Ideally, I'd want to use a vm file instead and ship it with my plugin. I have not had luck with this approach either, though.

0 votes
Timothy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 23, 2013

Hijack the existing JIRA Issues text field

Add another tab

I'm currently exploring overwriting the "issue.IssuePicker" action and extending the IssuePicker class

If you are looking to hijack/edit the existing function, you will need to edit the source code.

Another way is to create your own plugin modules that will do this. You can create a webitem that opens a new AUI dialog that does the the searching for you.

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events