Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » MultiPageEditor - Sharing common palette preferences across editor tabs
MultiPageEditor - Sharing common palette preferences across editor tabs [message #223438] Wed, 27 September 2006 04:38 Go to next message
Eclipse UserFriend
Originally posted by: prashanto.chatterjee.softwareag.com

Hi GEF Geeks,
Yet another multi-page editor query ;-).

I have a scenario wherein I have a multi-page editor with three pages. The
first one is a graphical layout editor, the second is a tree layout editor
(both of which share a common palette root and common edit domain) and an
XML editor as the last page.

When I change the docking position of the palette in any of my graphical
editor tabs(either layout or tree); I change my palette preferences; in
which case I would ideally want that the same docking position is
reflected in the other tab too. However, this is not the case as the
palette preferences are only loaded once when we create a new
GraphicalEditorWithFlyoutPalette. Thereafter its only reflected
uniformally across pages on subsequent invocation of the editor. There is
no handle to change those preferences.

I tried to register a ControlListener as follows:

------------------------------------------------------------ ------------------
protected void configureGraphicalViewer() {
super.configureGraphicalViewer();

/*getGraphicalControl().addControlListener(new ControlAdapter(){

public void controlMoved(ControlEvent e) {
super.controlMoved(e);

}

});*/

getGraphicalControl().addControlListener(new MyControlAdapter(parent,
this));

}

class MyControlAdapter extends ControlAdapter {

private MultiPageSequenceEditor multiEditor;
private AbstractEditorPage editorPage;

public MyControlAdapter(MultiPageSequenceEditor multiEditor,
AbstractEditorPage editorPage) {
this.multiEditor = multiEditor;
this.editorPage = editorPage;
}

public void controlMoved(ControlEvent e) {
super.controlMoved(e);
if(editorPage instanceof SequenceEditor){
//Palette docking changed inside graphical layout
- reflect in tree
//multiEditor.getTreeEditor().createPartControl(multiEditor. getTreeEditor().getGraphicalControl().getParent());
FlyoutPaletteComposite paletteComposite =
(FlyoutPaletteComposite)multiEditor.getTreeEditor().getGraph icalControl().getParent();
paletteComposite.layout(true);
}else if(editorPage instanceof TreeEditor){
//Palette docking changed inside tree layout -
reflect in graphical
//multiEditor.getLayoutEditor().createPartControl(multiEdito r.getLayoutEditor().getGraphicalControl().getParent());
FlyoutPaletteComposite paletteComposite =
(FlyoutPaletteComposite)multiEditor.getLayoutEditor().getGra phicalControl().getParent();
paletteComposite.layout(true);
}
}
}
------------------------------------------------------------ ------------------

This is called when I change the docking position of my palette. This
approach has no effect on the layout of the editor composite.

Is there any way I can reflect the changed palette preferences dynamically
across multi-page editor pages?

I would sincerely appreciate any help in this regard.

