/* * Copyright (c) 2012 Data Harmonisation Panel * * All rights reserved. This program and the accompanying materials are made * available under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation, either version 3 of the License, * or (at your option) any later version. * * You should have received a copy of the GNU Lesser General Public License * along with this distribution. If not, see <http://www.gnu.org/licenses/>. * * Contributors: * HUMBOLDT EU Integrated Project #030962 * Data Harmonisation Panel <http://www.dhpanel.eu> */ package eu.esdihumboldt.hale.ui.views.properties; import org.eclipse.core.runtime.Assert; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.views.properties.tabbed.AbstractPropertySection; /** * Abstract section for properties views displaying information on a single * object. * * @author Simon Templer */ public abstract class AbstractSingleObjectSection extends AbstractPropertySection { /** * @see AbstractPropertySection#setInput(IWorkbenchPart, ISelection) */ @Override public void setInput(IWorkbenchPart part, ISelection selection) { super.setInput(part, selection); Assert.isTrue(selection instanceof IStructuredSelection); Object input = ((IStructuredSelection) selection).getFirstElement(); setInput(input); } /** * Set the input object. * * @param input the object to display properties on */ protected abstract void setInput(Object input); }