Adding Elements to the active context of the task [message #920572] |
Sun, 23 September 2012 07:12 |
saurav sarkar Messages: 428 Registered: July 2009 |
Senior Member |
|
|
Hi All,
I am very new to Mylyn Internals.
My requirement is as follows:
Everything has to be done progmatically.
(a) Create a local task and activate.
(b) Add few java files to the task's context.
For the step b is it possible to do progmmatically ?
I debugged how the existing adding functionality to the context works.
An IInteractionElement is created from the selection and added to the context. Is it possible to do the same through a programme given the set of files.
cheers,
Saurav
My Blog http://codifyit.blogspot.com/
Follow me: http://twitter.com/sauravs
|
|
|
Re: Adding Elements to the active context of the task [message #921902 is a reply to message #920572] |
Mon, 24 September 2012 14:38 |
saurav sarkar Messages: 428 Registered: July 2009 |
Senior Member |
|
|
ok...i was able to proceed till creation of task and adding it to the task context
LocalTask createNewLocalTask = new LocalTask("JUnit", "JUnit");
TasksUiUtil.openTask(createNewLocalTask);
//TaskCategory category = new TaskCategory(TasksUiPlugin.getTaskList().getUniqueHandleIdentifier(), "JUNit");
TasksUi.getTaskActivityManager().activateTask(createNewLocalTask);
//TasksUiPlugin.getTaskList().addTask(createNewLocalTask, category);
//add task category
// TaskCategory category = new TaskCategory(TasksUiPlugin.getTaskList().getUniqueHandleIdentifier(), "JUNits");
// TasksUiPlugin.getTaskList().addCategory(category);
ICompilationUnit firstElement = (ICompilationUnit)((IStructuredSelection)selection).getFirstElement();
//IProject project = ResourceUtil.getFile(firstElement).getProject();
//add files to the task context
IInteractionContext activeContext = ContextCore.getContextManager().getActiveContext();
// List<InteractionContextElement> nodes = new ArrayList<InteractionContextElement>();
// InteractionContextElement node = new InteractionContextElement(
// InteractionEvent.Kind.MANIPULATION, firstElement.getHandleIdentifier(), (InteractionContext) activeContext); //$NON-NLS-1$ //$NON-NLS-2$
// nodes.add(node);
// IInteractionElement newElement = new CompositeContextElement(
// InteractionEvent.Kind.MANIPULATION, nodes, activeContext.getScaling()); //$NON-NLS-1$
// activeContext.getAllElements().add(newElement);
InteractionEvent event = new InteractionEvent(InteractionEvent.Kind.MANIPULATION,
"java", firstElement.getHandleIdentifier(), "source");
InteractionContextManager contextManager = ContextCorePlugin.getContextManager();
IInteractionElement element = contextManager.processInteractionEvent(event, true);
contextManager.manipulateInterestForElements(Collections.singletonList(element), true, false, false, "test",
contextManager.getActiveContext(), true);
But couple of things need to be working here.
(1) The element is added as an invisible element not as a visible element.
(2) The focus has not set to the particular file.
cheers,
Saurav
My Blog http://codifyit.blogspot.com/
Follow me: http://twitter.com/sauravs
|
|
|
Powered by
FUDForum. Page generated in 0.03337 seconds