private NonRootModelElement getDestination(NonRootModelElement rto) { if (rto instanceof InterfaceReference_c && getMethodName().contains("C1")) { // need the package for the parent component return rto.getFirstParentComponent().getFirstParentPackage(); } if (rto instanceof Port_c && getMethodName().contains("C1")) { // need the package for the parent component return rto.getFirstParentComponent().getFirstParentPackage(); } if (getMethodName().contains("C1")) { return rto.getFirstParentPackage(); } else if (getMethodName().contains("C2")) { return Package_c.getOneEP_PKGOnR1401(inscopeOtherProject); } else if (getMethodName().contains("C3")) { return Package_c.getOneEP_PKGOnR1401( m_sys, new ClassQueryInterface_c() { @Override public boolean evaluate(Object candidate) { Package_c pkg = (Package_c) candidate; PackageableElement_c pe = PackageableElement_c.getOnePE_PEOnR8001(pkg); if (pe.getVisibility() == Visibility_c.Private) { return true; } return false; } }); } else { return Package_c.getOneEP_PKGOnR1401(outOfScopeOtherProject); } }
public void doTestParseErrorPreferencesPackage() throws BackingStoreException, CoreException { Package_c testPkg = Package_c.getOneEP_PKGOnR1401( m_sys, new ClassQueryInterface_c() { @Override public boolean evaluate(Object candidate) { return ((Package_c) candidate).getName().equals("Package-Test"); } }); IMarker[] errors = parseModel(testPkg); assertEquals("Incorrect number of parse errors were found.", 5, errors.length); ExternalEntity_c ee = ExternalEntity_c.getOneS_EEOnR8001(PackageableElement_c.getManyPE_PEsOnR8000(testPkg)); ee.setIsrealized(true); errors = parseModel(testPkg); assertEquals("Incorrect number of parse errors were found.", 4, errors.length); setProjectPreference( BridgePointProjectActionLanguagePreferences .ENABLE_ERROR_FOR_EMPTY_SYNCHRONOUS_MESSAGE_REALIZED, true); errors = parseModel(testPkg); assertEquals("Incorrect number of parse errors were found.", 5, errors.length); setProjectPreference( BridgePointProjectActionLanguagePreferences .ENABLE_ERROR_FOR_EMPTY_SYNCHRONOUS_MESSAGE_REALIZED, false); setProjectPreference( BridgePointProjectActionLanguagePreferences.ENABLE_ERROR_FOR_EMPTY_SYNCHRONOUS_MESSAGE, false); errors = parseModel(testPkg); assertEquals("Incorrect number of parse errors were found.", 0, errors.length); }
public void doTestParseErrorPreferencesComponent() throws BackingStoreException, CoreException { project = getProjectHandle(projectName); Package_c testPkg = Package_c.getOneEP_PKGOnR1401( m_sys, new ClassQueryInterface_c() { @Override public boolean evaluate(Object candidate) { return ((Package_c) candidate).getName().equals("Component-Test"); } }); setProjectPreference( BridgePointProjectActionLanguagePreferences.ENABLE_ERROR_FOR_EMPTY_SYNCHRONOUS_MESSAGE, true); setProjectPreference( BridgePointProjectActionLanguagePreferences .ENABLE_ERROR_FOR_EMPTY_SYNCHRONOUS_MESSAGE_REALIZED, false); IMarker[] errors = parseModel(testPkg); assertEquals("Incorrect number of parse errors were found.", 0, errors.length); ExternalEntity_c ee = ExternalEntity_c.getOneS_EEOnR8001( PackageableElement_c.getManyPE_PEsOnR8000( Package_c.getManyEP_PKGsOnR8001( PackageableElement_c.getManyPE_PEsOnR8003( Component_c.getManyC_CsOnR8001( PackageableElement_c.getManyPE_PEsOnR8000(testPkg)))))); Bridge_c bridge = Bridge_c.getOneS_BRGOnR19(ee); bridge.setAction_semantics_internal("// test comment"); errors = parseModel(testPkg); assertEquals("Incorrect number of parse errors were found.", 1, errors.length); setProjectPreference( BridgePointProjectActionLanguagePreferences .ENABLE_ERROR_FOR_EMPTY_SYNCHRONOUS_MESSAGE_REALIZED, true); errors = parseModel(testPkg); assertEquals("Incorrect number of parse errors were found.", 5, errors.length); setProjectPreference( BridgePointProjectActionLanguagePreferences .ENABLE_ERROR_FOR_EMPTY_SYNCHRONOUS_MESSAGE_REALIZED, false); setProjectPreference( BridgePointProjectActionLanguagePreferences.ENABLE_ERROR_FOR_EMPTY_SYNCHRONOUS_MESSAGE, false); errors = parseModel(testPkg); assertEquals("Incorrect number of parse errors were found.", 1, errors.length); }