当前位置: 首页>>代码示例>>Java>>正文


Java Diagram.setElement方法代码示例

本文整理汇总了Java中org.eclipse.gmf.runtime.notation.Diagram.setElement方法的典型用法代码示例。如果您正苦于以下问题:Java Diagram.setElement方法的具体用法?Java Diagram.setElement怎么用?Java Diagram.setElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.gmf.runtime.notation.Diagram的用法示例。


在下文中一共展示了Diagram.setElement方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createDiagram

import org.eclipse.gmf.runtime.notation.Diagram; //导入方法依赖的package包/类
/**
 * @generated
 */
public Diagram createDiagram(IAdaptable semanticAdapter,
		String diagramKind, PreferencesHint preferencesHint) {
	Diagram diagram = NotationFactory.eINSTANCE.createDiagram();
	diagram.getStyles().add(NotationFactory.eINSTANCE.createDiagramStyle());
	diagram.setType(StatemachineEditPart.MODEL_ID);
	diagram.setElement(getSemanticElement(semanticAdapter));
	diagram.setMeasurementUnit(MeasurementUnit.PIXEL_LITERAL);
	return diagram;
}
 
开发者ID:spoenemann,项目名称:xtext-gef,代码行数:13,代码来源:StatemachineViewProvider.java

示例2: createGraphicalModel

import org.eclipse.gmf.runtime.notation.Diagram; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private static CDOResource createGraphicalModel(CDOTransaction transaction, CDOResourceFolder folder,
        String modelName, String diagramName, IDiagramType diagramType, CDOResource umlResource) {
    getOrCreate(transaction, folder, modelName + ".di");

    CDOResource notationResource = getOrCreate(transaction, folder, modelName + ".notation");

    EObject umlRoot = umlResource.getContents().get(0);

    Diagram diagram = NotationFactory.eINSTANCE.createDiagram();
    diagram.setType(diagramType.getPapyrusDiagramType());
    diagram.setName(diagramName);
    diagram.setElement(umlRoot);

    StringValueStyle stringValueStyle = NotationFactory.eINSTANCE.createStringValueStyle();
    stringValueStyle.setName("diagram_compatibility_version");
    stringValueStyle.setStringValue("1.3.0");
    diagram.getStyles().add(stringValueStyle);

    diagram.getStyles().add(NotationFactory.eINSTANCE.createDiagramStyle());

    PapyrusDiagramStyle papyrusDiagramStyle = StyleFactory.eINSTANCE.createPapyrusDiagramStyle();
    papyrusDiagramStyle.setOwner(umlRoot);
    papyrusDiagramStyle.setDiagramKindId(diagramType.getPapyrusDiagramKindId());
    diagram.getStyles().add(papyrusDiagramStyle);

    notationResource.getContents().add(diagram);

    ModelCreatorPostProcessorRegistry.getInstance().getPostProcessors()
            .forEach(processor -> processor.postProcessModel(diagram));

    return notationResource;
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:34,代码来源:ModelCreator.java

示例3: createStatechartModel

import org.eclipse.gmf.runtime.notation.Diagram; //导入方法依赖的package包/类
/**
 * Creates a Statechart with an initial Region and an initial State
 * 
 * @return instanceof {@link Statechart}
 */
public static void createStatechartModel(Resource resource, PreferencesHint preferencesHint) {
	// Create a statechart
	Statechart statechart = SGraphFactory.eINSTANCE.createStatechart();
	String lastSegment = resource.getURI().lastSegment();
	String statechartName = lastSegment.substring(0, lastSegment.indexOf('.'));
	statechart.setName(statechartName);
	statechart.setSpecification(INITIAL_SPECIFICATION);

	Diagram diagram = ViewService.createDiagram(statechart, StatechartDiagramEditor.ID, preferencesHint);
	diagram.setElement(statechart);
	// Add to resource
	resource.getContents().add(statechart);
	resource.getContents().add(diagram);
	// Create an initial region
	Region region = SGraphFactory.eINSTANCE.createRegion();
	region.setName(INITIAL_REGION_NAME);
	statechart.getRegions().add(region);
	Node regionView = ViewService.createNode(diagram, region, SemanticHints.REGION, preferencesHint);
	setRegionViewLayoutConstraint(regionView);
	// // Create an initial state
	Entry initialState = SGraphFactory.eINSTANCE.createEntry();
	initialState.setKind(EntryKind.INITIAL);
	region.getVertices().add(initialState);
	Node initialStateView = ViewService.createNode(getRegionCompartmentView(regionView), initialState,
			SemanticHints.ENTRY, preferencesHint);
	setInitialStateViewLayoutConstraint(initialStateView);
	// Create the first state
	State state = SGraphFactory.eINSTANCE.createState();
	state.setName("StateA");
	region.getVertices().add(state);
	Node stateNode = ViewService.createNode(getRegionCompartmentView(regionView), state, SemanticHints.STATE,
			preferencesHint);
	setStateViewLayoutConstraint(stateNode);
	// Create the transition from Initial State to State
	Transition transition = SGraphFactory.eINSTANCE.createTransition();
	transition.setSource(initialState);
	transition.setTarget(state);
	initialState.getOutgoingTransitions().add(transition);
	ViewService.createEdge(initialStateView, stateNode, transition, SemanticHints.TRANSITION, preferencesHint);
	// Create the textcompartment for events / variables
	Node textCompartment = ViewService.createNode(diagram, statechart, SemanticHints.STATECHART_TEXT,
			preferencesHint);
	setTextCompartmentLayoutConstraint(textCompartment);

}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:51,代码来源:FactoryUtils.java


注:本文中的org.eclipse.gmf.runtime.notation.Diagram.setElement方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。