/******************************************************************************* * This file is protected by Copyright. * Please refer to the COPYRIGHT file distributed with this source distribution. * * This file is part of REDHAWK IDE. * * 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 *******************************************************************************/ package gov.redhawk.datareader.ui.controlPanels; import gov.redhawk.model.sca.ScaComponent; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.views.properties.tabbed.AbstractPropertySection; import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; /** * An example showing how to create a property section. */ public class DataReaderControlPanelPropertySection extends AbstractPropertySection { private DataReaderComposite readerControls; /** * {@inheritDoc} */ @Override public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) { readerControls = new DataReaderComposite(parent, SWT.None); } @Override public void setInput(IWorkbenchPart part, ISelection selection) { super.setInput(part, selection); if (selection instanceof IStructuredSelection) { IStructuredSelection ss = (IStructuredSelection) selection; Object obj = ss.getFirstElement(); if (obj instanceof ScaComponent) { readerControls.setInput((ScaComponent) obj); return; } } readerControls.setInput(null); } @Override public boolean shouldUseExtraSpace() { return true; } }