[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.modeling.gmt.amw] Re: extend weaving panel

Hi

there are two ways to do it, depending on the moment you need to trigger the validation.

------------------------------------------------------------------------------------------

1) if you trigger the validation in the moment you click over a link, it generates a context menu with the possible WLinkEnds (e.g. a right link) that can be created. The solution is to restrict the elements that will be created.

To do that, you need to override the method

- public Collection getChildren(Object object)

in the class WLinkItemProvider.
Then you create an extension point as in the plugin.xml file of the org.eclipse.weaver.extension plugin


	<extension
   		point="org.eclipse.weaver.itemProviderID"
   		id="ItemProviderExtension">
   		<itemProviderAdapter 	   		
	   		name="Base Item provider extension"
			class="org.eclipse.weaver.extension.providers.YourProvider"
   			adaptedClassName="YourLink"
   			icon="icons/someniceimage.gif"
   			default="false"
   			isChildrenProvider="false"/>   		
   	</extension>      	  	 	

You should implement using the reflective API of EMF, i.e., using EObjects, and eSet and eGet methods. Take a look on the current getChildren method to have an idea.

Here you find the metamodel:
http://download.eclipse.org/tools/emf/javadoc/?org/eclipse/emf/ecore/package-summary.html#details

In this link (http://dev.eclipse.org/viewcvs/indextools.cgi/org.eclipse.emf/doc/org.eclipse.emf.doc/references/overview/EMF.html?rev=1.12)

you have ate the end a section about the reflective API.

----------------------------------------------------------------------------------------------------

2) If you want to trigger the validation in the exact moment you click in the right link that you want to create, or when you drop an element on a link.

In this case, you should override the

- public void createWLinkEndActions(EObject wLinkEnd)

method in the DefaultWeavingPanel class. This method creates a list of actions that are executed in the moment you create a WLinkEnd.

Then you should use the following extension point

   <extension
   		point="org.eclipse.weaver.weavingPanelID"
   		id="DefaultWeavingPanelExtension">
   		<weavingPanel 	   		
	   		name="Base weaving panel extension"
			class="org.eclipse.weaver.extension.panel.YourNewWeavingPanel"/>   		
	</extension>
   	
The implementation is done also using the reflective API of EMF.

Regards,

Marcos.


Kelly Garcés wrote:
Hi!

is it posible extends DefaultWeavingPanel?. When i create a link element its ok, but i want to trigger a validation when i add a right link. I´m amateur in EMF, could you tell me about easy tutorials?, i need develop this extension fastly.

I reviewed documentation in org.eclipse.weaver.doc.developer.

Thanks for your answers.

Kelly Garcés.