當前位置: 首頁>>代碼示例>>Java>>正文


Java EValidator類代碼示例

本文整理匯總了Java中org.eclipse.emf.ecore.EValidator的典型用法代碼示例。如果您正苦於以下問題:Java EValidator類的具體用法?Java EValidator怎麽用?Java EValidator使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


EValidator類屬於org.eclipse.emf.ecore包,在下文中一共展示了EValidator類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setMarkerAttibutes

import org.eclipse.emf.ecore.EValidator; //導入依賴的package包/類
/**
 * Sets attributes for the given {@link IMarker}.
 * 
 * @param marker
 *            the {@link IMarker}
 * @param resource
 *            the {@link IFile} containing the mode
 * @param instruction
 *            the {@link EObject} representing the instruction
 * @param persistent
 *            should be persisted
 * @throws CoreException
 *             if attributes can't be set
 */
protected void setMarkerAttibutes(final IMarker marker, IFile resource, EObject instruction,
		boolean persistent) throws CoreException {
	final IItemLabelProvider provider = (IItemLabelProvider)ADAPTER_FACTORY.adapt(instruction,
			IItemLabelProvider.class);
	marker.setAttribute(IBreakpoint.ENABLED, true);
	marker.setAttribute(IBreakpoint.PERSISTED, persistent);
	marker.setAttribute(IBreakpoint.ID, getModelIdentifier());
	marker.setAttribute(EValidator.URI_ATTRIBUTE, EcoreUtil.getURI(instruction).toString());
	final String instructionText = provider.getText(instruction);
	marker.setAttribute(IMarker.MESSAGE, "DSL Breakpoint: " + resource.getFullPath() + " ["
			+ instructionText + "]");
	try {
		marker.setAttribute(IMAGE_ATTRIBUTE, toAttribute(provider.getImage(instruction)));
	} catch (IOException e) {
		Activator.getDefault().error(e);
	}
	marker.setAttribute(TEXT_ATTRIBUTE, instructionText);
}
 
開發者ID:eclipse,項目名稱:gemoc-studio-modeldebugging,代碼行數:33,代碼來源:DSLBreakpoint.java

示例2: showInstruction

import org.eclipse.emf.ecore.EValidator; //導入依賴的package包/類
/**
 * Show the given {@link EObject instruction}.
 * 
 * @param editorPart
 *            the opened {@link DialectEditor}
 * @param instruction
 *            the {@link EObject instruction} to show
 */
public static void showInstruction(DialectEditor editorPart, EObject instruction) {
	final URI resourceURI = instruction.eResource().getURI();
	if (resourceURI.isPlatformResource()) {
		final String resourcePath = resourceURI.toPlatformString(true);
		final IResource resource = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(
				resourcePath));
		try {
			final IMarker marker = resource.createMarker(EValidator.MARKER);
			marker.setAttribute(EValidator.URI_ATTRIBUTE, EcoreUtil.getURI(instruction).toString());
			final TraceabilityMarkerNavigationProvider navigationProvider = new TraceabilityMarkerNavigationProvider(
					(DialectEditor)editorPart);
			navigationProvider.gotoMarker(marker);
			marker.delete();
		} catch (CoreException e) {
			DebugSiriusIdeUiPlugin.INSTANCE.log(e);
		}
	}
}
 
開發者ID:eclipse,項目名稱:gemoc-studio-modeldebugging,代碼行數:27,代碼來源:SiriusEditorUtils.java

示例3: validate

