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


Java View.eContainer方法代码示例

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


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

示例1: getElementType

import org.eclipse.gmf.runtime.notation.View; //导入方法依赖的package包/类
/**
 * @generated
 */
private IElementType getElementType(View view) {
	// For intermediate views climb up the containment hierarchy to find the one associated with an element type.
	while (view != null) {
		int vid = StatemachineVisualIDRegistry.getVisualID(view);
		IElementType etype = StatemachineElementTypes.getElementType(vid);
		if (etype != null) {
			return etype;
		}
		view = view.eContainer() instanceof View ? (View) view.eContainer()
				: null;
	}
	return null;
}
 
开发者ID:spoenemann,项目名称:xtext-gef,代码行数:17,代码来源:StatemachineSheetLabelProvider.java

示例2: doPaste

import org.eclipse.gmf.runtime.notation.View; //导入方法依赖的package包/类
/**
 * @return
 * @throws Exception
 */
private EObject doPaste()
	throws Exception {

	View sourceView = getConnectorViewPasteOperation().getSourceView();
	View targetView = getConnectorViewPasteOperation().getTargetView();

	if ((sourceView == null) || (targetView == null)) {
		return null;
	}

	EObject sourceViewContainer = sourceView.eContainer();
	EObject targetViewContainer = targetView.eContainer();

	if ((sourceViewContainer == null) || (targetViewContainer == null)) {
		return null;
	}

	if (sourceViewContainer.equals(targetViewContainer) == false) {
		//not in the same container, let's try to see if they are in the
		// same diagram at least
		Diagram sourceViewDiagram = NotationClipboardOperationHelper
			.getContainingDiagram((View) sourceViewContainer);
		Diagram targetViewDiagram = NotationClipboardOperationHelper
			.getContainingDiagram((View) targetViewContainer);
		if ((sourceViewDiagram == null) || (targetViewDiagram == null)
			|| (sourceViewDiagram.equals(targetViewDiagram) == false)) {
			return null;
		}
	}
	
	Edge connectorView = getConnectorViewPasteOperation()
		.getConnectorView();

	if (pasteSemanticElement) {			
		EObject semanticElement = connectorView.getElement();
		if (semanticElement != null) {
			if (semanticElement.eIsProxy()) {
				semanticElement = ClipboardSupportUtil.resolve(semanticElement,
					getParentPasteProcess().getLoadedIDToEObjectMapCopy());
			}
			String loadedId = getLoadedEObjectID(semanticElement);
			if (loadedId != null) {
				//even if we failed to paste the semantic element, we'll
				// proceed to paste the edge view
				doPasteSemanticElement();
				//should have been pasted by now, if not then return
				String newId = getEObjectID(semanticElement);
				if (newId == null) {
					return null;
				}
			}
		}
	}
	EObject pastedElement = null;
	Diagram pasteTargetDiagram = NotationClipboardOperationHelper
		.getContainingDiagram((View) sourceViewContainer);
	if (pasteTargetDiagram != null) {
		//if we reached here then we should paste the connector and set
		// refs to it accordingly
		pastedElement = ClipboardSupportUtil.appendEObjectAt(
			pasteTargetDiagram, getContainmentFeature(), connectorView);
		if (pastedElement != null) {
			ClipboardSupportUtil.appendEObjectAt(sourceView,
				NotationPackage.eINSTANCE.getView_SourceEdges(),
				connectorView);
			ClipboardSupportUtil.appendEObjectAt(targetView,
				NotationPackage.eINSTANCE.getView_TargetEdges(),
				connectorView);
		}
	}

	return pastedElement;
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:78,代码来源:ConnectorViewPostPasteChildOperation.java


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