org.eclipse.xtext.parser.antlr.IReferableElementsUnloader Java Examples
The following examples show how to use
org.eclipse.xtext.parser.antlr.IReferableElementsUnloader.
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: JavaSourceLanguageRuntimeModule.java From xtext-extras with Eclipse Public License 2.0 | 6 votes |
@Override protected void configure() { bind(Resource.Factory.class).to(JavaResource.Factory.class); bind(IResourceValidator.class).toInstance(IResourceValidator.NULL); bind(IGenerator.class).to(IGenerator.NullGenerator.class); bind(IEncodingProvider.class).to(IEncodingProvider.Runtime.class); bind(IResourceServiceProvider.class).to(JavaResourceServiceProvider.class); bind(IContainer.Manager.class).to(SimpleResourceDescriptionsBasedContainerManager.class); bind(IResourceDescription.Manager.class).to(JavaResourceDescriptionManager.class); bind(IQualifiedNameProvider.class).to(JvmIdentifiableQualifiedNameProvider.class); bind(String.class).annotatedWith(Names.named(Constants.FILE_EXTENSIONS)).toInstance("java"); bind(String.class).annotatedWith(Names.named(Constants.LANGUAGE_NAME)) .toInstance("org.eclipse.xtext.java.Java"); bind(IJvmTypeProvider.Factory.class).to(ClasspathTypeProviderFactory.class); bind(ClassLoader.class).toInstance(JavaSourceLanguageRuntimeModule.class.getClassLoader()); bind(IReferableElementsUnloader.class).to(IReferableElementsUnloader.GenericUnloader.class); bind(IResourceDescriptionsProvider.class) .toInstance((ResourceSet rs) -> ChunkedResourceDescriptions.findInEmfObject(rs)); }
Example #2
Source File: AbstractPartialParserReplaceTest.java From xtext-core with Eclipse Public License 2.0 | 6 votes |
protected void replaceAndReparse(String model, int offset, int length, String change, String expectedReparseRegion) throws Exception { IParseResult parseResult = getParseResult(model); PartialParsingPointers parsingPointers = getPartialParser().calculatePartialParsingPointers(parseResult, offset, length); String reparseRegion = getPartialParser().insertChangeIntoReplaceRegion(parsingPointers .getDefaultReplaceRootNode(), new ReplaceRegion(offset, length, change)); assertEquals(expectedReparseRegion, reparseRegion); final Wrapper<Boolean> unloaded = Wrapper.wrap(Boolean.FALSE); getPartialParser().setUnloader(new IReferableElementsUnloader() { @Override public void unloadRoot(EObject root) { unloaded.set(Boolean.TRUE); } }); IParseResult partiallyReparse = reparse(parseResult, offset, length, change); assertTrue("unloaded", unloaded.get()); assertFalse(partiallyReparse.getRootNode().getText(), partiallyReparse.hasSyntaxErrors()); String expectedReparseModel = model.substring(0, offset) + change + model.substring(offset + length); assertEquals(expectedReparseModel, partiallyReparse.getRootNode().getText()); }
Example #3
Source File: AbstractPartialParserCrossContainmentTest.java From xtext-core with Eclipse Public License 2.0 | 6 votes |
protected void replaceAndReparse(String model, int offset, int length, String inserted, boolean expectSameRoot) throws Exception { final XtextResource resource = getResourceFromString(model); resource.setUnloader(new IReferableElementsUnloader() { @Override public void unloadRoot(EObject root) { InternalEObject internalEObject = (InternalEObject) root; internalEObject.eSetProxyURI(resource.getURI().appendFragment(resource.getURIFragment(internalEObject))); internalEObject.eAdapters().clear(); }}); assertEquals(1, resource.getContents().size()); EObject wasObject = resource.getContents().get(0); assertNotNull(wasObject.eContainer()); assertNotSame(wasObject.eResource(), wasObject.eContainer().eResource()); resource.update(offset, length, inserted); assertEquals(1, resource.getContents().size()); EObject newRoot = resource.getContents().get(0); assertEquals(expectSameRoot, wasObject == newRoot); if (!expectSameRoot) { assertTrue(((InternalEObject)wasObject).eIsProxy()); assertNotSame(resource, wasObject.eResource()); } assertSame(resource, newRoot.eResource()); }
Example #4
Source File: Bug419429Test.java From xtext-core with Eclipse Public License 2.0 | 6 votes |
protected void replaceAndReparse(String model, int offset, int length, String change, String expectedReparseRegion) throws Exception { IParseResult parseResult = getParseResultAndExpect(model, UNKNOWN_EXPECTATION); PartialParsingPointers parsingPointers = getPartialParser().calculatePartialParsingPointers(parseResult, offset, length); String reparseRegion = getPartialParser().insertChangeIntoReplaceRegion(parsingPointers .getDefaultReplaceRootNode(), new ReplaceRegion(offset, length, change)); assertEquals(expectedReparseRegion, reparseRegion); final Wrapper<Boolean> unloaded = Wrapper.wrap(Boolean.FALSE); getPartialParser().setUnloader(new IReferableElementsUnloader() { @Override public void unloadRoot(EObject root) { unloaded.set(Boolean.TRUE); } }); IParseResult partiallyReparse = reparse(parseResult, offset, length, change); assertTrue("unloaded", unloaded.get()); String expectedReparseModel = model.substring(0, offset) + change + model.substring(offset + length); assertEquals(expectedReparseModel, partiallyReparse.getRootNode().getText()); compareWithFullParse(model, offset, length, change); }
Example #5
Source File: XtextResourceTest.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
@Test public void testUnloadReferables() throws Exception { resource.reparse(simpleModel); final Wrapper<Boolean> unloaded = Wrapper.wrap(Boolean.FALSE); resource.setUnloader(new IReferableElementsUnloader() { @Override public void unloadRoot(EObject root) { unloaded.set(Boolean.TRUE); } }); resource.reparse(simpleModel); assertTrue("unloaded", unloaded.get()); }
Example #6
Source File: XtextLinker.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
public void setUnloader(IReferableElementsUnloader unloader) { this.unloader = unloader; }
Example #7
Source File: XtextLinker.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
public IReferableElementsUnloader getUnloader() { return unloader; }
Example #8
Source File: PartialParsingHelper.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
public void setUnloader(IReferableElementsUnloader unloader) { this.unloader = unloader; }
Example #9
Source File: PartialParsingHelper.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
public IReferableElementsUnloader getUnloader() { return unloader; }
Example #10
Source File: XtextResource.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
public void setUnloader(IReferableElementsUnloader unloader) { this.unloader = unloader; }
Example #11
Source File: XtextResource.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
public IReferableElementsUnloader getUnloader() { return unloader; }
Example #12
Source File: XtextRuntimeModule.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
public Class<? extends IReferableElementsUnloader> bindIReferableElementsUnloader() { return XtextReferableElementsUnloader.class; }
Example #13
Source File: FixedPartialParsingHelper.java From dsl-devkit with Eclipse Public License 1.0 | 4 votes |
public void setUnloader(final IReferableElementsUnloader unloader) { this.unloader = unloader; }
Example #14
Source File: FixedPartialParsingHelper.java From dsl-devkit with Eclipse Public License 1.0 | 4 votes |
public IReferableElementsUnloader getUnloader() { return unloader; }
Example #15
Source File: N4JSRuntimeModule.java From n4js with Eclipse Public License 1.0 | 2 votes |
/** * Unloads type model instances. * * @return Class<{@link N4JSUnloader}> */ public Class<? extends IReferableElementsUnloader> bindIReferableElementsUnloader() { return N4JSUnloader.class; }