[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
RE: [mylyn-integrators] Adding content to a new task before it opens
|
John,
Shawn's suggestions are a safer recommendation than what I'm about to
propose because they operate on the level of the task's data, and not of the
UI. The UI stuff can be slippery sometimes because the user could open a
task and then hit close it or make it lose focus right after, and you could
have in an unsaved state, or have made the change and saved the task without
the user having acknowledged it. But if what you're really after is doing
something when the task editor is opened the Mylyn Monitor provides a
mechanism for doing this. Use:
MonitorUiPlug.addWindowPartListener(IPartListener)
And then have your listener do an instanceof test on the part to see if it's
the editor that you're after. Mylyn will take care of applying the listener
to new windows and when they are opened, etc. (thank Brian de Alwis for that
:) Be sure to remove your listener when you're done or when your plug-in
stops.
Mik
> -----Original Message-----
> From: mylyn-integrators-bounces@xxxxxxxxxxx [mailto:mylyn-integrators-
> bounces@xxxxxxxxxxx] On Behalf Of Shawn Minto
> Sent: Thursday, October 25, 2007 3:49 PM
> To: Mylyn Integrators list
> Subject: Re: [mylyn-integrators] Adding content to a new task before it
> opens
>
> You could check out:
>
> org.eclipse.mylyn.internal.bugzilla.ide.actions.NewTaskFromErrorAction
>
> Maybe this is more what you want since it is more generic and works
> with repository tasks. You will need a separate action to run this
> type of code though since the generic one will only (maybe) take into
> account your current selection in the tasklist. I have never tried
> doing what you want to do, but it might be possible using some tricks
> when listening for part opened events, etc.
>
> Shawn
>
> On 10/25/07, John Anvik <janvik@xxxxxxxxxx> wrote:
> > Thanks Shawn.
> >
> > That will work for my current need, however I was aiming for
> something
> > that made better reuse of the existing Mylyn code.
> >
> > My thought was to extend the NewTaskAction and use it's run method
> since
> > it looks to handle the cases of new local task vs. new repository
> task
> > so nicely (admittedly I haven't explored new repository tasks yet, so
> > maybe this won't really work in the end).
> >
> > This is what motivated my question about being able to catch an "a
> new
> > task editor is about to open" event so that I could squeeze in there
> and
> > add some content. Is this possible?
> >
> > If not, I can use the existing the code from NewTaskAction as a model
> > and create separate actions for the two cases or mimic what is done
> there.
> >
> > John Anvik
> >
> > Shawn Minto wrote:
> > > Hey John,
> > >
> > > With my testing, this works to set the notes:
> > >
> > > AbstractTask task =
> > > TasksUiPlugin.getTaskListManager().createNewLocalTask(title);
> > > if (task != null){
> > > task.setNotes("this is a test");
> > > TasksUiUtil.openEditor(task, true);
> > > }
> > >
> > >
> > > Hope this helps
> > > Shawn
> > >
> > > On 10/25/07, John Anvik <janvik@xxxxxxxxxx> wrote:
> > >> I would like to add some information to a new task before it
> opens.
> > >> I tried catching the open event using a PartListener, but of
> course that
> > >> didn't work (at least the text that I inserted using
> > >> AbstractTask.setNotes() didn't work).
> > >>
> > >> How do I catch the creation of a task editor event so that I can
> > >> add some information to a new task before the editor opens?
> > >>
> > >> Pointers to code or tutorials also accepted. :)
> > >>
> > >> John Anvik
> > >> _______________________________________________
> > >> mylyn-integrators mailing list
> > >> mylyn-integrators@xxxxxxxxxxx
> > >> https://dev.eclipse.org/mailman/listinfo/mylyn-integrators
> > >>
> > >
> > >
> > _______________________________________________
> > mylyn-integrators mailing list
> > mylyn-integrators@xxxxxxxxxxx
> > https://dev.eclipse.org/mailman/listinfo/mylyn-integrators
> >
>
>
> --
> Shawn Minto
> sminto@xxxxxxxxx
> ----------------------------------------
> _______________________________________________
> mylyn-integrators mailing list
> mylyn-integrators@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/mylyn-integrators