Java Code Examples for org.eclipse.gmf.runtime.notation.NotationPackage#eINSTANCE()

The following examples show how to use org.eclipse.gmf.runtime.notation.NotationPackage#eINSTANCE() . 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: SCTMatchEngineFactory.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public Comparison match(IComparisonScope scope, Monitor monitor) {
	Predicate<EObject> predicate = new Predicate<EObject>() {
		@Override
		public boolean apply(EObject eobject) {
			// We only want to diff the SGraph and notation elements,
			// not the transient palceholders for concrete languages
			EPackage ePackage = eobject.eClass().getEPackage();
			return ePackage == SGraphPackage.eINSTANCE || ePackage == NotationPackage.eINSTANCE;
		}
	};
	if (scope instanceof DefaultComparisonScope) {
		DefaultComparisonScope defaultScope = (DefaultComparisonScope) scope;
		defaultScope.setEObjectContentFilter(predicate);
		defaultScope.setResourceContentFilter(predicate);
	}
	return super.match(scope, monitor);
}
 
Example 2
Source File: Standalone.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
protected GenerateImplementations getGenerator() {
	if (generator == null) {
		CrossflowPackage crossflowPackage = CrossflowPackage.eINSTANCE;
		NotationPackage gmfNotationPkg = NotationPackage.eINSTANCE;
		EPackage.Registry.INSTANCE.put(crossflowPackage.getNsURI(), crossflowPackage);
		EPackage.Registry.INSTANCE.put(gmfNotationPkg.getNsURI(), gmfNotationPkg);
		generator = new GenerateImplementations(new File(projectLoc), modelLoc);
	}
	return generator;
}
 
Example 3
Source File: NotationClipboardOperationHelper.java    From statecharts with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * By default, don't provide any child paste override behaviour.
 */
public boolean shouldOverrideChildPasteOperation(EObject parentElement,
		EObject childEObject) {
	return (childEObject.eClass().getEPackage() == NotationPackage.eINSTANCE);
}
 
Example 4
Source File: NotationClipboardOperationHelper.java    From statecharts with Eclipse Public License 1.0 4 votes vote down vote up
protected boolean shouldAllowPaste(
		PasteChildOperation overriddenChildPasteOperation) {
	EObject eObject = overriddenChildPasteOperation.getEObject();
	EObject parentEObject = overriddenChildPasteOperation
			.getParentEObject();
	// RATLC01137919 removed the condition that parentEObject is a diagram
	// to allow paste into diagram elements
	if ((parentEObject instanceof View) && (eObject instanceof View)) {
		EObject semanticChildElement = ((View) eObject).getElement();
		if (semanticChildElement == null || isSubdiagram(eObject, semanticChildElement)) {
			return true;
		}

		// PATCH START
		EObject target = getSemanticPasteTarget((View) eObject,
				(View) overriddenChildPasteOperation.getParentEObject());
		if (target == null) {
			return false;
		}
		// PATCH END

		if (semanticChildElement.eIsProxy()) {
			semanticChildElement = ClipboardSupportUtil.resolve(
					semanticChildElement, overriddenChildPasteOperation
							.getParentPasteProcess()
							.getLoadedIDToEObjectMapCopy());
			if (semanticChildElement.eIsProxy()) {
				semanticChildElement = EcoreUtil.resolve(
						semanticChildElement, getResource(parentEObject));
			}
		}

		EPackage semanticChildEpackage = semanticChildElement.eClass()
				.getEPackage();
		EPackage parentRootContainerEpackage = EcoreUtil
				.getRootContainer(parentEObject).eClass().getEPackage();
		EPackage sematicParentRootContainerEpackage = null;
		EObject sematicParentElement = ((View) parentEObject).getElement();
		if (sematicParentElement != null) {
			sematicParentRootContainerEpackage = EcoreUtil
					.getRootContainer(sematicParentElement).eClass()
					.getEPackage();
		}

		if (parentRootContainerEpackage != NotationPackage.eINSTANCE) {
			if (semanticChildEpackage != parentRootContainerEpackage) {
				return false;
			}
		}

		if ((sematicParentRootContainerEpackage != null)
				&& (sematicParentRootContainerEpackage != NotationPackage.eINSTANCE)) {
			if (semanticChildEpackage != sematicParentRootContainerEpackage) {
				return false;
			}
		}
		return true;
	}
	return false;
}