org.eclipse.xtext.ui.resource.Storage2UriMapperImpl Java Examples

The following examples show how to use org.eclipse.xtext.ui.resource.Storage2UriMapperImpl. 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: JavaProjectsStateTest.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
@Override
protected JavaProjectsState createProjectsState(IStorage2UriMapper mapper) {
	JavaProjectsState result = new JavaProjectsState();
	result.setMapper(mapper);
	result.setJdtHelper(new JdtHelper());
	result.setJavaProjectClasspathChangeAnalyzer(new JavaProjectClasspathChangeAnalyzer());
	JavaProjectsStateHelper javaProjectsStateHelper = new JavaProjectsStateHelper();
	javaProjectsStateHelper.setMapper(mapper);
	javaProjectsStateHelper.setUriMapperExtensions((IStorage2UriMapperJdtExtensions) ((Storage2UriMapperImpl)mapper).getContribution());
	javaProjectsStateHelper.setWorkspace(ResourcesPlugin.getWorkspace());
	result.setJavaProjectsHelper(javaProjectsStateHelper);
	WorkspaceProjectsStateHelper workspaceStateHelper = new WorkspaceProjectsStateHelper();
	workspaceStateHelper.setMapper(mapper);
	workspaceStateHelper.setWorkspace(ResourcesPlugin.getWorkspace());
	result.setProjectsHelper(workspaceStateHelper);
	return result;
}
 
Example #2
Source File: AbstractUtilTest.java    From dsl-devkit with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Prepare mocks for all tests.
 */
public static void prepareMocksBase() {
  oldDesc = mock(IResourceDescription.class);
  newDesc = mock(IResourceDescription.class);
  delta = mock(Delta.class);
  resource = mock(Resource.class);
  uriCorrect = mock(URI.class);
  when(uriCorrect.isPlatformResource()).thenReturn(true);
  when(uriCorrect.isFile()).thenReturn(true);
  when(uriCorrect.toFileString()).thenReturn(DUMMY_PATH);
  when(uriCorrect.toPlatformString(true)).thenReturn(DUMMY_PATH);
  when(delta.getNew()).thenReturn(newDesc);
  when(delta.getOld()).thenReturn(oldDesc);
  when(delta.getUri()).thenReturn(uriCorrect);
  when(resource.getURI()).thenReturn(uriCorrect);
  file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(uriCorrect.toPlatformString(true)));
  Iterable<Pair<IStorage, IProject>> storages = singleton(Tuples.<IStorage, IProject> create(file, file.getProject()));
  mapperCorrect = mock(Storage2UriMapperImpl.class);
  when(mapperCorrect.getStorages(uriCorrect)).thenReturn(storages);
}
 
Example #3
Source File: StrictJavaProjectsStateTest.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected StrictJavaProjectsState createProjectsState(IStorage2UriMapper mapper) {
	StrictJavaProjectsState result = new StrictJavaProjectsState();
	result.setMapper(mapper);
	result.setJdtHelper(new JdtHelper());
	result.setJavaProjectClasspathChangeAnalyzer(new JavaProjectClasspathChangeAnalyzer());
	JavaProjectsStateHelper javaProjectsStateHelper = new JavaProjectsStateHelper();
	javaProjectsStateHelper.setMapper(mapper);
	javaProjectsStateHelper.setUriMapperExtensions((IStorage2UriMapperJdtExtensions) ((Storage2UriMapperImpl)mapper).getContribution());
	javaProjectsStateHelper.setWorkspace(ResourcesPlugin.getWorkspace());
	result.setHelper(javaProjectsStateHelper);
	return result;
}
 
Example #4
Source File: RuntimeProjectUtilTest.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Prepare mocks for all tests.
 */
@Override
protected void beforeAllTests() {
  super.beforeAllTests();
  prepareMocksBase();
  uriInCorrect = mock(URI.class);
  mapperInCorrect = mock(Storage2UriMapperImpl.class);
  when(mapperInCorrect.getStorages(uriInCorrect)).thenReturn(Collections.<Pair<IStorage, IProject>> emptySet());
  when(mapperInCorrect.getStorages(uriCorrect)).thenReturn(Collections.<Pair<IStorage, IProject>> emptySet());
}