Bug 110765

Summary: Allow to customize palette model creation
Product: [Modeling] GMF-Runtime Reporter: Dmitry Stadnik <dimzzy>
Component: GeneralAssignee: Cherie Revells <crevells>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: steveshaw
Version: unspecifiedKeywords: contributed
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Fix for DiagramEditorWithFlyOutPalette. none

Description Dmitry Stadnik CLA 2005-09-27 03:32:38 EDT
Class org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditorWithFlyOutPalette
has methods createPaletteRoot() and updatePaletteRoot() to provide palette
contents; I propose to change their visibility from private to protected so
clients may provide their own custom and efficient code to fill palette model.
When diagram editor is generated it's easier to maintain palette definition in
java code so the user may fine-tune it; plugin.xml also becomes noticeably smaller.
Comment 1 Steven R. Shaw CLA 2005-10-04 13:15:56 EDT
Sounds like a reasonable request to provide client flexibility.  However, I'm 
assuming this is "all or nothing"?  If clients decide to bypass the 
PaletteService, then they would have to override both these methods.  

Alternatively - would the suggested way to accomplish this would be to create 
their own PaletteProvider (overriding the DefaultPaletteProvider?  Then these 
methods could remain private.
Comment 2 Dmitry Stadnik CLA 2005-10-05 04:36:53 EDT
Well, I mean that it would be simplier and faster to call generated palette
factory code directly from generated diagram editor class and use palette
service as an extension mechanism, possibly by calling some method in generated
diagram editor superclass.

There are also common contributions that custom editor may wish to exclude or
replace; it's not possible now right?

It may also be desirable to allow custom palette update schemes; now as I
understand it is updated only when activities are changed. In custom editors for
example some tools may be available only when diagram model element has a
specific property or specific node exists on diagram.

In this sense the whole runtime is quite closed, since services dictate how
palette or edit part viewer should be filled; I think that users should extend
by subclassing first and allow third-party contributions by calling hooks in
superclasses.
Comment 3 Steven R. Shaw CLA 2005-10-06 14:35:45 EDT
Changing component to "Runtime Diagram"
Comment 4 Cherie Revells CLA 2005-10-14 11:09:24 EDT
Created attachment 28290 [details]
Fix for DiagramEditorWithFlyOutPalette.

Contributed by: Cherie Mahoney
Comment 5 Cherie Revells CLA 2005-10-14 11:11:14 EDT
Resolved.  See attached patch.

Purpose: 
Bugzilla 110765 Allow to customize palette model creation
- DiagramEditorWithFlyoutPalette.createPaletteRoot() is now protected.
- Removed private method DiagramEditorWithFlyoutPalette.updatePaletteRoot().  
The createPaletteRoot() method now optionally takes an existing palette root as 
a parameter in which case an update should be done.

Activities: 
Bugzilla 110765 gmf_head sshaw 051013 Allow to customize palette model creation

Code Reviewed by:
Steve

How tested: 
JUnit Tests:  
OK, Runs:	64, Fails:	0, Errors:	0, 
org.eclipse.gmf.tests.runtime.diagram.ui, Time:	83.718
Comment 6 Eclipse Webmaster CLA 2010-07-19 12:29:31 EDT
[GMF Restructure] Bug 319140 : product GMF and component
Runtime Diagram was the original product and component for this bug