import org.eclipse.emf.ecore.EValidator; //導入依賴的package包/類
@Override
public boolean validate ( final EObject eObject, final DiagnosticChain diagnostics, final Map<Object, Object> context )
{
    boolean result = true;
    for ( final EValidator v : this.otherValidators )
    {
        if ( !v.validate ( eObject, diagnostics, context ) )
        {
            result = false;
        }
    }

    ValidationPlugin.runValidation ( eObject, diagnostics, context );

    return result;
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:17,代碼來源:ExtensibleValidator.java

示例4: setup

import org.eclipse.emf.ecore.EValidator; //導入依賴的package包/類
/**
 * Registers validators.
 */
static void setup() {
    final EValidator.Registry registry = EValidator.Registry.INSTANCE;

    registry.put(TypesPackage.eINSTANCE, new TypesValidator());
    registry.put(ModulesPackage.eINSTANCE, new ModulesValidator());
    registry.put(ResourcesPackage.eINSTANCE, new ResourcesValidator());
    registry.put(ResponsesPackage.eINSTANCE, new ResponsesValidator());

    final RamlObjectValidator ramlObjectValidator = new RamlObjectValidator();
    for (final EPackage ePackage : PACKAGES) {
        final CompositeValidator compositeValidator = new CompositeValidator();
        compositeValidator.add(ramlObjectValidator);
        final EValidator validator = registry.getEValidator(ePackage);
        if (validator != null) {
            compositeValidator.add(validator);
        }
        registry.put(ePackage, compositeValidator);
    }
}
 
開發者ID:vrapio,項目名稱:rest-modeling-framework,代碼行數:23,代碼來源:RamlValidationSetup.java

示例5: equals

import org.eclipse.emf.ecore.EValidator; //導入依賴的package包/類
@Override
public boolean equals(Object obj) {
	if (!(obj instanceof EValidatorEqualitySupport))
		return false;
	EValidator otherDelegate = ((EValidatorEqualitySupport) obj).getDelegate();
	if (otherDelegate.getClass().equals(getDelegate().getClass())) {
		if (delegate instanceof AbstractInjectableValidator) {
			AbstractInjectableValidator casted = (AbstractInjectableValidator) getDelegate();
			AbstractInjectableValidator otherCasted = (AbstractInjectableValidator) otherDelegate;
			if (casted.isLanguageSpecific() == otherCasted.isLanguageSpecific()) {
				if (casted.isLanguageSpecific()) {
					return Objects.equal(casted.getLanguageName(), otherCasted.getLanguageName());
				}
				return true;
			}
			return false;
		}
		return true;
	}
	return false;
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:22,代碼來源:CompositeEValidator.java

示例6: makeCopyOfGlobalState

import org.eclipse.emf.ecore.EValidator; //導入依賴的package包/類
public static GlobalStateMemento makeCopyOfGlobalState() {
	GlobalStateMemento memento = new GlobalStateMemento();
	memento.validatorReg = new HashMap<EPackage, Object>(EValidator.Registry.INSTANCE);
	for(Map.Entry<EPackage, Object> validatorEntry: memento.validatorReg.entrySet()) {
		Object existingValue = validatorEntry.getValue();
		if (existingValue instanceof CompositeEValidator) {
			validatorEntry.setValue(((CompositeEValidator) existingValue).getCopyAndClearContents());
		}
	}
	memento.epackageReg = new HashMap<String, Object>(EPackage.Registry.INSTANCE);
	memento.protocolToFactoryMap = new HashMap<String, Object>(Resource.Factory.Registry.INSTANCE.getProtocolToFactoryMap());
	memento.extensionToFactoryMap = new HashMap<String, Object>(Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap());
	memento.contentTypeIdentifierToFactoryMap = new HashMap<String, Object>(Resource.Factory.Registry.INSTANCE.getContentTypeToFactoryMap());

	memento.protocolToServiceProviderMap = new HashMap<String, Object>(IResourceServiceProvider.Registry.INSTANCE.getProtocolToFactoryMap());
	memento.extensionToServiceProviderMap = new HashMap<String, Object>(IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap());
	memento.contentTypeIdentifierToServiceProviderMap = new HashMap<String, Object>(IResourceServiceProvider.Registry.INSTANCE.getContentTypeToFactoryMap());
	return memento;
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:20,代碼來源:GlobalRegistries.java

示例7: ValidatorTester

import org.eclipse.emf.ecore.EValidator; //導入依賴的package包/類
@Inject
public ValidatorTester(T validator, EValidatorRegistrar registrar, @Named(Constants.LANGUAGE_NAME) final String languageName) {
	this.validator = validator;
	EValidator.Registry originalRegistry = registrar.getRegistry();
	EValidatorRegistryImpl newRegistry = new EValidatorRegistryImpl();
	registrar.setRegistry(newRegistry);
	this.validator.register(registrar);
	diagnostician = new Diagnostician(newRegistry) {
		@Override
		public java.util.Map<Object,Object> createDefaultContext() {
			java.util.Map<Object,Object> map = super.createDefaultContext();
			map.put(AbstractInjectableValidator.CURRENT_LANGUAGE_NAME, languageName);
			return map;
		}
	};
	registrar.setRegistry(originalRegistry);
	validatorCalled = false;
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:19,代碼來源:ValidatorTester.java

示例8: testBug_279962

import org.eclipse.emf.ecore.EValidator; //導入依賴的package包/類
@Test public void testBug_279962() {
	EValidator validator = registry.getEValidator(pack);
	assertTrue(validator instanceof CompositeEValidator);
	CompositeEValidator composite = (CompositeEValidator) validator;
	
	int prevSize = composite.getContents().size();
	
	get(Val_279962_01.class);
	get(Val_279962_04.class);
	assertEquals(prevSize + 2, composite.getContents().size());
	assertNotNull(validator);
	Resource resource = get(XtextResource.class);
	Model model = EnumRulesTestLanguageFactory.eINSTANCE.createModel();
	resource.getContents().add(model);
	// do not expect an exception
	validator.validate(model, new BasicDiagnostic(), null);
	assertEquals(prevSize + 4, composite.getContents().size());
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:19,代碼來源:AbstractCompositeValidatorTest.java

示例9: setUp

import org.eclipse.emf.ecore.EValidator; //導入依賴的package包/類
@Override
public void setUp() throws Exception {
	super.setUp();
	with(XtextStandaloneSetup.class);
	EValidator.Registry.INSTANCE.put(EcorePackage.eINSTANCE, EcoreValidator.INSTANCE);
		File tempFile = File.createTempFile("XtextValidationTest", ".ecore");
		tempFile.deleteOnExit();
		Files.write("<?xml version='1.0' encoding='UTF-8'?>" +
				"<ecore:EPackage xmi:version='2.0' xmlns:xmi='http://www.omg.org/XMI'"+
				"                xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'"+
				"                xmlns:ecore='http://www.eclipse.org/emf/2002/Ecore'"+
				"                name='XtextValidationBugs'"+
				"                nsURI='http://XtextValidationBugs'"+
				"                nsPrefix='XtextValidationBugs'>"+
				"  <eClassifiers xsi:type='ecore:EClass' name='Bug322875'>"+
				"    <eStructuralFeatures xsi:type='ecore:EReference' name='referencesETypeFromClasspathPackage' eType='ecore:EClass classpath:/org/eclipse/xtext/Xtext.ecore#//Grammar'/>"+
				"  </eClassifiers>"+
				"</ecore:EPackage>"
				, tempFile, StandardCharsets.UTF_8);
		xtextValidationTest_ecore = tempFile.toURI().toURL();
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:22,代碼來源:XtextValidationTest.java

示例10: gotoMarker

import org.eclipse.emf.ecore.EValidator; //導入依賴的package包/類
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void gotoMarker(IMarker marker) {
	try {
		if (marker.getType().equals(EValidator.MARKER)) {
			String uriAttribute = marker.getAttribute(EValidator.URI_ATTRIBUTE, null);
			if (uriAttribute != null) {
				URI uri = URI.createURI(uriAttribute);
				EObject eObject = editingDomain.getResourceSet().getEObject(uri, true);
				if (eObject != null) {
				  setSelectionToViewer(Collections.singleton(editingDomain.getWrapper(eObject)));
				}
			}
		}
	}
	catch (CoreException exception) {
		ModelEditorPlugin.INSTANCE.log(exception);
	}
}
 
開發者ID:emfjson,項目名稱:emfjson-samples,代碼行數:23,代碼來源:ModelEditor.java

示例11: getAdapter

import org.eclipse.emf.ecore.EValidator; //導入依賴的package包/類
/**
 * {@inheritDoc}
 *
 * @see org.eclipse.mylyn.docs.intent.mapping.ide.adapter.IMarkerToLocationDescriptor#getAdapter(org.eclipse.core.resources.IMarker)
 */
public ILocationDescriptor getAdapter(IMarker marker) {
	ILocationDescriptor res = null;

	try {
		if (marker.isSubtypeOf(EValidator.MARKER)) {
			final String uri = (String)marker.getAttribute(IEObjectLocationMaker.URI_ATTRIBUTE);
			// TODO we should change this to use a global ResourceSet...
			final ResourceSet rs = new ResourceSetImpl();
			final EObject eObject = rs.getEObject(URI.createURI(uri), true);
			res = IdeMappingUtils.adapt(eObject, ILocationDescriptor.class);
		}
	} catch (CoreException e) {
		Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(),
				e));
	}

	return res;
}
 
開發者ID:ModelWriter,項目名稱:Source,代碼行數:24,代碼來源:MarkerToEObjectLocationDescriptor.java

示例12: execute

import org.eclipse.emf.ecore.EValidator; //導入依賴的package包/類
public static List<Diagnostic> execute(Model model){
	OCLstdlibStandaloneSetup.doSetup();
	EssentialOCLStandaloneSetup.doSetup();
	CompleteOCLStandaloneSetup.doSetup();
	OCLstdlib.install();				
	OCL ocl = OCL.newInstance();
	List<String> oclFilePaths = new ArrayList<String>();
	oclFilePaths.add("model/ontouml.ocl");
	if(checkTypes) oclFilePaths.add("model/types.ocl");
	if(checkRelationships) oclFilePaths.add("model/relationships.ocl");
	if(checkMetaAttributes) oclFilePaths.add("model/metaattributes.ocl");
	if(checkBinaryProperties) oclFilePaths.add("model/binproperties.ocl");
	if(checkDependencies) oclFilePaths.add("model/dependency.ocl");
	if(checkCardinalities) oclFilePaths.add("model/cardinalities.ocl");				
	ComposedEValidator composed = ComposedEValidator.install(OntoumlPackage.eINSTANCE);
	for(String oclPath: oclFilePaths){
		File file = new File(oclPath);
		URI oclURI = URI.createFileURI(file.getAbsolutePath());			
		CompleteOCLEObjectValidator myValidator = new CompleteOCLEObjectValidator(OntoumlPackage.eINSTANCE, oclURI, ocl.getEnvironmentFactory());
		EValidator.Registry.INSTANCE.put(OntoumlPackage.eINSTANCE, myValidator);
		composed.addChild(myValidator);
	}						
	Diagnostic diagnostics = Diagnostician.INSTANCE.validate(model);			
	return diagnostics.getChildren();
}
 
開發者ID:MenthorTools,項目名稱:menthor-xcore,代碼行數:26,代碼來源:OntoumlDiagnostician.java

示例13: gotoMarker

import org.eclipse.emf.ecore.EValidator; //導入依賴的package包/類
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void gotoMarker(IMarker marker) {
	try {
		if (marker.getType().equals(EValidator.MARKER)) {
			String uriAttribute = marker.getAttribute(
					EValidator.URI_ATTRIBUTE, null);
			if (uriAttribute != null) {
				URI uri = URI.createURI(uriAttribute);
				EObject eObject = editingDomain.getResourceSet()
						.getEObject(uri, true);
				if (eObject != null) {
					setSelectionToViewer(Collections
							.singleton(editingDomain.getWrapper(eObject)));
				}
			}
		}
	} catch (CoreException exception) {
		bpmn2EditorPlugin.INSTANCE.log(exception);
	}
}
 
開發者ID:logicalhacking,項目名稱:SecureBPMN,代碼行數:25,代碼來源:Securebpmn2Editor.java

示例14: gotoMarker

import org.eclipse.emf.ecore.EValidator; //導入依賴的package包/類
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void gotoMarker(IMarker marker) {
	try {
		if (marker.getType().equals(EValidator.MARKER)) {
			String uriAttribute = marker.getAttribute(EValidator.URI_ATTRIBUTE, null);
			if (uriAttribute != null) {
				URI uri = URI.createURI(uriAttribute);
				EObject eObject = editingDomain.getResourceSet().getEObject(uri, true);
				if (eObject != null) {
				  setSelectionToViewer(Collections.singleton(editingDomain.getWrapper(eObject)));
				}
			}
		}
	}
	catch (CoreException exception) {
		NotationEditorPlugin.INSTANCE.log(exception);
	}
}
 
開發者ID:SOM-Research,項目名稱:collaboro,代碼行數:23,代碼來源:NotationEditor.java

示例15: gotoMarker

import org.eclipse.emf.ecore.EValidator; //導入依賴的package包/類
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void gotoMarker(IMarker marker) {
	try {
		if (marker.getType().equals(EValidator.MARKER)) {
			String uriAttribute = marker.getAttribute(EValidator.URI_ATTRIBUTE, null);
			if (uriAttribute != null) {
				URI uri = URI.createURI(uriAttribute);
				EObject eObject = editingDomain.getResourceSet().getEObject(uri, true);
				if (eObject != null) {
				  setSelectionToViewer(Collections.singleton(editingDomain.getWrapper(eObject)));
				}
			}
		}
	}
	catch (CoreException exception) {
		HistoryEditorPlugin.INSTANCE.log(exception);
	}
}
 
開發者ID:SOM-Research,項目名稱:collaboro,代碼行數:23,代碼來源:HistoryEditor.java


注:本文中的org.eclipse.emf.ecore.EValidator類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。