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


Java ViewService.createNode方法代码示例

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


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

示例1: createEntryPoint

import org.eclipse.gmf.runtime.diagram.core.services.ViewService; //导入方法依赖的package包/类
protected void createEntryPoint(Edge edge, Diagram subdiagram) {
	Transition transition = (Transition) edge.getElement();
	Region entryPointContainer = getEntryPointContainer(transition);
	Entry entryPoint = createSemanticEntryPoint(transition);

	// re-wire old transition to targeting the selected state
	transition.setTarget((State) subdiagram.getElement());
	View oldTarget = edge.getTarget();
	edge.setTarget(getContextObject());

	// create node for entry point
	View entryPointContainerView = helper.getViewForSemanticElement(entryPointContainer, subdiagram);
	View entryPointRegionCompartment = ViewUtil.getChildBySemanticHint(entryPointContainerView,
			SemanticHints.REGION_COMPARTMENT);
	Node entryNode = ViewService.createNode(entryPointRegionCompartment, entryPoint, SemanticHints.ENTRY,
			preferencesHint);
	ViewService.createEdge(entryNode, oldTarget, entryPoint.getOutgoingTransitions().get(0),
			SemanticHints.TRANSITION, preferencesHint);

	addEntryPointSpec(transition, entryPoint);
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:22,代码来源:ExtractSubdiagramRefactoring.java

示例2: createExitPoint

import org.eclipse.gmf.runtime.diagram.core.services.ViewService; //导入方法依赖的package包/类
protected void createExitPoint(Edge edge, Diagram subdiagram) {
	Transition transition = (Transition) edge.getElement();
	// create semantic exit point
	Region exitPointContainer = getExitPointContainer(transition);
	Exit exitPoint = createSemanticExitPoint(transition);

	// create node for exit point
	View exitPointContainerView = helper.getViewForSemanticElement(exitPointContainer, subdiagram);
	View exitPointRegionCompartment = ViewUtil.getChildBySemanticHint(exitPointContainerView,
			SemanticHints.REGION_COMPARTMENT);
	Node exitNode = ViewService.createNode(exitPointRegionCompartment, exitPoint, SemanticHints.EXIT,
			preferencesHint);

	// re-wire existing transition to new exit point
	Vertex oldTransitionTarget = transition.getTarget();
	transition.setTarget(exitPoint);
	View oldEdgeTarget = edge.getTarget();
	edge.setTarget(exitNode);

	// create transition from selected state to former transition target
	Transition exitPointTransition = SGraphFactory.eINSTANCE.createTransition();
	exitPointTransition.setSource((State) subdiagram.getElement());
	exitPointTransition.setTarget(oldTransitionTarget);
	ViewService.createEdge(getContextObject(), oldEdgeTarget, exitPointTransition, SemanticHints.TRANSITION,
			preferencesHint);

	addExitPointSpec(exitPointTransition, exitPoint);
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:29,代码来源:ExtractSubdiagramRefactoring.java

示例3: doGraphicalRefactoring

import org.eclipse.gmf.runtime.diagram.core.services.ViewService; //导入方法依赖的package包/类
protected void doGraphicalRefactoring() {
	Node compositeStateView = createNodeForCompositeState(compositeState);
	Node innerRegionNode = ViewService.createNode(
			getStateFigureCompartmentView(compositeStateView), innerRegion,
			SemanticHints.REGION, preferencesHint);
	
	View regionCompartment = ViewUtil.getChildBySemanticHint(innerRegionNode, SemanticHints.REGION_COMPARTMENT);
	moveSelectedStateNodesTo(regionCompartment, (Bounds)compositeStateView.getLayoutConstraint());
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:10,代码来源:GroupStatesIntoCompositeRefactoring.java

示例4: createGMFNode

import org.eclipse.gmf.runtime.diagram.core.services.ViewService; //导入方法依赖的package包/类
public static @Nullable Node createGMFNode(@NonNull EObject modelObj, @NonNull Diagram gmfDiagram, @NonNull String diagramPluginId, @Nullable IViewProvider viewProvider) {

		Node gmfNode = null;
		if (viewProvider == null) {
			String gmfTypeHint = GMFUtils.getGMFRegistryType(modelObj, null);
			// works only if modelObj has the right eStorage adapters attached, or it returns a generic type
			gmfNode = ViewService.createNode(gmfDiagram, modelObj, gmfTypeHint, new PreferencesHint(diagramPluginId));
		}
		else {
			gmfNode = viewProvider.createNode(new EObjectAdapter(modelObj), gmfDiagram, null, -1, true, new PreferencesHint(diagramPluginId));
		}

		return gmfNode;
	}
 
开发者ID:adisandro,项目名称:MMINT,代码行数:15,代码来源:GMFUtils.java

示例5: createStatechartModel

import org.eclipse.gmf.runtime.diagram.core.services.ViewService; //导入方法依赖的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

示例6: createNodeForCompositeState

import org.eclipse.gmf.runtime.diagram.core.services.ViewService; //导入方法依赖的package包/类
protected Node createNodeForCompositeState(State compositeState) {
	Node compositeStateNode = ViewService.createNode(parentRegionView,
			compositeState, SemanticHints.STATE, preferencesHint);
	setCompositeStateLayoutConstraint(compositeStateNode);
	return compositeStateNode;
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:7,代码来源:GroupStatesIntoCompositeRefactoring.java

示例7: createView

import org.eclipse.gmf.runtime.diagram.core.services.ViewService; //导入方法依赖的package包/类
@Override
protected Node createView(final EObject theElement, final View theContainer) {
    final Node theNode = ViewService.createNode(theContainer, theElement, UMLVisualIDRegistry.getType(visualID),
            getThePreferencesHint());
    return theNode;
}
 
开发者ID:GRA-UML,项目名称:tool,代码行数:7,代码来源:DiagramSynchronizer.java

示例8: createNestedInstanceMIDModelShortcuts

import org.eclipse.gmf.runtime.diagram.core.services.ViewService; //导入方法依赖的package包/类
/**
 * Create shortcuts to external models into the nested Instance MID.
 *
 * @param models
 *            The external models.
 * @throws MMINTException
 *             If this is not an operator instance, or if this operator was created without a nested Instance MID.
 * @generated NOT
 */
protected void createNestedInstanceMIDModelShortcuts(@NonNull List<Model> models) throws MMINTException {

    MMINTException.mustBeInstance(this);

    String nestedMIDPath = this.getNestedMIDPath();
    if (nestedMIDPath == null) {
        throw new MMINTException("The nested MID is not serialized");
    }
    if (models.isEmpty()) {
        return;
    }

    MID nestedMID = this.getNestedInstanceMID();
    Diagram nestedMIDDiagramRoot = this.getNestedInstanceMIDDiagramRoot();
    Model midModelType = MIDTypeRegistry.getMIDModelType();
    String midDiagramPluginId = MIDTypeRegistry.getTypeBundle(MIDTypeRegistry.getMIDDiagramType().getUri()).getSymbolicName();
    IViewProvider midViewProvider = MIDTypeRegistry.getCachedMIDViewProvider();
    // models first, then model rels
    for (Model model : models) {
        if (model instanceof BinaryModelRel) {
            continue;
        }
        GMFUtils.createGMFNodeShortcut(
            model,
            nestedMIDDiagramRoot,
            midDiagramPluginId,
            midModelType.getName(),
            midViewProvider);
        if (model instanceof Model) {
            nestedMID.getExtendibleTable().put(model.getUri(), model);
        }
    }
    for (Model binaryModelRel : models) {
        if (!(binaryModelRel instanceof BinaryModelRel)) {
            continue;
        }
        // gmf shortcuts can't be created for links, fake the shortcut as an nary rel
        String gmfTypeHint = GMFUtils.getGMFRegistryType(RelationshipFactory.eINSTANCE.createModelRel(), midDiagramPluginId + ".TypeContext");
        Node gmfNode = (midViewProvider == null) ?
            ViewService.createNode(nestedMIDDiagramRoot, binaryModelRel, gmfTypeHint, new PreferencesHint(midDiagramPluginId)) :
            midViewProvider.createNode(new EObjectAdapter(binaryModelRel), nestedMIDDiagramRoot, gmfTypeHint, -1, true, new PreferencesHint(midDiagramPluginId));
        GMFUtils.addGMFShortcut(gmfNode, midModelType.getName());
        //TODO MMINT[NESTED] Can't create model rel endpoints, but maybe can use some simple connectors
    }
}
 
开发者ID:adisandro,项目名称:MMINT,代码行数:55,代码来源:NestingOperatorImpl.java


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