Java Code Examples for org.eclipse.gmf.runtime.notation.View#eContainer()

The following examples show how to use org.eclipse.gmf.runtime.notation.View#eContainer() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CrossflowDiagramUpdater.java    From scava with Eclipse Public License 2.0 6 votes vote down vote up
/**
* @generated
*/
public static List<CrossflowNodeDescriptor> getScriptedTaskScriptedTaskOutputVariablesCompartment_7003SemanticChildren(
		View view) {
	if (false == view.eContainer() instanceof View) {
		return Collections.emptyList();
	}
	View containerView = (View) view.eContainer();
	if (!containerView.isSetElement()) {
		return Collections.emptyList();
	}
	ScriptedTask modelElement = (ScriptedTask) containerView.getElement();
	LinkedList<CrossflowNodeDescriptor> result = new LinkedList<CrossflowNodeDescriptor>();
	for (Iterator<?> it = modelElement.getOutputVariables().iterator(); it.hasNext();) {
		Field childElement = (Field) it.next();
		int visualID = CrossflowVisualIDRegistry.getNodeVisualID(view, childElement);
		if (visualID == Field2EditPart.VISUAL_ID) {
			result.add(new CrossflowNodeDescriptor(childElement, visualID));
			continue;
		}
	}
	return result;
}
 
Example 2
Source File: CrossflowDiagramUpdater.java    From scava with Eclipse Public License 2.0 6 votes vote down vote up
/**
* @generated
*/
public static List<CrossflowNodeDescriptor> getTypeTypeFieldsCompartment_7001SemanticChildren(View view) {
	if (false == view.eContainer() instanceof View) {
		return Collections.emptyList();
	}
	View containerView = (View) view.eContainer();
	if (!containerView.isSetElement()) {
		return Collections.emptyList();
	}
	Type modelElement = (Type) containerView.getElement();
	LinkedList<CrossflowNodeDescriptor> result = new LinkedList<CrossflowNodeDescriptor>();
	for (Iterator<?> it = modelElement.getFields().iterator(); it.hasNext();) {
		Field childElement = (Field) it.next();
		int visualID = CrossflowVisualIDRegistry.getNodeVisualID(view, childElement);
		if (visualID == Field3EditPart.VISUAL_ID) {
			result.add(new CrossflowNodeDescriptor(childElement, visualID));
			continue;
		}
	}
	return result;
}
 
Example 3
Source File: CrossflowDiagramUpdater.java    From scava with Eclipse Public License 2.0 6 votes vote down vote up
/**
* @generated
*/
public static List<CrossflowNodeDescriptor> getLanguageLanguageParametersCompartment_7002SemanticChildren(
		View view) {
	if (false == view.eContainer() instanceof View) {
		return Collections.emptyList();
	}
	View containerView = (View) view.eContainer();
	if (!containerView.isSetElement()) {
		return Collections.emptyList();
	}
	Language modelElement = (Language) containerView.getElement();
	LinkedList<CrossflowNodeDescriptor> result = new LinkedList<CrossflowNodeDescriptor>();
	for (Iterator<?> it = modelElement.getParameters().iterator(); it.hasNext();) {
		Parameter childElement = (Parameter) it.next();
		int visualID = CrossflowVisualIDRegistry.getNodeVisualID(view, childElement);
		if (visualID == ParameterEditPart.VISUAL_ID) {
			result.add(new CrossflowNodeDescriptor(childElement, visualID));
			continue;
		}
	}
	return result;
}
 
Example 4
Source File: CrossflowSheetLabelProvider.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
* @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 = CrossflowVisualIDRegistry.getVisualID(view);
		IElementType etype = CrossflowElementTypes.getElementType(vid);
		if (etype != null) {
			return etype;
		}
		view = view.eContainer() instanceof View ? (View) view.eContainer() : null;
	}
	return null;
}
 
Example 5
Source File: ProcessElementLabelProvider.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
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) {
		final int vid = ProcessVisualIDRegistry.getVisualID(view);
		final IElementType etype = ProcessElementTypes.getElementType(vid);
		if (etype != null) {
			return etype;
		}
		view = view.eContainer() instanceof View ? (View) view.eContainer() : null;
	}
	return null;
}
 
Example 6
Source File: ProcessSheetLabelProvider.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @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 = ProcessVisualIDRegistry.getVisualID(view);
		IElementType etype = ProcessElementTypes.getElementType(vid);
		if (etype != null) {
			return etype;
		}
		view = view.eContainer() instanceof View ? (View) view.eContainer() : null;
	}
	return null;
}
 
Example 7
Source File: ConnectorViewPostPasteChildOperation.java    From statecharts with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * @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;
}