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()
method have no implementation. There only two ways I found to initialize
the task editor properly:
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