Home » Eclipse Projects » GEF » Multipage editor with multiple palette
Multipage editor with multiple palette [message #158687] |
Fri, 19 November 2004 11:06 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: none.none.com
Hi,
I am trying to write a MultiPageEditor, and I want to have a different
Palette for each Editor Page. It seems GEF only supports one Palette per
EditDomain, so what is the best way to make this work?
Thanks,
David
|
|
|
Re: Multipage editor with multiple palette [message #158695 is a reply to message #158687] |
Fri, 19 November 2004 12:59 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: notmymail.mail.net
On Fri, 19 Nov 2004 12:06:16 +0100, David Michonneau <none@none.com> wro=
te:
> Hi,
>
> I am trying to write a MultiPageEditor, and I want to have a different=
> Palette for each Editor Page. It seems GEF only supports one Palette p=
er
> EditDomain, so what is the best way to make this work?
>
> Thanks,
>
> David
>
>
In my editor there`s only the control group with a panningselection Tool=
=
first.
You can add and remove and edit other palette drawer during runtime via =
=
the customizer.
But if i understand you right you have two different static palettes.
You can simply add and remove different PaletteDrawers or GroupElements =
=
with different tools via a PaletteManager object.
Something like this:
if(page1 acive)
PaletteManager.setPage1Palette(root);
else
PaletteManager.setPage2Palette(root);
Make sure to remove the other drawer/groups first in the setPageXPalettt=
e =
methods.
In PaletteManager you have the folowing methods:
public static void setPage1Palette(PaletteRoot root){
root.removeAllEntries();
root.add(createPalette1());
}
public static void removeAllEntries(PaletteRoot root){
List entries =3D root.getChildren();
for(int i=3D0; i<entries.size();++i){
root.remove((PaletteEntry)entries.get(i));
}
}
you sould alread have the createPaletteX() methods....
For more explanation on this search this newsgroup for "customize palett=
e" =
or something like that
|
|
| |
Re: Multipage editor with multiple palette [message #158813 is a reply to message #158695] |
Fri, 19 November 2004 18:01 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: none.none.com
Unfortunately it doesn't work too well, removing all entries from the
paletteroot causes all kinds of problems. I managed to work around one or
two, but still, my tools become inactive when I switch tabs. I changed the
removeAllEntries to this code:
protected static void removeAllEntries(PaletteRoot root)
{
// get a live list of children
List entries = root.getChildren();
// marks the default entry as null, otherwise it causes exceptin
// when removed.
root.setDefaultEntry(null);
// remove the first element until nothing's left
while (entries.size() > 0 )
{
root.remove((PaletteEntry) entries.get(0));
}
}
on the first page, it works, on the second page, I can't drag anything on
the editor (no parking icon). It works when used as flyout, but not as a
view.
What am I missing? There is no exception thrown.
Thanks,
David
"Frank Dyck" <notmymail@mail.net> wrote in message
news:opshpqd6hns96bjs@celeron...
On Fri, 19 Nov 2004 12:06:16 +0100, David Michonneau <none@none.com> wrote:
> Hi,
>
> I am trying to write a MultiPageEditor, and I want to have a different
> Palette for each Editor Page. It seems GEF only supports one Palette per
> EditDomain, so what is the best way to make this work?
>
> Thanks,
>
> David
>
>
In my editor there`s only the control group with a panningselection Tool
first.
You can add and remove and edit other palette drawer during runtime via
the customizer.
But if i understand you right you have two different static palettes.
You can simply add and remove different PaletteDrawers or GroupElements
with different tools via a PaletteManager object.
Something like this:
if(page1 acive)
PaletteManager.setPage1Palette(root);
else
PaletteManager.setPage2Palette(root);
Make sure to remove the other drawer/groups first in the setPageXPalettte
methods.
In PaletteManager you have the folowing methods:
public static void setPage1Palette(PaletteRoot root){
root.removeAllEntries();
root.add(createPalette1());
}
public static void removeAllEntries(PaletteRoot root){
List entries = root.getChildren();
for(int i=0; i<entries.size();++i){
root.remove((PaletteEntry)entries.get(i));
}
}
you sould alread have the createPaletteX() methods....
For more explanation on this search this newsgroup for "customize palette"
or something like that
|
|
|
Re: Multipage editor with multiple palette [message #158829 is a reply to message #158798] |
Fri, 19 November 2004 18:04 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: none.none.com
My problem is that it doesn't seem switching pages in the multipage editor
will notify the Palette View that it needs to get the Palette Page again. Is
using multiple domain the recommended approach, but if so, how to work
around this problem?
Thanks,
David
"Randy Hudson" <none@us.ibm.com> wrote in message
news:cnlc84$i18$1@www.eclipse.org...
> Use multiple domains.
>
> "David Michonneau" <none@none.com> wrote in message
> news:cnkk34$cjt$1@www.eclipse.org...
>> Hi,
>>
>> I am trying to write a MultiPageEditor, and I want to have a different
>> Palette for each Editor Page. It seems GEF only supports one Palette per
>> EditDomain, so what is the best way to make this work?
>>
>> Thanks,
>>
>> David
>>
>>
>
>
|
|
|
Re: Multipage editor with multiple palette [message #158844 is a reply to message #158829] |
Fri, 19 November 2004 18:07 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: none.us.ibm.com
This is the same problem as the outline page. Unfortunately, one solution
involves writing a palette page which also flips pages when the MPE changes
tabs. Another HACK is to fake an SWT.Activate event on the Shell, which
will refire partActivation to all partlisteners (including the palette
viewer), which would then requery the editor for its palettepage. I
think...
https://bugs.eclipse.org/bugs/show_bug.cgi?id=46207
"David Michonneau" <none@none.com> wrote in message
news:cnlcir$imj$1@www.eclipse.org...
> My problem is that it doesn't seem switching pages in the multipage editor
> will notify the Palette View that it needs to get the Palette Page again.
Is
> using multiple domain the recommended approach, but if so, how to work
> around this problem?
>
> Thanks,
>
> David
>
>
> "Randy Hudson" <none@us.ibm.com> wrote in message
> news:cnlc84$i18$1@www.eclipse.org...
> > Use multiple domains.
> >
> > "David Michonneau" <none@none.com> wrote in message
> > news:cnkk34$cjt$1@www.eclipse.org...
> >> Hi,
> >>
> >> I am trying to write a MultiPageEditor, and I want to have a different
> >> Palette for each Editor Page. It seems GEF only supports one Palette
per
> >> EditDomain, so what is the best way to make this work?
> >>
> >> Thanks,
> >>
> >> David
> >>
> >>
> >
> >
>
>
|
|
|
Re: Multipage editor with multiple palette [message #158852 is a reply to message #158844] |
Fri, 19 November 2004 18:15 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: none.none.com
How can the palette page switch page? That logic is in the palette view
class.
About the hack, we tried something similar (just notify the palette view),
but the palette reverted to the wrong appearance while dragging a tool to
the editor, not sure why, clicking on the tool itself switched page on the
palette.
So now I tried the other solution provided in the thread, and I'm still
having problems...
Thanks,
David
"Randy Hudson" <none@us.ibm.com> wrote in message
news:cnlcp9$j2h$1@www.eclipse.org...
> This is the same problem as the outline page. Unfortunately, one solution
> involves writing a palette page which also flips pages when the MPE
> changes
> tabs. Another HACK is to fake an SWT.Activate event on the Shell, which
> will refire partActivation to all partlisteners (including the palette
> viewer), which would then requery the editor for its palettepage. I
> think...
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=46207
>
> "David Michonneau" <none@none.com> wrote in message
> news:cnlcir$imj$1@www.eclipse.org...
>> My problem is that it doesn't seem switching pages in the multipage
>> editor
>> will notify the Palette View that it needs to get the Palette Page again.
> Is
>> using multiple domain the recommended approach, but if so, how to work
>> around this problem?
>>
>> Thanks,
>>
>> David
>>
>>
>> "Randy Hudson" <none@us.ibm.com> wrote in message
>> news:cnlc84$i18$1@www.eclipse.org...
>> > Use multiple domains.
>> >
>> > "David Michonneau" <none@none.com> wrote in message
>> > news:cnkk34$cjt$1@www.eclipse.org...
>> >> Hi,
>> >>
>> >> I am trying to write a MultiPageEditor, and I want to have a different
>> >> Palette for each Editor Page. It seems GEF only supports one Palette
> per
>> >> EditDomain, so what is the best way to make this work?
>> >>
>> >> Thanks,
>> >>
>> >> David
>> >>
>> >>
>> >
>> >
>>
>>
>
>
|
|
|
Re: Multipage editor with multiple palette [message #158884 is a reply to message #158813] |
Fri, 19 November 2004 22:35 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: notmymail.mail.net
Ah, sorry. I seem to have circumvented that in my editor.
I left the default selection tool in the palette.
I have
public static void removeAllEntries(PaletteRoot root){
List entries =3D root.getChildren();
for(int i=3D 1 /*<<<!!!*/ ; i<entries.size();++i){
root.remove((PaletteEntry)entries.get(i));
}
}
as the removeAll method, leaving the control group (which is the first =
child of the root)
with the (default)selection tool always on the palette.
So that i never had those problems.
As for why it works in the second page as a flyout but not as a view i =
have no idea...
> Unfortunately it doesn't work too well, removing all entries from the
> paletteroot causes all kinds of problems. I managed to work around one=
or
> two, but still, my tools become inactive when I switch tabs. I changed=
=
> the
> removeAllEntries to this code:
>
> protected static void removeAllEntries(PaletteRoot root)
> {
> // get a live list of children
> List entries =3D root.getChildren();
> // marks the default entry as null, otherwise it causes except=
in
> // when removed.
> root.setDefaultEntry(null);
> // remove the first element until nothing's left
> while (entries.size() > 0 )
> {
> root.remove((PaletteEntry) entries.get(0));
> }
> }
>
> on the first page, it works, on the second page, I can't drag anything=
on
> the editor (no parking icon). It works when used as flyout, but not as=
a
> view.
>
> What am I missing? There is no exception thrown.
>
> Thanks,
>
> David
>
> "Frank Dyck" <notmymail@mail.net> wrote in message
> news:opshpqd6hns96bjs@celeron...
> On Fri, 19 Nov 2004 12:06:16 +0100, David Michonneau <none@none.com> =
> wrote:
>
>> Hi,
>>
>> I am trying to write a MultiPageEditor, and I want to have a differen=
t
>> Palette for each Editor Page. It seems GEF only supports one Palette =
per
>> EditDomain, so what is the best way to make this work?
>>
>> Thanks,
>>
>> David
>>
>>
>
> In my editor there`s only the control group with a panningselection To=
ol
> first.
> You can add and remove and edit other palette drawer during runtime vi=
a
> the customizer.
> But if i understand you right you have two different static palettes.
> You can simply add and remove different PaletteDrawers or GroupElement=
s
> with different tools via a PaletteManager object.
> Something like this:
>
> if(page1 acive)
> PaletteManager.setPage1Palette(root);
> else
> PaletteManager.setPage2Palette(root);
>
> Make sure to remove the other drawer/groups first in the setPageXPalet=
tte
> methods.
>
> In PaletteManager you have the folowing methods:
>
> public static void setPage1Palette(PaletteRoot root){
> root.removeAllEntries();
> root.add(createPalette1());
> }
>
> public static void removeAllEntries(PaletteRoot root){
> List entries =3D root.getChildren();
> for(int i=3D0; i<entries.size();++i){
> root.remove((PaletteEntry)entries.get(i));
> }
> }
>
> you sould alread have the createPaletteX() methods....
>
>
> For more explanation on this search this newsgroup for "customize =
> palette"
> or something like that
>
>
>
|
|
|
Re: Multipage editor with multiple palette [message #159073 is a reply to message #158844] |
Mon, 22 November 2004 17:55 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: none.none.com
That's not so simple, first the Workbench won't notify anybody if the active
part is the one you try to simulate an activation for, so you have to notify
the PaletteView directly. Then the PaletteView will always try to refresh
its PalettePage when any part is activated (itself for instance). And the
PaletteView maintains a hashtable of Editor/PalettePage, so when it gets the
PalettePage once for the MultiPageEditor, it won't ask again.
So the first thing to do is to flush the PaletteView, with partClosed(), and
then notify it with partActivated. Here is how I did it in the MPE:
protected void pageChange(int newPageIndex)
{
super.pageChange(newPageIndex);
IViewPart paletteView =
this.getSite().getPage().findViewReference(PaletteView.ID).g etView(false);
if ( paletteView != null )
{
((PaletteView)paletteView).partClosed(this);
((PaletteView)paletteView).partActivated(this);
}
}
It seems to work, but this is really ugly, so if anybody has a better
solution, I'll gladly take it. I couldn't make the changes to PaletteRoot
work, even by keeping the default tool in it, I guess the PaletteRoot
doesn't support very well add/remove operations on the fly.
Thanks,
David
"Randy Hudson" <none@us.ibm.com> wrote in message
news:cnlcp9$j2h$1@www.eclipse.org...
> This is the same problem as the outline page. Unfortunately, one solution
> involves writing a palette page which also flips pages when the MPE
> changes
> tabs. Another HACK is to fake an SWT.Activate event on the Shell, which
> will refire partActivation to all partlisteners (including the palette
> viewer), which would then requery the editor for its palettepage. I
> think...
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=46207
>
> "David Michonneau" <none@none.com> wrote in message
> news:cnlcir$imj$1@www.eclipse.org...
>> My problem is that it doesn't seem switching pages in the multipage
>> editor
>> will notify the Palette View that it needs to get the Palette Page again.
> Is
>> using multiple domain the recommended approach, but if so, how to work
>> around this problem?
>>
>> Thanks,
>>
>> David
>>
>>
>> "Randy Hudson" <none@us.ibm.com> wrote in message
>> news:cnlc84$i18$1@www.eclipse.org...
>> > Use multiple domains.
>> >
>> > "David Michonneau" <none@none.com> wrote in message
>> > news:cnkk34$cjt$1@www.eclipse.org...
>> >> Hi,
>> >>
>> >> I am trying to write a MultiPageEditor, and I want to have a different
>> >> Palette for each Editor Page. It seems GEF only supports one Palette
> per
>> >> EditDomain, so what is the best way to make this work?
>> >>
>> >> Thanks,
>> >>
>> >> David
>> >>
>> >>
>> >
>> >
>>
>>
>
>
|
|
|
Goto Forum:
Current Time: Fri Aug 23 09:16:28 GMT 2024
Powered by FUDForum. Page generated in 0.04391 seconds
|