Skip to main content


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
Member
Hi,
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
Peter
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: 127
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="http://www.eclipse.org/uml2/4.0.0/UML">
			
			<adviceBinding id="de.upb.swt.rsdl.editor.ext.advice.ClassEditHelperAdviceDiagram"
				class="de.upb.swt.rsdl.editor.ext.advice.ClassEditHelperAdvice"
				inheritance="all" typeId="org.eclipse.papyrus.uml.diagram.clazz.Class_2008">
			</adviceBinding>
			<adviceBinding id="de.upb.swt.rsdl.editor.ext.advice.ClassEditHelperAdviceTypes"
				class="de.upb.swt.rsdl.editor.ext.advice.ClassEditHelperAdvice"
				inheritance="all" typeId="org.eclipse.papyrus.uml.Class">
			</adviceBinding>
		</metamodel>
	</extension>
<extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypeBindings">
		<binding context="org.eclipse.papyrus.infra.services.edit.TypeContext">
			<advice ref="de.upb.swt.rsdl.editor.ext.advice.ClassEditHelperAdviceTypes" />
		</binding>
		<binding context="org.eclipse.papyrus.uml.diagram.clazz.TypeContext">
			<advice ref="de.upb.swt.rsdl.editor.ext.advice.ClassEditHelperAdviceDiagram" />
</binding>
</extension>


public class ClassEditHelperAdvice extends AbstractEditHelperAdvice {

	/**
	 * Context: diagram
	 */
	@Override
	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{
	
@Override
	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:Connection Handles gone in Papyrus 0.10.0
Next Topic:How in the world do you generate a papyrus model from an existing uml?
Goto Forum:
  


Current Time: Thu Apr 25 02:04:57 GMT 2024

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

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

Back to the top