Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 80044564b1982f9bf5b8729ec440d7b329735c2e (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
/*******************************************************************************
 * Copyright (c) 2010 protos software gmbh (http://www.protos.de).
 * 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:
 * 		Eyrak Paen (initial contribution)
 * 
 *******************************************************************************/

package org.eclipse.etrice.ui.behavior.fsm.editor;

import org.eclipse.etrice.ui.behavior.fsm.provider.GenModelProvider;
import org.eclipse.etrice.ui.behavior.fsm.provider.IInjectorProvider;
import org.eclipse.etrice.ui.common.base.editor.AbstractBaseDiagramTypeProvider;
import org.eclipse.graphiti.mm.pictograms.Diagram;
import org.eclipse.graphiti.platform.IDiagramContainer;

/**
 * This class augments the AbstractDiagramTypeProvider to help manage 
 * functionality provided by {@link AbstractFSMEditor}. Diagram editor plugins 
 * that extend {@link AbstractFSMEditor} should also extend and use this class.
 */
public abstract class AbstractFSMDiagramTypeProvider extends AbstractBaseDiagramTypeProvider implements IInjectorProvider {
	
	public GenModelProvider getGenModelProvider() {
		// create always new one for now
//		Stopwatch timer = Stopwatch.createStarted();
//		GenModelProvider genModelProvider = new GenModelProvider(this);
//		System.out.println(timer.stop().elapsed(TimeUnit.MILLISECONDS));	
		return new GenModelProvider(this);
	}
	
	/* (non-Javadoc)
	 * @see org.eclipse.graphiti.dt.AbstractDiagramTypeProvider#resourceReloaded(org.eclipse.graphiti.mm.pictograms.Diagram)
	 */
	@Override
	public void resourceReloaded(Diagram diagram) {
		super.resourceReloaded(diagram);
		IDiagramContainer dgContainer = this.getDiagramBehavior().getDiagramContainer();
		if(dgContainer instanceof AbstractFSMEditor)
		{
			((AbstractFSMEditor)dgContainer).attachDiagnosingModelObserver();
		}
	}
}

Back to the top