use of com.intellij.tasks.TaskRepository in project intellij-community by JetBrains.
the class TaskCheckinHandlerFactory method findTaskInRepositories.
@Nullable
private static Task findTaskInRepositories(String message, TaskManager manager) {
TaskRepository[] repositories = manager.getAllRepositories();
for (TaskRepository repository : repositories) {
String id = repository.extractId(message);
if (id == null)
continue;
LocalTask localTask = manager.findTask(id);
if (localTask != null)
return localTask;
try {
Task task = repository.findTask(id);
if (task != null) {
return task;
}
} catch (Exception ignore) {
}
}
return null;
}
use of com.intellij.tasks.TaskRepository in project intellij-community by JetBrains.
the class TaskProjectConfiguration method getState.
public TaskProjectConfiguration getState() {
LinkedHashSet<SharedServer> set = new LinkedHashSet<>(this.servers);
for (TaskRepository repository : myManager.getAllRepositories()) {
if (repository.isShared()) {
SharedServer server = new SharedServer();
server.type = repository.getRepositoryType().getName();
server.url = repository.getUrl();
set.add(server);
}
}
servers.clear();
servers.addAll(set);
return this;
}
use of com.intellij.tasks.TaskRepository in project intellij-community by JetBrains.
the class CloseTaskAction method actionPerformed.
public void actionPerformed(AnActionEvent e) {
Project project = e.getProject();
assert project != null;
TaskManagerImpl taskManager = (TaskManagerImpl) TaskManager.getManager(project);
LocalTask task = taskManager.getActiveTask();
CloseTaskDialog dialog = new CloseTaskDialog(project, task);
if (dialog.showAndGet()) {
final CustomTaskState taskState = dialog.getCloseIssueState();
if (taskState != null) {
try {
TaskRepository repository = task.getRepository();
assert repository != null;
repository.setTaskState(task, taskState);
repository.setPreferredCloseTaskState(taskState);
} catch (Exception e1) {
Messages.showErrorDialog(project, e1.getMessage(), "Cannot Set State For Issue");
}
}
}
}
use of com.intellij.tasks.TaskRepository in project intellij-community by JetBrains.
the class TaskStateCombo method scheduleUpdateOnce.
/**
* One-shot method. Update combo box items only once.
*
* @return whether update was actually scheduled
*/
public boolean scheduleUpdateOnce() {
if (myProject != null && stateUpdatesSupportedFor(myTask) && myKindCombo.getComboBox().getItemCount() == 0) {
final JComboBox comboBox = myKindCombo.getComboBox();
final TaskRepository repository = myTask.getRepository();
assert repository != null;
new ComboBoxUpdater<CustomStateTrinityAdapter>(myProject, "Fetching available task states...", comboBox) {
@NotNull
@Override
protected List<CustomStateTrinityAdapter> fetch(@NotNull ProgressIndicator indicator) throws Exception {
return CustomStateTrinityAdapter.wrapList(repository.getAvailableTaskStates(myTask));
}
@Nullable
@Override
public CustomStateTrinityAdapter getSelectedItem() {
final CustomTaskState state = getPreferredState(repository, CustomStateTrinityAdapter.unwrapList(myResult));
return state != null ? new CustomStateTrinityAdapter(state) : null;
}
}.queue();
return true;
}
return false;
}
use of com.intellij.tasks.TaskRepository in project intellij-community by JetBrains.
the class TaskRepositoriesConfigurable method reset.
public void reset() {
myRepoNames.clear();
myRepositoryEditor.removeAll();
myRepositoryEditor.add(myEmptyPanel, EMPTY_PANEL);
// ((CardLayout)myRepositoryEditor.getLayout()).show(myRepositoryEditor, );
myRepositories.clear();
CollectionListModel listModel = new CollectionListModel(new ArrayList());
for (TaskRepository repository : myManager.getAllRepositories()) {
TaskRepository clone = repository.clone();
assert clone.equals(repository) : repository.getClass().getName();
myRepositories.add(clone);
listModel.add(clone);
}
myRepositoriesList.setModel(listModel);
for (TaskRepository clone : myRepositories) {
addRepositoryEditor(clone);
}
if (!myRepositories.isEmpty()) {
myRepositoriesList.setSelectedValue(myRepositories.get(0), true);
}
}
Aggregations