Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Create a fugure automatically
Create a fugure automatically [message #646222] Wed, 22 December 2010 18:01 Go to next message
Elhamlaoui Mahmoud is currently offline Elhamlaoui MahmoudFriend
Messages: 268
Registered: March 2010
Senior Member
Hi,

I wonder if there is a way to hide the line that is always displayed inside a container?

thanks
Re: Create a fugure automatically [message #646296 is a reply to message #646222] Thu, 23 December 2010 08:23 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: marius.groeger.googlemail.com

On 22.12.2010 19:01, Elhamlaoui Mahmoud wrote:
> Hi,
>
> I wonder if there is a way to hide the line that is always displayed
> inside a container?

Add a setBorder(null) for the Figure of the edit part in question.

Regards
Marius
Re: Create a fugure automatically [message #646300 is a reply to message #646296] Thu, 23 December 2010 09:11 Go to previous messageGo to next message
Elhamlaoui Mahmoud is currently offline Elhamlaoui MahmoudFriend
Messages: 268
Registered: March 2010
Senior Member
Hi,

Its working Embarrassed , thanks for the clue
mahmoud
Re: Create a fugure automatically [message #646339 is a reply to message #646300] Thu, 23 December 2010 12:12 Go to previous messageGo to next message
Ralph Gerbig is currently offline Ralph GerbigFriend
Messages: 702
Registered: November 2009
Senior Member
Hi,

I changed the method createFigure of the compartments EditPart to:

 /**
 * @generated NOT
 */
public IFigure createFigure() {
   ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
   result.setTitleVisibility(false);
   //changed code
   result.setBorder(null);
   return result;
}


That works great! But is there a way to achieve this using the gmfgraph model?

Thanks,

Ralph
Re: Create a fugure automatically [message #646358 is a reply to message #646339] Thu, 23 December 2010 13:13 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: marius.groeger.googlemail.com

On 23.12.2010 13:12, ralph. wrote:
> Hi,
>
> I changed the method createFigure of the compartments EditPart to:
>
>
> /**
> * @generated NOT
> */
> public IFigure createFigure() {
> ResizableCompartmentFigure result = (ResizableCompartmentFigure)
> super.createFigure();
> result.setTitleVisibility(false);
> //changed code
> result.setBorder(null);
> return result;
> }
>
> That works great! But is there a way to achieve this using the gmfgraph
> model?

Not that I know of. To alter the impementation of EditParts I'm not
using a custom EditPart provider, see the "gmfgraph -> Node -> Content
Pane" thread for details.
Re: Create a fugure automatically [message #646359 is a reply to message #646358] Thu, 23 December 2010 13:34 Go to previous messageGo to next message
Ralph Gerbig is currently offline Ralph GerbigFriend
Messages: 702
Registered: November 2009
Senior Member
Hi,

I unfortunatly do not know where to look for the "gmfgraph -> Node -> Content Pane" thread. Where can I find this one? Is it in the forums?

ralph.
Re: Create a fugure automatically [message #646370 is a reply to message #646359] Thu, 23 December 2010 14:28 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: marius.groeger.googlemail.com

On 23.12.2010 14:34, ralph. wrote:
> gmfgraph -> Node -> Content Pane

Well this is the news: protocol, so those messages should still be
available in your reader...

http://www.eclipse.org/forums/index.php?t=tree&goto=6451 25&S=fa3ad2792435e37af379b285f07262ad
Re: Create a fugure automatically [message #646762 is a reply to message #646370] Thu, 30 December 2010 19:10 Go to previous messageGo to next message
Elhamlaoui Mahmoud is currently offline Elhamlaoui MahmoudFriend
Messages: 268
Registered: March 2010
Senior Member
Hi,

I had the same problem and i used Xpand template to generated
Quote:
result.setBorder(null);


you can have more details : http://www.bonitasoft.org/blog/eclipse/our-eclipse-summit-eu rope/#more-2436
Re: Create a fugure automatically [message #646824 is a reply to message #646762] Fri, 31 December 2010 16:26 Go to previous messageGo to next message
Ralph Gerbig is currently offline Ralph GerbigFriend
Messages: 702
Registered: November 2009
Senior Member
No Message Body

[Updated on: Sun, 02 January 2011 15:24]

Report message to a moderator

Re: Create a fugure automatically [message #646889 is a reply to message #646762] Sun, 02 January 2011 15:23 Go to previous messageGo to next message
Ralph Gerbig is currently offline Ralph GerbigFriend
Messages: 702
Registered: November 2009
Senior Member
Hi,

I have this custom template is there a better way to do it?

«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»

«AROUND createFigure FOR gmfgen::GenCompartment»
	«IF self.editPartClassName = 'xxxCompartmentEditPart'»
		«REM»By default titles are shown even if there are no TitleStyle, we need to switch it off«ENDREM»«-»
		«EXPAND xpt::Common::generatedMemberComment»
		public org.eclipse.draw2d.IFigure createFigure() {
			org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure result = (org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure) super.createFigure();
			result.setTitleVisibility(false);
			result.setBorder(null);
			return result;
		}
	«ELSEIF not needsTitle»
		«REM»By default titles are shown even if there are no TitleStyle, we need to switch it off«ENDREM»«-»
		«EXPAND xpt::Common::generatedMemberComment»
		public org.eclipse.draw2d.IFigure createFigure() {
			org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure result = (org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure) super.createFigure();
			result.setTitleVisibility(false);
			return result;
		}
	«ENDIF»
«ENDAROUND»


Ralph
Re: Create a fugure automatically [message #647037 is a reply to message #646889] Tue, 04 January 2011 09:03 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: marius.groeger.googlemail.com

On 02.01.2011 16:23, ralph. wrote:
> I have this custom template is there a better way to do it?

You could consider using an custom EditPartProvider as an overlay to the
generated one. This way you can extend the generated Java edit part
class and override what you need to.

+ modification can be better maintained, since on the Java level
+ probably easier to migrate to a new GMF version
- doesn't work well for multiple edit parts sharing the same modification
- doesn't survive drastic model changes such as news names, classes etc.


Regards
Marius
Re: Create a fugure automatically [message #647112 is a reply to message #647037] Tue, 04 January 2011 16:25 Go to previous messageGo to next message
Ralph Gerbig is currently offline Ralph GerbigFriend
Messages: 702
Registered: November 2009
Senior Member
Hi,

Quote:
+ probably easier to migrate to a new GMF version


I extended my code to use the standard definition when a different edipart is present then the one I want:

«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»

«AROUND createFigure FOR gmfgen::GenCompartment»
	«IF self.editPartClassName = 'xxxCompartmentEditPart'»
		«REM»By default titles are shown even if there are no TitleStyle, we need to switch it off«ENDREM»«-»
		«EXPAND xpt::Common::generatedMemberComment»
		public org.eclipse.draw2d.IFigure createFigure() {
			org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure result = (org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure) super.createFigure();
			result.setTitleVisibility(false);
			result.setBorder(null);
			return result;
		}
	«ELSE»
		«targetDef.proceed()»
	«ENDIF»
«ENDAROUND»


«targetDef.proceed()» executes the original template definition. This will make it easier to migrate to a new GMF version as for all edit parts that do not match my condition the default template code is executed.

Ralph
Re: Create a fugure automatically [message #647139 is a reply to message #647112] Tue, 04 January 2011 17:18 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: marius.groeger.googlemail.com

On 04.01.2011 17:25, ralph. wrote:
> «targetDef.proceed()» executes the original template definition. This
> will make it easier to migrate to a new GMF version as for all edit
> parts that do not match my condition the default template code is executed.

Definitely a good idea.

Just to note - when I was mentioning migration issues I was more
referring to the overall structure of the Xpand template code you hook
into.

Regards
Marius
Re: Create a fugure automatically [message #647441 is a reply to message #646222] Thu, 06 January 2011 12:14 Go to previous messageGo to next message
Elhamlaoui Mahmoud is currently offline Elhamlaoui MahmoudFriend
Messages: 268
Registered: March 2010
Senior Member
Hi marius & ralph,

In my metamodel i have sevral element that i want to refer in the gmfmap,let say A,B,C,D,E. i have define the graph of A and B, and i want that the add one figure that gona be used by the tree aither without having to mention them all in gmfmap.
Is that possible

thanks a lot
Re: Create a fugure automatically [message #647443 is a reply to message #647441] Thu, 06 January 2011 12:22 Go to previous messageGo to next message
Ralph Gerbig is currently offline Ralph GerbigFriend
Messages: 702
Registered: November 2009
Senior Member
Hi,

is it possible to open a new topic for this issue. As it seems to be a new question not related to the previous contend of this thread. So your possible solution can be found by others and everyone can participate in the discusion.

You can add multiple mappings of meta model elements to only one gmfgraph figure and you can add one tooling to more than one mapping by using OCL constrained. I am not aware of the possibility to have only one mapping for several meta model elements. Maybe you could describe you use case in more detail. So someone might find a solution.

Thanks,

Ralpj
Re: Create a fugure automatically [message #647462 is a reply to message #647443] Thu, 06 January 2011 14:47 Go to previous message
Elhamlaoui Mahmoud is currently offline Elhamlaoui MahmoudFriend
Messages: 268
Registered: March 2010
Senior Member
Hi ralph,

i thought that using something like in the previous template could solve my problem, like using something like «targetDef.proceed()» but anyway i will start a new topic.

thanks again
Previous Topic:How to run expression of expression label mapping by code
Next Topic:What's new in GMF 2.4M4?
Goto Forum:
  


Current Time: Tue Mar 19 09:43:31 GMT 2024

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

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

Back to the top