The first thing we need to fix is that our createComponent() method has to return a JComponent, we will see why later.īecause Eclipse assumes we are already in a JPanel you can see a lot of add methods or methods that doesn’t seem to exist, the reason is because we are not in a JPanel. This is also the time to convert that code to Kotlin, you can do it automatically and it should be fine.Īfter doing all this you will probably have a few errors so let’s fix them. In that class we will create a new method called createComponent() and finally we can now paste inside that method the source code that we copied from Eclipse. You can now close eclipse, it wasn’t that bad wasn’t it?īack to our plugin, we are now going to create a new package called settings and a new class called JiraSettings. The last thing we will do in Eclipse is going to the source code of the UI we just created and copy it. If you want to have a go with the IntelliJ designer, be my guest, but we are going to do something different that I prefer over using IntelliJ. That will create a new file call YourName.form which will be linked to another one call YourName.java. One way of creating a new GUI (graphical user interface) is by simply right clicking and going to New and then GUI Form. But don’t let the Java name fool you because you can still convert that code to Kotlin. IntelliJ has a lot of Swing components that you can use so the UI of your plugin is kept consistent with the rest of the IDE. Like we did in the previous article we also have to register the component in our plugin.xml file components.JiraComponent Step 2: UIīefore we can continue with our settings screen we need to understand how the UI works on IntelliJ which is by using Java Swing Forms. This will allow us to access the data that we are storing from other places within our plugin. Finally, we have a companion object which, given a project, will provide the instance of our JiraComponent. The other difference is that we are now extending from AbstractProjectComponent which implements the ProjectComponent interface and, of course, it also needs a project. These fields are going to be public since we will use them in another part of our plugin. We are basically copying and pasting the component that we created previously but removing all the unnecessary methods and adding our two new fields. Because we want to be able to have different settings depending on our Android Studio projects the obvious choice is to create a new project component. In the second part of the series we already learnt what a component is and we also learnt that there are three different types of components. We also want to be able to have different settings per project allowing the users to have different Jira accounts depending on the project (this may be useful). Our settings screen will just have a username and a password field that our plugin will use to interact with the Jira APIs. This is going to be our first step towards creating an action to move tickets on Jira. The goal of today’s article is to create a settings screen for our plugin. Remember that you can find all the code for this series on GitHub and you can also see the relevant code for each article on its own branch, this article’s code is in the branch Part3.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |