Skip to main content
summaryrefslogtreecommitdiffstats
blob: 24afabf2dd55e1e6d81c93c6283d22bf3fdd1e21 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/******************************************************************************* 
 * 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 
 *
 * @author Innar Made
 ******************************************************************************/
package org.eclipse.bpmn2.modeler.ui.property.events;

import org.eclipse.bpmn2.ConditionalEventDefinition;
import org.eclipse.bpmn2.FormalExpression;
import org.eclipse.bpmn2.modeler.core.adapters.InsertionAdapter;
import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
import org.eclipse.bpmn2.modeler.core.utils.ModelUtil;
import org.eclipse.bpmn2.modeler.ui.property.data.ExpressionDetailComposite;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.swt.widgets.Composite;

public class ConditionalEventDefinitionDetailComposite extends ExpressionDetailComposite {

	public ConditionalEventDefinitionDetailComposite(Composite parent, int style) {
		super(parent, style);
	}

	/**
	 * @param section
	 */
	public ConditionalEventDefinitionDetailComposite(AbstractBpmn2PropertySection section) {
		super(section);
	}

	@Override
	public void setBusinessObject(EObject object) {
		if (object instanceof ConditionalEventDefinition) {
			getDiagramEditor();
			addDomainListener();
			
			ConditionalEventDefinition ced = (ConditionalEventDefinition)object;
			if (ced.getCondition()==null) {
				object = createModelObject(FormalExpression.class);
				InsertionAdapter.add(ced,
						PACKAGE.getConditionalEventDefinition_Condition(),
						object);
			}
			else
				object = ced.getCondition();
		}
		super.setBusinessObject(object);
	}
	
}

Back to the top