Kind Regards,
Prashanto
Re: MultiPageEditor - Sharing common palette preferences across editor tabs [message #223613 is a reply to message #223438] Mon, 02 October 2006 19:58 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.ibm.com

I'm not sure why FlyoutPreferences are so different from
PaletteViewerPreferences. The viewer's preferences notify when they change,
and all instances stay in sync. Open a feature request. Maybe flyouts
should be linked together too.

BTW, could you put your editors inside the Flyout Composite? That way, each
editor actually would be using the same palette.

"Prashanto Chatterjee" <prashanto.chatterjee@softwareag.com> wrote in
message news:595805c5fd0ca768461a58860696e1fc$1@www.eclipse.org...
> Hi GEF Geeks,
> Yet another multi-page editor query ;-).
>
> I have a scenario wherein I have a multi-page editor with three pages. The
> first one is a graphical layout editor, the second is a tree layout editor
> (both of which share a common palette root and common edit domain) and an
> XML editor as the last page.
>
> When I change the docking position of the palette in any of my graphical
> editor tabs(either layout or tree); I change my palette preferences; in
> which case I would ideally want that the same docking position is
> reflected in the other tab too. However, this is not the case as the
> palette preferences are only loaded once when we create a new
> GraphicalEditorWithFlyoutPalette. Thereafter its only reflected
> uniformally across pages on subsequent invocation of the editor. There is
> no handle to change those preferences.
> I tried to register a ControlListener as follows:
>
> ------------------------------------------------------------ ------------------
> protected void configureGraphicalViewer() {
> super.configureGraphicalViewer();
>
> /*getGraphicalControl().addControlListener(new ControlAdapter(){
>
> public void controlMoved(ControlEvent e) {
> super.controlMoved(e);
>
> }
>
> });*/
>
> getGraphicalControl().addControlListener(new MyControlAdapter(parent,
> this));
>
> }
>
> class MyControlAdapter extends ControlAdapter {
>
> private MultiPageSequenceEditor multiEditor;
> private AbstractEditorPage editorPage;
>
> public MyControlAdapter(MultiPageSequenceEditor multiEditor,
> AbstractEditorPage editorPage) {
> this.multiEditor = multiEditor;
> this.editorPage = editorPage;
> }
>
> public void controlMoved(ControlEvent e) {
> super.controlMoved(e);
> if(editorPage instanceof SequenceEditor){
> //Palette docking changed inside graphical layout -
> reflect in tree
> //multiEditor.getTreeEditor().createPartControl(multiEditor. getTreeEditor().getGraphicalControl().getParent());
> FlyoutPaletteComposite paletteComposite =
> (FlyoutPaletteComposite)multiEditor.getTreeEditor().getGraph icalControl().getParent();
> paletteComposite.layout(true);
> }else if(editorPage instanceof TreeEditor){
> //Palette docking changed inside tree layout -
> reflect in graphical
> //multiEditor.getLayoutEditor().createPartControl(multiEdito r.getLayoutEditor().getGraphicalControl().getParent());
> FlyoutPaletteComposite paletteComposite =
> (FlyoutPaletteComposite)multiEditor.getLayoutEditor().getGra phicalControl().getParent();
> paletteComposite.layout(true);
> }
> } }
> ------------------------------------------------------------ ------------------
>
> This is called when I change the docking position of my palette. This
> approach has no effect on the layout of the editor composite.
>
> Is there any way I can reflect the changed palette preferences dynamically
> across multi-page editor pages?
>
> I would sincerely appreciate any help in this regard.
>
> Kind Regards,
> Prashanto
>
>
Re: MultiPageEditor - Sharing common palette preferences across editor tabs [message #223636 is a reply to message #223613] Tue, 03 October 2006 10:59 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: prashanto.chatterjee.softwareag.com

Hi Randy,
I appreciate your taking some time out and answering my query.

I am not too sure as to what you meant by 'could you put your editors inside
the Flyout Composite'. However, what I am trying to do is best put in
another of my queries which I had posted and is titled:
'MultiPageEditors: About common edit domain and common palette root'

All these questions are stemming from the fact that basically I feel that I
have not been able to accomplish the common palette root properly.
What I do is to have the palette root reference maintained by the multi-page
editor and inside createPaletteViewerProvider method I set the palette root
to the common reference (However, after reading your response I am seriously
doubting this approach).
Apart from that, basically all the other calls and configurations are same
as in a GraphicalEditorWithFlyoutPalette.

What is your take on having the same palette shared across different editor
pages? How do we go about it?

As always, any help would be deeply appreciated.

Regards,
Prashanto


"Randy Hudson" <none@ibm.com> wrote in message
news:efrr0l$76e$1@utils.eclipse.org...
> I'm not sure why FlyoutPreferences are so different from
> PaletteViewerPreferences. The viewer's preferences notify when they
> change, and all instances stay in sync. Open a feature request. Maybe
> flyouts should be linked together too.
>
> BTW, could you put your editors inside the Flyout Composite? That way,
> each editor actually would be using the same palette.
>
> "Prashanto Chatterjee" <prashanto.chatterjee@softwareag.com> wrote in
> message news:595805c5fd0ca768461a58860696e1fc$1@www.eclipse.org...
>> Hi GEF Geeks,
>> Yet another multi-page editor query ;-).
>>
>> I have a scenario wherein I have a multi-page editor with three pages.
>> The first one is a graphical layout editor, the second is a tree layout
>> editor (both of which share a common palette root and common edit domain)
>> and an XML editor as the last page.
>>
>> When I change the docking position of the palette in any of my graphical
>> editor tabs(either layout or tree); I change my palette preferences; in
>> which case I would ideally want that the same docking position is
>> reflected in the other tab too. However, this is not the case as the
>> palette preferences are only loaded once when we create a new
>> GraphicalEditorWithFlyoutPalette. Thereafter its only reflected
>> uniformally across pages on subsequent invocation of the editor. There is
>> no handle to change those preferences.
>> I tried to register a ControlListener as follows:
>>
>> ------------------------------------------------------------ ------------------
>> protected void configureGraphicalViewer() {
>> super.configureGraphicalViewer();
>>
>> /*getGraphicalControl().addControlListener(new ControlAdapter(){
>>
>> public void controlMoved(ControlEvent e) {
>> super.controlMoved(e);
>>
>> }
>>
>> });*/
>>
>> getGraphicalControl().addControlListener(new MyControlAdapter(parent,
>> this));
>>
>> }
>>
>> class MyControlAdapter extends ControlAdapter {
>>
>> private MultiPageSequenceEditor multiEditor;
>> private AbstractEditorPage editorPage;
>>
>> public MyControlAdapter(MultiPageSequenceEditor multiEditor,
>> AbstractEditorPage editorPage) {
>> this.multiEditor = multiEditor;
>> this.editorPage = editorPage;
>> }
>>
>> public void controlMoved(ControlEvent e) {
>> super.controlMoved(e);
>> if(editorPage instanceof SequenceEditor){
>> //Palette docking changed inside graphical
>> layout - reflect in tree
>> //multiEditor.getTreeEditor().createPartControl(multiEditor. getTreeEditor().getGraphicalControl().getParent());
>> FlyoutPaletteComposite paletteComposite =
>> (FlyoutPaletteComposite)multiEditor.getTreeEditor().getGraph icalControl().getParent();
>> paletteComposite.layout(true);
>> }else if(editorPage instanceof TreeEditor){
>> //Palette docking changed inside tree layout -
>> reflect in graphical
>> //multiEditor.getLayoutEditor().createPartControl(multiEdito r.getLayoutEditor().getGraphicalControl().getParent());
>> FlyoutPaletteComposite paletteComposite =
>> (FlyoutPaletteComposite)multiEditor.getLayoutEditor().getGra phicalControl().getParent();
>> paletteComposite.layout(true);
>> }
>> } }
>> ------------------------------------------------------------ ------------------
>>
>> This is called when I change the docking position of my palette. This
>> approach has no effect on the layout of the editor composite.
>>
>> Is there any way I can reflect the changed palette preferences
>> dynamically across multi-page editor pages?
>>
>> I would sincerely appreciate any help in this regard.
>>
>> Kind Regards,
>> Prashanto
>>
>>
>
>
Re: MultiPageEditor - Sharing common palette preferences across editor tabs [message #227090 is a reply to message #223636] Tue, 28 November 2006 20:09 Go to previous message
drew frantz is currently offline drew frantzFriend
Messages: 340
Registered: July 2009
Senior Member
Was this question ever answered? I am having the same problem.

"Prashanto Chatterjee" <prashanto.chatterjee@softwareag.com> wrote in
message news:eftfqi$psh$1@utils.eclipse.org...
> Hi Randy,
> I appreciate your taking some time out and answering my query.
>
> I am not too sure as to what you meant by 'could you put your editors
inside
> the Flyout Composite'. However, what I am trying to do is best put in
> another of my queries which I had posted and is titled:
> 'MultiPageEditors: About common edit domain and common palette root'
>
> All these questions are stemming from the fact that basically I feel that
I
> have not been able to accomplish the common palette root properly.
> What I do is to have the palette root reference maintained by the
multi-page
> editor and inside createPaletteViewerProvider method I set the palette
root
> to the common reference (However, after reading your response I am
seriously
> doubting this approach).
> Apart from that, basically all the other calls and configurations are same
> as in a GraphicalEditorWithFlyoutPalette.
>
> What is your take on having the same palette shared across different
editor
> pages? How do we go about it?
>
> As always, any help would be deeply appreciated.
>
> Regards,
> Prashanto
>
>
> "Randy Hudson" <none@ibm.com> wrote in message
> news:efrr0l$76e$1@utils.eclipse.org...
> > I'm not sure why FlyoutPreferences are so different from
> > PaletteViewerPreferences. The viewer's preferences notify when they
> > change, and all instances stay in sync. Open a feature request. Maybe
> > flyouts should be linked together too.
> >
> > BTW, could you put your editors inside the Flyout Composite? That way,
> > each editor actually would be using the same palette.
> >
> > "Prashanto Chatterjee" <prashanto.chatterjee@softwareag.com> wrote in
> > message news:595805c5fd0ca768461a58860696e1fc$1@www.eclipse.org...
> >> Hi GEF Geeks,
> >> Yet another multi-page editor query ;-).
> >>
> >> I have a scenario wherein I have a multi-page editor with three pages.
> >> The first one is a graphical layout editor, the second is a tree layout
> >> editor (both of which share a common palette root and common edit
domain)
> >> and an XML editor as the last page.
> >>
> >> When I change the docking position of the palette in any of my
graphical
> >> editor tabs(either layout or tree); I change my palette preferences; in
> >> which case I would ideally want that the same docking position is
> >> reflected in the other tab too. However, this is not the case as the
> >> palette preferences are only loaded once when we create a new
> >> GraphicalEditorWithFlyoutPalette. Thereafter its only reflected
> >> uniformally across pages on subsequent invocation of the editor. There
is
> >> no handle to change those preferences.
> >> I tried to register a ControlListener as follows:
> >>
>
>> ------------------------------------------------------------ -------------
-----
> >> protected void configureGraphicalViewer() {
> >> super.configureGraphicalViewer();
> >>
> >> /*getGraphicalControl().addControlListener(new ControlAdapter(){
> >>
> >> public void controlMoved(ControlEvent e) {
> >> super.controlMoved(e);
> >>
> >> }
> >>
> >> });*/
> >>
> >> getGraphicalControl().addControlListener(new MyControlAdapter(parent,
> >> this));
> >>
> >> }
> >>
> >> class MyControlAdapter extends ControlAdapter {
> >>
> >> private MultiPageSequenceEditor multiEditor;
> >> private AbstractEditorPage editorPage;
> >>
> >> public MyControlAdapter(MultiPageSequenceEditor multiEditor,
> >> AbstractEditorPage editorPage) {
> >> this.multiEditor = multiEditor;
> >> this.editorPage = editorPage;
> >> }
> >>
> >> public void controlMoved(ControlEvent e) {
> >> super.controlMoved(e);
> >> if(editorPage instanceof SequenceEditor){
> >> //Palette docking changed inside graphical
> >> layout - reflect in tree
> >>
//multiEditor.getTreeEditor().createPartControl(multiEditor. getTreeEditor().
getGraphicalControl().getParent());
> >> FlyoutPaletteComposite paletteComposite =
> >>
(FlyoutPaletteComposite)multiEditor.getTreeEditor().getGraph icalControl().ge
tParent();
> >> paletteComposite.layout(true);
> >> }else if(editorPage instanceof TreeEditor){
> >> //Palette docking changed inside tree layout -
> >> reflect in graphical
> >>
//multiEditor.getLayoutEditor().createPartControl(multiEdito r.getLayoutEdito
r().getGraphicalControl().getParent());
> >> FlyoutPaletteComposite paletteComposite
=
> >>
(FlyoutPaletteComposite)multiEditor.getLayoutEditor().getGra phicalControl().
getParent();
> >> paletteComposite.layout(true);
> >> }
> >> } }
>
>> ------------------------------------------------------------ -------------
-----
> >>
> >> This is called when I change the docking position of my palette. This
> >> approach has no effect on the layout of the editor composite.
> >>
> >> Is there any way I can reflect the changed palette preferences
> >> dynamically across multi-page editor pages?
> >>
> >> I would sincerely appreciate any help in this regard.
> >>
> >> Kind Regards,
> >> Prashanto
> >>
> >>
> >
> >
>
>
Previous Topic:zooming problem
Next Topic:FigureCanvas scrollbars dont work
Goto Forum:
  


Current Time: Wed Apr 24 16:54:04 GMT 2024

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

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

Back to the top