| /******************************************************************************* |
| * Copyright (c) 2011, 2012 Red Hat, Inc. |
| * All rights reserved. |
| * This program is 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: |
| * Red Hat, Inc. - initial API and implementation |
| *******************************************************************************/ |
| package org.eclipse.bpmn2.modeler.ui.property.diagrams; |
| |
| import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite; |
| import org.eclipse.bpmn2.modeler.core.merrimac.clad.DefaultPropertySection; |
| import org.eclipse.bpmn2.modeler.core.utils.ModelUtil; |
| import org.eclipse.bpmn2.modeler.core.utils.ModelUtil.Bpmn2DiagramType; |
| import org.eclipse.emf.ecore.EObject; |
| import org.eclipse.jface.viewers.ISelection; |
| import org.eclipse.ui.IWorkbenchPart; |
| import org.eclipse.bpmn2.Process; |
| |
| public class DataItemsPropertySection extends DefaultPropertySection { |
| |
| public DataItemsPropertySection() { |
| } |
| |
| @Override |
| protected AbstractDetailComposite createSectionRoot() { |
| return new DataItemsDetailComposite(this); |
| } |
| |
| @Override |
| public boolean appliesTo(IWorkbenchPart part, ISelection selection) { |
| if (super.appliesTo(part, selection)) { |
| return getBusinessObjectForSelection(selection) != null; |
| } |
| return false; |
| } |
| |
| @Override |
| protected EObject getBusinessObjectForSelection(ISelection selection) { |
| EObject be = super.getBusinessObjectForSelection(selection); |
| if (be instanceof Process || ModelUtil.getDiagramType(be)==Bpmn2DiagramType.PROCESS) |
| return ModelUtil.getDefinitions(be); |
| return null; |
| } |
| } |