Tasks Api - #setTaskState and #updateTimeSpent are not called for TaskRepository

I've been trying to wrap my head around how the Task api for Jetbrains IDEAs work. I want to make a bi-directional connection between my custom CRM and Jetbrains IDEA Task Management system. I want to be able to see the tasks present in my CRM and close them when i close the issue from the Intellij IDEA. At first, i tried to achieve this using the Generic Task Repository, and wrote a rest api to handle the IDEA requests. I was able to show the tasks in the IDEA but i wasn't able to get any information from the IDEA when i closed the task. I searched on the internet for a while and saw that this was possible for the Youtrack Task Repository.

I downloaded the Intellij Idea Community Edition from the git repository, set up a plugin development environment and started coding a custom TaskRepository. I was able to create a TaskRepository, add it to the list of servers by extending the tasks.repositoryType in my plugin.xml. I used `BaseRepositoryImpl`, `BaseRepositoryType` and `BaseRepositoryEditor`. Everything was going great and i got the control i wanted for sending requests to the server for retrieving Tasks. But when i started to override `#setTaskState` and `#updateTimeSpent` whatever i did, these methods didn't get called by the IDEA. 

@Override
public Set<CustomTaskState> getAvailableTaskStates(@NotNull Task task) throws Exception {
HashSet<CustomTaskState> set = new HashSet<CustomTaskState>();

set.add(new CustomTaskState("1", "Progress"));
set.add(new CustomTaskState("2", "Resolved"));
return set;
}

@Override
public void updateTimeSpent(@NotNull LocalTask task, @NotNull String timeSpent, @NotNull String comment) throws Exception {
// Send info to server?
super.updateTimeSpent(task, timeSpent, comment);
}

@Override
public void setTaskState(Task task, CustomTaskState state) throws Exception {
// Send info to server?
super.setTaskState(task, state);
}

@Override
protected int getFeatures() {
return super.getFeatures() | NATIVE_SEARCH | TIME_MANAGEMENT | STATE_UPDATING;
}

Even though i override these methods, only method that was called by the IDEA was `#getIssues`. It's called when i click the `Open Task` action and just after i add the server to the Task Servers. I expect the `#setTaskState` to be called when i click the `Close Active Task` button, but nothing happens.

1

Please sign in to leave a comment.