Documenation about Task Api

hi..

where do i get infomation about how to use Intelij Task API, (like how to use the Custom Task state, and support all other features, knowing what are the features in getFeatures, etc..) 

7 comments
Comment actions Permalink

Hi Elhanan,

I'm afraid that the most reliable source of information about Task API is API sources themselves and their JavaDoc.

Some time ago I wrote the following in response to a similar question:

Adding a custom task repository is actually not that hard and requires implementation of a single extension points and only a few classes. All related API and samples are in one place. Basically you should:

1. Implement and register extension point TaskRepositoryType in your plugin.xml. It serves as a factory for editor in IDE settings and connector itself.
2. Extend TaskRepository that contains the logic related to actual requests to your server. Basically the main method here is #getIssues that will be used to download issues from server. They are then used for "Open task" dialog and to populate cache of issues that is updated periodically in background. We usually use Apache httpclient 4 to make requests and JDOM and GSON to handle XML and JSON responses.
3. Create repository editor to show in settings (probably the most mundane part). You may stick with BasicRepsitoryEditor or extend it to add some additional controls to filter issues or use custom authentication scheme.

Probably the best way to understand how it works is to look at some existing connectors that are not cluttered with compatibility layer for different versions of their trackers. I believe that RedmineRepository and GitlabRepository are the best candidates. If you use XML-RPC to communicate with your server check BugzillaRepository.

Not much changed since then.

As for CustomTaskState, it was added not a while ago to support trackers that allow customizable workflow (e.g. YouTrack and JIRA). Before that there were only a few predefined issue states (see com.intellij.tasks.TaskState) that, obviously, were not applicable to all supported servers. Moreover they were hardcoded in each type of repository, so it wasn't possible to understand that some of these states aren't allowed for some of the issues (e.g. you can't move issue to the same state again in JIRA), or even that various versions of the same repository may have different sets of standard issue states. Custom states resolved all these legacy problems.

It's also possible to use the new mechanism of custom states for different purpose, e.g. in Trello one can uses it to move cards between lists on the board, because there is really no concept of "state" there.

To facilitate custom states you must define two methods in your repository:

  • TaskRepository#getAvailableTaskStates asks a server for the set of states for the concrete issue that will be shown in dialogs "Open Task" and "Close task". The last selected state is remembered.
  • TaskRepository#setTaskState actually performs a request to a server to change issue state

And, of course, you should add STATE_UPDATING in the set of features supported by your repository.

Speaking of feature flags defined in com.intellij.tasks.TaskRepository, they mostly affect what controls are shown in the UI. For instance, if aforementioned STATE_UPDATING flag isn't included, corresponding combo boxes with states won't be shown in the dialogs and, if TIME_MANAGEMENT flag isn't set time, some buttons on tracking toolbar will be inactive.

BTW, what do you want to write exactly? Is it a new integration or a patch for some of existing connectors? Anyway feel free to ask me for further details here.

0
Comment actions Permalink

i'm trying to create a plugin for RTC jazz, i've already created one, (it's in your repo https://plugins.jetbrains.com/plugin/7865?pr=idea ) and it also has a link to git hub.  so i basically allready did most of what you told me. 

i've encountered several problems. the main one is that is the api connection is stateful not statless, so i don't have method to override that would simply connect to the repo. i had to do it all in getIssues, i maintain a map of repo's by the url the repo , and initiate it only once. 

this also causes a problem where repetitive typing causes the previous thread of getIssues to be stopped so RTC api keeps throwing Exceptions of CloseByInterruptException that i have to catch and ignore. (that they inner exceptions so i have to keep  getting the rootException) 

i also have problems configuring log4j , i keep getting

log4j:WARN No appenders could be found for logger (io.netty.util.internal.logging.InternalLoggerFactory).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

no matter where i place log4j.xml 

i also don't know when some method are called like findTask or getUrlfrom (Task in Task interface.)

i'll look in the https://github.com/JetBrains/intellij-community/blob/210e0ed138627926e10094bb9c76026319cec178/plugins/tasks/tasks-core/src/com/intellij/tasks/bugzilla/BugzillaRepositoryEditor.java

i've had problems adding additional field of "project name" to connection properties 

btw did you know i wrote a bugzilla plugin called InteliZilla before intelij had one, i actually took an old and re-wrote it. 

 

 

 

0
Comment actions Permalink

well the problem is that are barely any javaDocs  on the api's themselves, that would help a lot if every overridable api would have this, that way i won't need much of the source code, which i could do that..

0
Comment actions Permalink

Where can I find BasicRepsitoryEditor class? I am using gradle to configure dependency and don't see this class in the classpath

0
Comment actions Permalink

Sorry, I made a typo back then. It's actually called BaseRepositoryEditor and resides in intellij.tasks module.

0
Comment actions Permalink

So by default, IDEA doesn't have this class in project. I tried it with default gradle and idea SDK projects and it is not there.

I added <depends>com.intellij.tasks</depends> to plugin.xml 

In gradle project I also added

intellij {

...

plugins 'com.intellij.tasks' 

}

Idea gave me error " Cannot find builtin plugin com.intellij.tasks for IDE: $HOME/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea/ideaIC/2018.3.3/b2fea6520b0f59db49f39aa226de9e866532ff7c/ideaIC-2018.3.3

In native IDEA SDK project, tasks.jar's are not in the default classpath for SDK. Do I have to manually create the library for them?

0
Comment actions Permalink

I think I figured out issue with Gradle. 

intellij {

...

plugins 'com.intellij.tasks

}

the plugin id in the single quotes should be the folder name for task plugin in the $DISTRIBUTION/plugins folder. 

So following works 

intellij {

...

plugins 'tasks

}

Alexandr, could you clarify why is that?

0

Please sign in to leave a comment.