Skip to content

Commit

Permalink
Improved UX of web editor
Browse files Browse the repository at this point in the history
  • Loading branch information
aedelmann committed Jun 20, 2017
1 parent 38249a1 commit 71cd822
Show file tree
Hide file tree
Showing 32 changed files with 408 additions and 1,906 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@
*/
package org.eclipse.vorto.editor.datatype.web

import com.google.inject.AbstractModule
import com.google.inject.Guice
import com.google.inject.Injector
import com.google.inject.Provider
import com.google.inject.util.Modules
import java.util.concurrent.ExecutorService
import org.eclipse.vorto.devtool.projectrepository.IProjectRepositoryService
import org.eclipse.vorto.editor.datatype.DatatypeRuntimeModule
import org.eclipse.vorto.editor.datatype.DatatypeStandaloneSetup
import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor
Expand All @@ -35,10 +37,18 @@ class DatatypeWebSetup extends DatatypeStandaloneSetup {

val Provider<ExecutorService> executorServiceProvider;

val IProjectRepositoryService projectRepositoryService;

override Injector createInjector() {
val runtimeModule = new DatatypeRuntimeModule()
val webModule = new DatatypeWebModule(executorServiceProvider)
return Guice.createInjector(Modules.override(runtimeModule).with(webModule))
return Guice.createInjector(Modules.override(runtimeModule).with(webModule,new AbstractModule(){

override protected configure() {
bind(typeof(IProjectRepositoryService)).toInstance(projectRepositoryService);
}

}))
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@
*/
package org.eclipse.vorto.editor.functionblock.web

import com.google.inject.AbstractModule
import com.google.inject.Guice
import com.google.inject.Injector
import com.google.inject.Provider
import com.google.inject.util.Modules
import java.util.concurrent.ExecutorService
import org.eclipse.vorto.devtool.projectrepository.IProjectRepositoryService
import org.eclipse.vorto.editor.functionblock.FunctionblockRuntimeModule
import org.eclipse.vorto.editor.functionblock.FunctionblockStandaloneSetup
import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor
Expand All @@ -35,10 +37,18 @@ class FunctionblockWebSetup extends FunctionblockStandaloneSetup {

val Provider<ExecutorService> executorServiceProvider;

val IProjectRepositoryService projectRepositoryService;

override Injector createInjector() {
val runtimeModule = new FunctionblockRuntimeModule()
val webModule = new FunctionblockWebModule(executorServiceProvider)
return Guice.createInjector(Modules.override(runtimeModule).with(webModule))
return Guice.createInjector(Modules.override(runtimeModule).with(webModule,new AbstractModule(){

override protected configure() {
bind(typeof(IProjectRepositoryService)).toInstance(projectRepositoryService);
}

}))
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class InformationModelWebModule extends AbstractInformationModelWebModule {
def Class<? extends IServerResourceHandler> bindIServerResourceHandler() {
return FileResourceHandler;
}

override bindIContentTypeProvider() {
return ContentTypeProvider
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import java.util.concurrent.ExecutorService
import org.eclipse.vorto.editor.infomodel.InformationModelRuntimeModule
import org.eclipse.vorto.editor.infomodel.InformationModelStandaloneSetup
import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor
import com.google.inject.AbstractModule
import org.eclipse.vorto.devtool.projectrepository.IProjectRepositoryService

/**
* Initialization support for running Xtext languages in web applications.
Expand All @@ -35,10 +37,19 @@ class InformationModelWebSetup extends InformationModelStandaloneSetup {

val Provider<ExecutorService> executorServiceProvider;

val IProjectRepositoryService projectRepositoryService;


override Injector createInjector() {
val runtimeModule = new InformationModelRuntimeModule()
val webModule = new InformationModelWebModule(executorServiceProvider)
return Guice.createInjector(Modules.override(runtimeModule).with(webModule))
return Guice.createInjector(Modules.override(runtimeModule).with(webModule,new AbstractModule(){

override protected configure() {
bind(typeof(IProjectRepositoryService)).toInstance(projectRepositoryService);
}

}))
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,12 @@ class FileResourceHandler implements IServerResourceHandler {
@Inject
private IEncodingProvider encodingProvider

private String projectRepositoryPath = "devtool-project-repository";

private IProjectRepositoryService projectRepositoryService = new ProjectRepositoryServiceFS(projectRepositoryPath);

@Inject
private IProjectRepositoryService repositoryService;

def getFileURI(String resourceId) {
val resource = projectRepositoryService.createQuery().property(ProjectRepositoryFileConstants.META_PROPERTY_RESOURCE_ID, resourceId).singleResult();
return URI.createFileURI(projectRepositoryPath + File.separator + resource.path);
val resource = repositoryService.createQuery().property(ProjectRepositoryFileConstants.META_PROPERTY_RESOURCE_ID, resourceId).singleResult();
return URI.createFileURI((repositoryService as ProjectRepositoryServiceFS).projectsDirectory + File.separator + resource.path);
}

override get(String resourceId, IServiceContext serviceContext) throws IOException {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ public class ProjectRepositoryFileConstants {

public static final String META_PROPERTY_MODEL_SUB_TYPE = "modelSubType";

public static final String META_PROPERTY_IS_PROJECT = "isProject";

}
Loading

0 comments on commit 71cd822

Please sign in to comment.