[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [mylyn-integrators] Using public Mylyn API to automatically create task and open it in editor
|
Rob,
This is indeed an interesting case, but under a slightly different
angle. I've been assured that the present API is sufficient for creating
new tasks. So, it seems like the following issue should be reopened with
Alex's use case:
191395: [api] Make sure task API allows connector-neutral task creation
https://bugs.eclipse.org/bugs/show_bug.cgi?id=191395
There is also bug:
196528: [api] AbstractRepositoryConnector.createTask() is not sufficient
for creating tasks
https://bugs.eclipse.org/bugs/show_bug.cgi?id=196528
regards,
Eugene
Robert Elves wrote:
Alexander,
This sounds like a great project and you should really consider
commenting on bug#212209
(https://bugs.eclipse.org/bugs/show_bug.cgi?id=212209). We've started
planning a better bug reporting facility and your input would greatly
appreciated. If you want to get going immediately you could use the
internal setupNewBugAttributes() method (option 2) for now. I'll
create a bug report to make this accessible via
BugzillaTaskDataHandler.initializeTaskData().
-Rob
Alexander Gurov wrote:
Hello All,
I tried to replace bug and tip reporting system currently used in the
Subversive with the Mylyn-based one. Unfortunately it looks like not
all required API parts are implemented by the Bugzilla connector. So,
it looks like I cannot use public API parts and should use Bugzilla
connector implementation details. But may anyone known how to use
public API's in more successful way?
Currently I use the code which looks like:
TaskRepositoryManager manager = TasksUiPlugin.getRepositoryManager();
final TaskRepository repository =
manager.getRepository(SendProductBugOrTip.ECLIPSE_BUGZILLA_URL);
if (repository == null) {
return;
}
AbstractRepositoryConnector connector =
manager.getRepositoryConnector(repository.getConnectorKind());
final AbstractTaskDataHandler taskDataHandler =
connector.getTaskDataHandler();
if (taskDataHandler == null) {
return;
}
String kind = this.repository.getConnectorKind();
AbstractAttributeFactory attributeFactory =
taskDataHandler.getAttributeFactory(repository.getUrl(), kind,
AbstractTask.DEFAULT_TASK_KIND);
final RepositoryTaskData taskData = new
RepositoryTaskData(attributeFactory, kind, repository.getUrl(),
TasksUiPlugin.getDefault().getNextNewRepositoryTaskId());
taskData.setNew(true);
IActionOperation op = UIMonitorUtility.doTaskScheduledDefault(new
AbstractActionOperation("Initialize Report") {
protected void runImpl(IProgressMonitor monitor) throws Exception {
if (!taskDataHandler.initializeTaskData(repository, taskData,
monitor)) {
// if (!taskDataHandler.initializeSubTaskData(repository,
taskData, taskData, monitor)) {
throw new CoreException(new RepositoryStatus(IStatus.ERROR,
TasksUiPlugin.ID_PLUGIN,
RepositoryStatus.ERROR_REPOSITORY,
"The selected repository does not support creating new tasks."));
}
}
}).getOperation();
if (op.getExecutionState() == IActionOperation.OK) {
taskData.setSummary("autogenerated summary");
taskData.setDescription("autogenerated description (stack trace
etc.)");
taskData.setAttributeValue(RepositoryTaskAttribute.PRODUCT,
"Subversive");
taskData.setAttributeValue("severity", "normal");
// open task editor
NewTaskEditorInput editorInput = new
NewTaskEditorInput(repository, taskData);
IWorkbenchPage page =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
TasksUiUtil.openEditor(editorInput, TaskEditor.ID_EDITOR, page);
}
So, mainly the problem is that
BugzillaTaskDataHandler.initializeTaskData() . There only two ways I
found to initialize the task editor properly:method have no
implementation
1) Initialize task data using
AbstractTaskDataHandler.initializeSubTaskData(), but it also installs
dependency to parent bug, which is undesirable moment
2) Use BugzillaRepositoryConnector.setupNewBugAttributes() method
directly, but this class is a part of Bugzilla connector internal
implementation.
Best regards,
Alexander Gurov
Subversive Team
------------------------------------------------------------------------
_______________________________________________
mylyn-integrators mailing list
mylyn-integrators@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/mylyn-integrators