Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Advanced proprety sheet page for EClass
Advanced proprety sheet page for EClass [message #913378] Sat, 15 September 2012 12:46 Go to next message
Junior Lekane Nimpa is currently offline Junior Lekane NimpaFriend
Messages: 23
Registered: September 2012
Junior Member
Hello all,
i am actually trying to implement an advanced property sheet for EClasses. I took a look into the graphiti tutorial's plugin and based on the class "GraphitiEditPartToIPropertySourceAdapterFactory " i implemented the following factory


import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.graphiti.mm.pictograms.PictogramElement;
import org.eclipse.graphiti.ui.editor.DiagramEditor;
import org.eclipse.graphiti.ui.platform.GraphitiShapeEditPart;
import org.eclipse.ui.views.properties.IPropertySource;


public class EditPartToIPropertySourceAdapterFactory implements IAdapterFactory {
	
	public EditPartToIPropertySourceAdapterFactory(){
		super();
	}
	
	
	public Object getAdapter(Object adaptableObject, @SuppressWarnings("rawtypes") Class adapterType) {
		if (IPropertySource.class.equals(adapterType)) {
			if (adaptableObject instanceof GraphitiShapeEditPart) {
				GraphitiShapeEditPart editPart = (GraphitiShapeEditPart) adaptableObject;
				PictogramElement pe = editPart.getPictogramElement();
			Object object = editPart.getFeatureProvider().getBusinessObjectForPictogramElement(pe);
				if (object instanceof EClass) {
					return new EClassPropertySource((EClass)object);
				}
			}
		}
		return null;
	}
	
	@SuppressWarnings("rawtypes")
	public Class[] getAdapterList() {
		return new Class[] { IPropertySource.class };
	}
	


But i get the following error :
The type org.eclipse.gef.editparts.AbstractGraphicalEditPart cannot be resolved. It is indirectly referenced from required .class files

It seems that the class GraphitiShapeEditPart causes this error.
Any idea?
or should i declare EClass as adaptabelType instead of GraphitiShapeEditPart ?

Many thanks in advance
Junior
Re: Advanced proprety sheet page for EClass [message #915389 is a reply to message #913378] Mon, 17 September 2012 07:33 Go to previous messageGo to next message
Jeeeyul Lee is currently offline Jeeeyul LeeFriend
Messages: 111
Registered: July 2009
Location: Seoul
Senior Member

You should have to add "GEF" as dependencies. Because you used GraphitiShapeEditPart which is not a public API.
Re: Advanced proprety sheet page for EClass [message #915611 is a reply to message #915389] Mon, 17 September 2012 16:28 Go to previous message
Junior Lekane Nimpa is currently offline Junior Lekane NimpaFriend
Messages: 23
Registered: September 2012
Junior Member
Thanks so much Lee for the hint.
regards
Junior
Previous Topic:How to have an icon on a Rectangle/ Container Shape?
Next Topic:Documentation for Pattern ?
Goto Forum:
  


Current Time: Sun Nov 23 19:02:54 GMT 2014

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

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