Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Configure created Element
Configure created Element [message #1080207] Mon, 05 August 2013 16:05 Go to next message
Peter Mising name is currently offline Peter Mising nameFriend
Messages: 95
Registered: July 2009
what is the right entry point to configure a created element? In this
case I want to add a Stereotype and the element should show the
Stereotype so I think I should execute the ApplyStereotypeCommand() and
the DefferedAppliedStereotypeToDisplayCommand() but where?
Normally the edit.commands are a good place but Papyrus donĀ“t call them?!
Thanks in advance
Re: Configure created Element [message #1084895 is a reply to message #1080207] Mon, 12 August 2013 07:32 Go to previous message
Simon Schwichtenberg is currently offline Simon SchwichtenbergFriend
Messages: 126
Registered: September 2011
Senior Member
Consider the palette customization. There you can create your own tools for model elements with applied stereotypes.

Otherwise you can use the extension point for advices and add your code to the getAfterConfigureCommand.

	<extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypes">
		<metamodel nsURI="">
			<adviceBinding id="de.upb.swt.rsdl.editor.ext.advice.ClassEditHelperAdviceDiagram"
				inheritance="all" typeId="org.eclipse.papyrus.uml.diagram.clazz.Class_2008">
			<adviceBinding id="de.upb.swt.rsdl.editor.ext.advice.ClassEditHelperAdviceTypes"
				inheritance="all" typeId="org.eclipse.papyrus.uml.Class">
<extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypeBindings">
		<binding context="">
			<advice ref="de.upb.swt.rsdl.editor.ext.advice.ClassEditHelperAdviceTypes" />
		<binding context="org.eclipse.papyrus.uml.diagram.clazz.TypeContext">
			<advice ref="de.upb.swt.rsdl.editor.ext.advice.ClassEditHelperAdviceDiagram" />

public class ClassEditHelperAdvice extends AbstractEditHelperAdvice {

	 * Context: diagram
	protected ICommand getAfterConfigureCommand(ConfigureRequest request) {

		if(request.getElementToConfigure() instanceof Class){
			return new ClassCreateCommand(request);
		return super.getAfterConfigureCommand(request);

public class ClassCreateCommand extends org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand{
	protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Class clazz = (Class) configureRequest.getElementToConfigure();
//apply stereotype

[Updated on: Mon, 12 August 2013 07:35]

Report message to a moderator

Previous Topic:Profile mode does not allows classes
Next Topic:Allocation table and "Allocated from"
Goto Forum:

Current Time: Sat Dec 16 07:07:49 GMT 2017

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

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