Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Mylyn » Create a new element in a context?
Create a new element in a context? [message #668769] Sat, 07 May 2011 09:49 Go to next message
Manuel Doninger is currently offline Manuel DoningerFriend
Messages: 119
Registered: October 2010
Senior Member
Hi,
how do i manually create and assign a new element to an active context, if it is not a file in the workspace (like the bookmarks in Tasktop Pro)? The reason is, i want to store some task related configurations for EGit in the task context, but so far i couldn't find the right thing in the Mylyn API.

I thought about something like

List<InteractionContextElement> nodes = new ArrayList<InteractionContextElement>();
InteractionContextElement node = new InteractionContextElement(
"meta/setting", "egitbranchsetting", (InteractionContext) activeContext); //$NON-NLS-1$ //$NON-NLS-2$
nodes.add(node);
IInteractionElement newElement = new CompositeContextElement(
"egitbranchsetting", nodes, activeContext.getScaling()); //$NON-NLS-1$
activeContext.getAllElements().add(newElement);

but i don't know, if this is right.

The configuration i want to store would be a list of Strings representing Git repositories, and a String representing a branch in that repositories.
(no subject) [message #671354 is a reply to message #668769] Tue, 17 May 2011 15:29 Go to previous messageGo to next message
Steffen Pingel is currently offline Steffen PingelFriend
Messages: 706
Registered: July 2009
Senior Member
Thanks for raising that and filing a bug. For anyone interested, please join
the discussion on this bug:

345661: API for storing task based SCM configuration in the Mylyn context
https://bugs.eclipse.org/bugs/show_bug.cgi?id=345661

Steffen


Manuel Doninger wrote:

> Hi,
> how do i manually create and assign a new element to an
> active context, if it is not a file in the workspace (like
> the bookmarks in Tasktop Pro)? The reason is, i want to
> store some task related configurations for EGit in the task
> context, but so far i couldn't find the right thing in the
> Mylyn API.
>
> I thought about something like
>
> List<InteractionContextElement> nodes = new
> ArrayList<InteractionContextElement>();
> InteractionContextElement node = new
> InteractionContextElement(
> "meta/setting", "egitbranchsetting",
> (InteractionContext) activeContext); //$NON-NLS-1$
> //$NON-NLS-2$
> nodes.add(node);
> IInteractionElement newElement = new
> CompositeContextElement(
> "egitbranchsetting", nodes, activeContext.getScaling());
> //$NON-NLS-1$
> activeContext.getAllElements().add(newElement);
>
> but i don't know, if this is right.
>
> The configuration i want to store would be a list of Strings
> representing Git repositories, and a String representing a
> branch in that repositories.

--
Steffen Pingel
Committer, http://eclipse.org/mylyn
Senior Developer, http://tasktop.com
(no subject) [message #676812 is a reply to message #671354] Mon, 06 June 2011 15:37 Go to previous message
Jan Mauersberger is currently offline Jan MauersbergerFriend
Messages: 120
Registered: July 2009
Senior Member
Hi,

while looking for some help with MyLyns context manipulation from code I
stumbled over this thread. In principle my issue is related: I want to
store my own type of elements in the context of a task and I started to
write my own structure bridge. I got it work to the point that my
elements are added to the context and shown as "Invisible Elements" in
the task editor but no further. All attempts to correctly return the
hierarchy of parent elements and to get them visible in the view failed.
I stumbled over some mylyn base code that seems to assume that the top
of such an element hierarchy is always a IResource, but I'm not sure.

So I have the following questions:

* First of all the context API seems to be completely private, no
"clean" way to add an object to a task context by code (or even to
create a task by code). Is there any planned enhancement (ticket) to
improve the API for integrators?

* What do I do wrong with my bridge when I only get the elements added
as invisible? Any hint highly appreciated.

* The ticket 345661 which was the result of Manuel's request seems to
be quite specific for his problem (store SCM information) but more
generally I do miss an API to store any kind of information, at least
strings directly to the context of a task. Is it possible to widen the
scope of the ticket or to discuss the general need to such an API?

If I do overlook something, please forgive me ;-)

Jan

> Thanks for raising that and filing a bug. For anyone interested, please join
> the discussion on this bug:
>
> 345661: API for storing task based SCM configuration in the Mylyn context
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=345661
>
Previous Topic:task.key
Next Topic:Create a new element in a context
Goto Forum:
  


Current Time: Fri Apr 26 14:32:15 GMT 2024

Powered by FUDForum. Page generated in 0.03178 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top