Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2007 Anyware Technologies All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html Contributors: Anyware Technologies - initial API and implementation $Id: EcorePropertySection.java,v 1.3 2009/02/02 08:39:08 jlescot Exp $ /
 
 
 package org.eclipse.emf.ecoretools.diagram.sheet;
 
 
 import  org.eclipse.core.runtime.IAdaptable;
 import  org.eclipse.gmf.runtime.diagram.ui.properties.sections.AdvancedPropertySection;
 import  org.eclipse.gmf.runtime.notation.View;

Generated:
 
 public class EcorePropertySection extends AdvancedPropertySection implements IPropertySourceProvider {

Generated:
 
 		if (object instanceof IPropertySource) {
 			return (IPropertySourceobject;
 		}
 		if (af != null) {
 			if (ips != null) {
 				return new PropertySource(objectips);
 			}
 		}
 		if (object instanceof IAdaptable) {
 			return (IPropertySource) ((IAdaptable) object).getAdapter(IPropertySource.class);
 		}
 		return null;
 	}

Generated:
 
 		return this;
 	}

Modify/unwrap selection.

Generated:
NOT
 
 	protected Object transformSelection(Object selected) {
 
 		if (selected instanceof EditPart) {
 			Object model = ((EditPartselected).getModel();
 			return model instanceof View ? ((View) model).getElement() : null;
 		}
 		if (selected instanceof View) {
 			return ((View) selected).getElement();
 		}
 		if (selected instanceof IAdaptable) {
 			View view = (View) ((IAdaptable) selected).getAdapter(View.class);
 			if (view != null) {
 				return view.getElement();
 			}
 		}
 		return selected;
 	}

Generated:
 
 	public void setInput(IWorkbenchPart partISelection selection) {
 		if (selection.isEmpty() || false == selection instanceof StructuredSelection) {
 			super.setInput(partselection);
 			return;
 		}
 		final StructuredSelection structuredSelection = ((StructuredSelectionselection);
		ArrayList transformedSelection = new ArrayList(structuredSelection.size());
		for (Iterator it = structuredSelection.iterator(); it.hasNext();) {
			if (r != null) {
				transformedSelection.add(r);
			}
		}
		super.setInput(part, new StructuredSelection(transformedSelection));
	}

Generated:
	protected AdapterFactory getAdapterFactory(Object object) {
		if (getEditingDomain() instanceof AdapterFactoryEditingDomain) {
			return ((AdapterFactoryEditingDomain) getEditingDomain()).getAdapterFactory();
		}
		TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(object);
		if (editingDomain != null) {
			return ((AdapterFactoryEditingDomaineditingDomain).getAdapterFactory();
		}
		return null;
	}
New to GrepCode? Check out our FAQ X