Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » extending GraphicalEditorWithPalette
extending GraphicalEditorWithPalette [message #154733] Thu, 21 October 2004 17:03 Go to next message
Steve Harper is currently offline Steve HarperFriend
Messages: 29
Registered: July 2009
Junior Member
I've been shamelessly extending GraphicalEditorWithPalette even though the
JavaDoc warns:

"IMPORTANT This class should only be used as a reference for creating your
own EditorPart implementation. This class will not suit everyone's needs,
and may change in the future. Clients may copy the implementation. "

So I decided to copy the implementation as suggested. Since
GraphicalEditorWithPalette also extends GraphicalEditor (which carries
same warning) had to also copy GraphicalEditor.

I had to copy a third class - Splitter since it's declared in
org.eclipse.gef.ui.parts with package protection and it's used by
GraphicalEditorWithPalette.

Aside from complying with the javadoc warning, I was also looking to get a
Palette that was vertically oriented. Figured that for copying the 3 files
I could now easily get the orientation I wanted.

So in my version of GraphicalEditorWithPalette.createPartControl() I
replaced:
Splitter splitter = new Splitter(parent, SWT.HORIZONTAL);
with
Splitter splitter = new Splitter(parent, SWT.VERTICAL);

But after this change, the palette is taking up the left side of the
Editor rather than being across the top as I'd like.

So all this babbling really amounts to:

1) Is there an easy way to get the Palette to appear at the top of the
editor? Thought using a Vertically oriented splitter would have done that.
Sure looks like if I want a different Pallete position, have to copy the
classes and change something.

2) Even if I didn't want a different orientation, should I do what the
JavaDoc warning suggests and copy the classes? (A google search turned up
JavaDoc for several editors that extend these classes.)
Re: extending GraphicalEditorWithPalette [message #154741 is a reply to message #154733] Thu, 21 October 2004 17:43 Go to previous message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

The palette is not designed to layout horizontally, so unless you plan on
rewriting the palette, the results will not be great.

> I had to copy a third class - Splitter since it's declared in
> org.eclipse.gef.ui.parts with package protection and it's used by
> GraphicalEditorWithPalette.

There is an SWT class called SashForm. We didn't like it so we wrote our
own widget.

> Aside from complying with the javadoc warning, I was also looking to get a
> Palette that was vertically oriented. Figured that for copying the 3 files
> I could now easily get the orientation I wanted.
>
> So in my version of GraphicalEditorWithPalette.createPartControl() I
> replaced:
> Splitter splitter = new Splitter(parent, SWT.HORIZONTAL);
> with
> Splitter splitter = new Splitter(parent, SWT.VERTICAL);
>
> But after this change, the palette is taking up the left side of the
> Editor rather than being across the top as I'd like.

Maybe the style is being ignored or overwritten.

> 1) Is there an easy way to get the Palette to appear at the top of the
> editor? Thought using a Vertically oriented splitter would have done that.
> Sure looks like if I want a different Pallete position, have to copy the
> classes and change something.

In GEF 3.0 the palette can be inside a View, which can be placed anywhere,
including above the editor. Why not use that support?

> 2) Even if I didn't want a different orientation, should I do what the
> JavaDoc warning suggests and copy the classes? (A google search turned up
> JavaDoc for several editors that extend these classes.)

It's your call. The JavaDoc warning indicates that a future version of GEF
may break your subclass. It's not very likely, but we are just reserving
the right to fix bugs or make enhancements without being too confined.
Re: extending GraphicalEditorWithPalette [message #154773 is a reply to message #154733] Thu, 21 October 2004 17:41 Go to previous message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
1) Splitter is an internal class for exactly that reason. As that class
evolved, we just added the code to make it work with the vertical
orientation, not the horizontal one. Fixing it shouldn't be too tough
though (and perhaps, you can even contribute it to GEF). The real problem
will come with the palette itself (which uses a vertical ToolbarLayout).
Even if you use the horizontal ToolbarLayout, you'll most likely run into
several other layout problems (drawers will still have vertical layout,
columns layout might not work properly, scrollbars might appear in the wrong
place or not appear at all, text wrapping problems, some layouts might be
rendered inapplicable, etc.).

2) The JavaDoc warning absolves us of having to keep that editor's API
consistent. Feel free to subclass it, so long as you realize that we will
make changes to the superclasses whenever needed (which could possibly break
the API). If you do subclass it, just make sure to pay attention to any
changes in the superclasses whenever you upgrade the version of GEF you're
working with.

"Steve Harper" <steve_harper@adp.com> wrote in message
news:cl8q4c$mbk$1@eclipse.org...
> I've been shamelessly extending GraphicalEditorWithPalette even though the
> JavaDoc warns:
>
> "IMPORTANT This class should only be used as a reference for creating your
> own EditorPart implementation. This class will not suit everyone's needs,
> and may change in the future. Clients may copy the implementation. "
>
> So I decided to copy the implementation as suggested. Since
> GraphicalEditorWithPalette also extends GraphicalEditor (which carries
> same warning) had to also copy GraphicalEditor.
>
> I had to copy a third class - Splitter since it's declared in
> org.eclipse.gef.ui.parts with package protection and it's used by
> GraphicalEditorWithPalette.
>
> Aside from complying with the javadoc warning, I was also looking to get a
> Palette that was vertically oriented. Figured that for copying the 3 files
> I could now easily get the orientation I wanted.
>
> So in my version of GraphicalEditorWithPalette.createPartControl() I
> replaced:
> Splitter splitter = new Splitter(parent, SWT.HORIZONTAL);
> with
> Splitter splitter = new Splitter(parent, SWT.VERTICAL);
>
> But after this change, the palette is taking up the left side of the
> Editor rather than being across the top as I'd like.
>
> So all this babbling really amounts to:
>
> 1) Is there an easy way to get the Palette to appear at the top of the
> editor? Thought using a Vertically oriented splitter would have done that.
> Sure looks like if I want a different Pallete position, have to copy the
> classes and change something.
>
> 2) Even if I didn't want a different orientation, should I do what the
> JavaDoc warning suggests and copy the classes? (A google search turned up
> JavaDoc for several editors that extend these classes.)
>
>
>
>
Previous Topic:help
Next Topic:Logic example and scalableFreeform
Goto Forum:
  


Current Time: Wed Sep 04 21:24:59 GMT 2024

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

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

Back to the top